MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/driver/chipset/ADS1259ExtendedAdcReader.cpp
2024-06-07 11:12:56 +03:00

39 lines
940 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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;
}