mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 15:23:57 -04:00
AP_ADC: use new scheduler API
This commit is contained in:
parent
19e9c95983
commit
6134d9d0d7
@ -81,11 +81,7 @@ static volatile uint32_t _ch6_delta_time_start_micros = 0;
|
||||
// time latest sample was collected
|
||||
static volatile uint32_t _ch6_last_sample_time_micros = 0;
|
||||
|
||||
AP_HAL::SPIDeviceDriver* AP_ADC_ADS7844::_spi = NULL;
|
||||
AP_HAL::Semaphore* AP_ADC_ADS7844::_spi_sem = NULL;
|
||||
|
||||
|
||||
void AP_ADC_ADS7844::read(uint32_t tnow)
|
||||
void AP_ADC_ADS7844::read(void)
|
||||
{
|
||||
static int semfail_ctr = 0;
|
||||
uint8_t ch;
|
||||
@ -175,7 +171,7 @@ void AP_ADC_ADS7844::Init()
|
||||
|
||||
_ch6_last_sample_time_micros = hal.scheduler->micros();
|
||||
|
||||
hal.scheduler->register_timer_process( AP_ADC_ADS7844::read );
|
||||
hal.scheduler->register_timer_process( reinterpret_cast<AP_HAL::TimedProc>(&AP_ADC_ADS7844::read), this );
|
||||
hal.scheduler->resume_timer_procs();
|
||||
|
||||
}
|
||||
|
@ -26,10 +26,9 @@ public:
|
||||
uint16_t num_samples_available(const uint8_t *channel_numbers);
|
||||
|
||||
private:
|
||||
static void read(uint32_t);
|
||||
static AP_HAL::SPIDeviceDriver *_spi;
|
||||
static AP_HAL::Semaphore *_spi_sem;
|
||||
|
||||
void read(void);
|
||||
AP_HAL::SPIDeviceDriver *_spi;
|
||||
AP_HAL::Semaphore *_spi_sem;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -30,8 +30,6 @@ const float AP_ADC_HIL::accelBias[3] = {2025,2025,2025};
|
||||
const float AP_ADC_HIL::gyroScale[3] = {143.239, 139.746, 139.746};
|
||||
const float AP_ADC_HIL::accelScale[3] = {418,418,418}; // adcPerG
|
||||
|
||||
uint16_t AP_ADC_HIL::_count; // number of samples captured
|
||||
|
||||
AP_ADC_HIL::AP_ADC_HIL()
|
||||
{
|
||||
// gyros set to zero for calibration
|
||||
@ -51,7 +49,7 @@ AP_ADC_HIL::AP_ADC_HIL()
|
||||
|
||||
void AP_ADC_HIL::Init()
|
||||
{
|
||||
hal.scheduler->register_timer_process( AP_ADC_HIL::read );
|
||||
hal.scheduler->register_timer_process( reinterpret_cast<AP_HAL::TimedProc>(&AP_ADC_HIL::read), this);
|
||||
}
|
||||
|
||||
// Read one channel value
|
||||
|
@ -103,12 +103,12 @@ private:
|
||||
void setGyroTemp(int16_t val) {
|
||||
}
|
||||
|
||||
// read function that pretends to capture new data
|
||||
static void read(uint32_t tnow) {
|
||||
// read function that pretends to capture new data
|
||||
void read(void) {
|
||||
_count++;
|
||||
}
|
||||
|
||||
static uint16_t _count; // number of samples captured
|
||||
uint16_t _count; // number of samples captured
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user