1
0
mirror of https://github.com/elua/elua.git synced 2025-01-25 01:02:54 +08:00

Merge pull request #128 from elua/adc_fixes

Adc fixes
This commit is contained in:
Bogdan Marinescu 2018-05-20 21:32:22 +03:00 committed by GitHub
commit 0e4715b7a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 7 deletions

View File

@ -31,3 +31,12 @@ jobs:
- run:
name: Build eLua for EK-LM3S8962
command: PATH=$PATH:$(readlink -f bin/gcc-arm-none-eabi-7-2017-q4-major/bin) lua build_elua.lua board=ek-lm3s8962
- run:
name: Build eLua for mbed LCP 1768
command: PATH=$PATH:$(readlink -f bin/gcc-arm-none-eabi-7-2017-q4-major/bin) lua build_elua.lua board=mbed
- run:
name: Build eLua for elua-puc
command: PATH=$PATH:$(readlink -f bin/gcc-arm-none-eabi-7-2017-q4-major/bin) lua build_elua.lua board=elua-puc
- run:
name: Build eLua for arm2368
command: PATH=$PATH:$(readlink -f bin/gcc-arm-none-eabi-7-2017-q4-major/bin) lua build_elua.lua board=arm2368

View File

@ -44,7 +44,7 @@ void adc_update_dev_sequence( unsigned dev_id )
{
s = adc_get_ch_state( id );
d->ch_state[ d->seq_ctr ] = s;
s->value_ptr = &( d->sample_buf[ d->seq_ctr ] );
s->value_ptr = &( d->sample_buf[ s->id ] );
s->value_fresh = 0;
if( s->id == previd )
tmp_seq_ctr = d->seq_ctr;

View File

@ -855,7 +855,7 @@ __attribute__((__interrupt__)) static void adc_int_handler()
if( adc_check_eoc( adc, s->id ) )
{
d->sample_buf[ d->seq_ctr ] = ( u16 )adc_get_value(adc, s->id );
d->sample_buf[ s->id ] = ( u16 )adc_get_value(adc, s->id );
s->value_fresh = 1;
if ( s->logsmoothlen > 0 && s->smooth_ready == 0)

View File

@ -878,7 +878,7 @@ void ADCIntHandler( void )
while( d->seq_ctr < d->seq_len )
{
s = d->ch_state[ d->seq_ctr ];
d->sample_buf[ d->seq_ctr ] = ( u16 )tmpbuff[ d->seq_ctr ];
d->sample_buf[ s->id ] = ( u16 )tmpbuff[ d->seq_ctr ];
s->value_fresh = 1; // Mark sample as fresh
// Fill in smoothing buffer until warmed up

View File

@ -465,7 +465,7 @@ void ADC_IRQHandler(void)
if ( ADC_ChannelGetStatus( LPC_ADC, s->id, ADC_DATA_DONE ) )
{
d->sample_buf[ d->seq_ctr ] = ( u16 )ADC_ChannelGetData( LPC_ADC, s->id );
d->sample_buf[ s->id ] = ( u16 )ADC_ChannelGetData( LPC_ADC, s->id );
s->value_fresh = 1;
if ( s->logsmoothlen > 0 && s->smooth_ready == 0)

View File

@ -542,7 +542,7 @@ static void adc_int_handler()
dreg_t = *( PREG )adc_dr[ s->id ];
if ( dreg_t & ( 1UL << 31 ) )
{
d->sample_buf[ d->seq_ctr ] = ( u16 )( ( dreg_t >> 6 ) & 0x3FF );
d->sample_buf[ s->id ] = ( u16 )( ( dreg_t >> 6 ) & 0x3FF );
AD0CR &= 0xF8FFFF00; // stop ADC, disable channels
s->value_fresh = 1;

View File

@ -607,7 +607,7 @@ static void adc_int_handler()
dreg_t = *( PREG )adc_dr[ s->id ];
if ( dreg_t & ( 1UL << 31 ) )
{
d->sample_buf[ d->seq_ctr ] = ( u16 )( ( dreg_t >> 6 ) & 0x3FF );
d->sample_buf[ s->id ] = ( u16 )( ( dreg_t >> 6 ) & 0x3FF );
AD0CR &= 0xF8FFFF00; // stop ADC, disable channels
s->value_fresh = 1;

View File

@ -506,7 +506,7 @@ void ADC_IRQHandler( void )
while( d->seq_ctr < d->seq_len )
{
s = d->ch_state[ d->seq_ctr ];
d->sample_buf[ d->seq_ctr ] = ( u16 )ADC_GetConversionValue( s->id );
d->sample_buf[ s->id ] = ( u16 )ADC_GetConversionValue( s->id );
s->value_fresh = 1;
// Fill in smoothing buffer until warmed up