diff --git a/libraries/AP_HAL_ChibiOS/SPIDevice.cpp b/libraries/AP_HAL_ChibiOS/SPIDevice.cpp index 73f7d99bf7..223be6bdb1 100644 --- a/libraries/AP_HAL_ChibiOS/SPIDevice.cpp +++ b/libraries/AP_HAL_ChibiOS/SPIDevice.cpp @@ -126,6 +126,7 @@ SPIDevice::SPIDevice(SPIBus &_bus, SPIDesc &_device_desc) device_desc.name, (unsigned)bus.bus, (unsigned)device_desc.device); AP_HAL::SPIDevice::setup_bankselect_callback(device_desc.bank_select_cb); + AP_HAL::SPIDevice::set_register_rw_callback(device_desc.register_rw_cb); //printf("SPI device %s on %u:%u at speed %u mode %u\n", // device_desc.name, // (unsigned)bus.bus, (unsigned)device_desc.device, @@ -441,6 +442,24 @@ SPIDeviceManager::get_device(const char *name) return AP_HAL::OwnPtr(new SPIDevice(*busp, desc)); } +void SPIDeviceManager::set_register_rw_callback(const char* name, AP_HAL::Device::RegisterRWCb cb) +{ + /* Find the bus description in the table */ + uint8_t i; + for (i = 0; i get_device(const char *name) override; + void set_register_rw_callback(const char* name, AP_HAL::Device::RegisterRWCb cb) override; + private: static SPIDesc device_table[]; SPIBus *buses;