HAL_Linux: implement I2C bus masks

This commit is contained in:
Andrew Tridgell 2018-06-21 13:09:31 +10:00 committed by Randy Mackay
parent 98f241c7e4
commit 15ff760601
2 changed files with 39 additions and 0 deletions

View File

@ -417,4 +417,28 @@ void I2CDeviceManager::teardown()
} }
} }
/*
get mask of bus numbers for all configured I2C buses
*/
uint32_t I2CDeviceManager::get_bus_mask(void) const
{
return HAL_LINUX_I2C_BUS_MASK;
}
/*
get mask of bus numbers for all configured internal I2C buses
*/
uint32_t I2CDeviceManager::get_bus_mask_internal(void) const
{
return HAL_LINUX_I2C_INTERNAL_BUS_MASK;
}
/*
get mask of bus numbers for all configured external I2C buses
*/
uint32_t I2CDeviceManager::get_bus_mask_external(void) const
{
return HAL_LINUX_I2C_EXTERNAL_BUS_MASK;
}
} }

View File

@ -110,6 +110,21 @@ public:
*/ */
void teardown(); void teardown();
/*
get mask of bus numbers for all configured I2C buses
*/
uint32_t get_bus_mask(void) const override;
/*
get mask of bus numbers for all configured external I2C buses
*/
uint32_t get_bus_mask_external(void) const override;
/*
get mask of bus numbers for all configured internal I2C buses
*/
uint32_t get_bus_mask_internal(void) const override;
protected: protected:
void _unregister(I2CBus &b); void _unregister(I2CBus &b);
AP_HAL::OwnPtr<AP_HAL::I2CDevice> _create_device(I2CBus &b, uint8_t address) const; AP_HAL::OwnPtr<AP_HAL::I2CDevice> _create_device(I2CBus &b, uint8_t address) const;