39 lines
940 B
C++
39 lines
940 B
C++
/*
|
||
* ADS1259ExtendedAdcReader.cpp
|
||
*
|
||
* Created on: 9 июл. 2020 г.
|
||
* Author: krugliy
|
||
*/
|
||
|
||
#include "ADS1259ExtendedAdcReader.hh"
|
||
|
||
void driver::chipset::ADS1259ExtendedAdcReader::process() {
|
||
|
||
if( periodizator.delayElapsed() and read() ) {
|
||
periodizator.start( update_period );
|
||
|
||
const PackagerADS1259Extended::RdataCrc data =
|
||
PackagerADS1259Extended::RdataCrc::createRdataCrc(
|
||
PackagerADS1259Extended::decode( read_adc_operation.output ) );
|
||
|
||
if( data_valid = PackagerADS1259Extended::RdataCrc::checkCrc( data ) )
|
||
adc_code = data.adc_result;
|
||
|
||
if( not adc_code )
|
||
data_valid = false;
|
||
}
|
||
|
||
}
|
||
|
||
bool driver::chipset::ADS1259ExtendedAdcReader::read() {
|
||
|
||
if( start_conv ) {
|
||
|
||
start_conv = not ( adc_readed = read_adc_operation() );
|
||
|
||
} else start_conv = start_adc_operation(), adc_readed = false;
|
||
|
||
return adc_readed;
|
||
|
||
}
|