Closed shakram02 closed 3 years ago
This looks pretty good @shakram02 :+1:
Have a look at the build logs, you have some indention issues to fix:
lsm303agr.adb:32:05: (style) bad indentation
[...]
Adjusting the format took quite a while :sweat_smile:,
can you please point me towards how to integrate this driver into microbit-accelerometer.ads?
Is it okay to declare 2 Accelerometer variables then use the working one? I guess that I'll also have to extract the All_Axes_Data
type.
Thank you @shakram02 !
Is it okay to declare 2 Accelerometer variables then use the working one?
Yes, that's how I would do it. Then do a check in Initialize
to see which one is available, and have a global variable to remember which one it is.
I guess that I'll also have to extract the
All_Axes_Data
type.
Since both data set have the same ranges, you can declare another All_Axes_Data
in MicroBit.Accelerometer
:
type Axis_Data is range -2**9 .. 2**9 - 1 with Size => 10;
type All_Axes_Data is record
X, Y, Z : Axis_Data;
end record;
and do an explicit cast for all fields from the drivers type to the MicroBit.Accelerometer
type.
Okay then, I'll work on it on a new branch :ok_hand:
This is a work in progress to support the LSM303AGR accelerometer. Mainly needed for MicroBit v1.5 boards