AP_InertialSensor: implement periodic thread for AuxiliaryBus
This commit is contained in:
parent
4263c1a90c
commit
06fe5ce8ba
@ -1120,3 +1120,9 @@ int AP_Invensense_AuxiliaryBus::_configure_periodic_read(AuxiliaryBusSlave *slav
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AP_HAL::Device::PeriodicHandle AP_Invensense_AuxiliaryBus::register_periodic_callback(uint32_t period_usec, AP_HAL::Device::PeriodicCb cb)
|
||||||
|
{
|
||||||
|
auto &backend = AP_InertialSensor_Invensense::from(_ins_backend);
|
||||||
|
return backend._dev->register_periodic_callback(period_usec, cb);
|
||||||
|
}
|
||||||
|
@ -173,6 +173,7 @@ class AP_Invensense_AuxiliaryBus : public AuxiliaryBus
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AP_HAL::Semaphore *get_semaphore() override;
|
AP_HAL::Semaphore *get_semaphore() override;
|
||||||
|
AP_HAL::Device::PeriodicHandle register_periodic_callback(uint32_t period_usec, AP_HAL::Device::PeriodicCb cb) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AP_Invensense_AuxiliaryBus(AP_InertialSensor_Invensense &backend, uint32_t devid);
|
AP_Invensense_AuxiliaryBus(AP_InertialSensor_Invensense &backend, uint32_t devid);
|
||||||
|
@ -100,12 +100,3 @@ int AuxiliaryBus::register_periodic_read(AuxiliaryBusSlave *slave, uint8_t reg,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
add a periodic callback. This is added to a list which the backend needs to then process
|
|
||||||
*/
|
|
||||||
AP_HAL::Device::PeriodicHandle AuxiliaryBus::register_periodic_callback(uint32_t period_usec, AP_HAL::Device::PeriodicCb cb)
|
|
||||||
{
|
|
||||||
// not implemented yet
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
@ -102,8 +102,12 @@ public:
|
|||||||
AuxiliaryBusSlave *request_next_slave(uint8_t addr);
|
AuxiliaryBusSlave *request_next_slave(uint8_t addr);
|
||||||
int register_periodic_read(AuxiliaryBusSlave *slave, uint8_t reg, uint8_t size);
|
int register_periodic_read(AuxiliaryBusSlave *slave, uint8_t reg, uint8_t size);
|
||||||
|
|
||||||
/* See AP_HAL::Device::register_periodic_callback() */
|
/* See AP_HAL::Device::register_periodic_callback()
|
||||||
AP_HAL::Device::PeriodicHandle register_periodic_callback(uint32_t, AP_HAL::Device::PeriodicCb);
|
*
|
||||||
|
* This method must be implemented by the sensor exposing the
|
||||||
|
* AuxiliaryBus.
|
||||||
|
*/
|
||||||
|
virtual AP_HAL::Device::PeriodicHandle register_periodic_callback(uint32_t, AP_HAL::Device::PeriodicCb) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the semaphore needed to call methods on the bus this sensor is on.
|
* Get the semaphore needed to call methods on the bus this sensor is on.
|
||||||
|
Loading…
Reference in New Issue
Block a user