AdaCore / Ada_Drivers_Library

Ada source code and complete sample GNAT projects for selected bare-board platforms supported by GNAT.
BSD 3-Clause "New" or "Revised" License
241 stars 142 forks source link

Support LSM303AGR for newer micro:bit hardware revisions #379

Closed KLOC-Karsten closed 3 years ago

KLOC-Karsten commented 3 years ago

While the v1.3 of the micro:bit used the MMA8653 accelerometer, v1.5 and v2 are currently using the LSM303AGR and may use the FXOS8700 in future.

The Ada Drivers Library currently provides only the code for the MMA8653. Any application will crash when the Ada MMA8653 package is used with an v1.5 / v2 micro:bit board due to the initialization code in MicroBit.Accelerometer.

Proposed Changes

Fabien-Chouteau commented 3 years ago

Hello @KLOC-Karsten,

A couple weeks ago I added a piece of code to detect when the expected accelerometer is not available: https://github.com/AdaCore/Ada_Drivers_Library/blob/a407ca7ddbc2d9756647016c2f8fd8ef24a239ff/boards/MicroBit/src/microbit-accelerometer.adb#L53

It would be nice indeed to have support for LSM303AGR, feel free to contribute that driver so we can integrate it in the micro:bit BSP.