Ada i2c demo on the microbit with the Ada Drivers Library?

bbc micro:bit arduino ide
adafruit pwm servo driver library
pca9685 i2c example
adafruit 16 channel servo driver with raspberry pi
download adafruit library
adafruit library for arduino free download

Overview: I'm trying to program a microbit with Ada using the Ada Drivers Library and I can't understand how to use the i2c functions to establish communications with another chip. I'd like to establish a simple demo so I can understand what's happening because the demos in the components directory of the Ada Drivers Library are going over my head (I'm pretty new to Ada too and that doesn't help matters).

The simplest i2c demo in the Ada Drivers Library appears to be for the AK8963 three axis compass (located in /components/src/motion/ak8963/). But that's still going over my head and I don't have the chip to run and debug the code.

Here's what I've tried: I've created two different demos with arduinos. In both demos the transmitter sends an 'A' and then a 'B' all the way to 'Z' and then loops back to 'A'. In the first demo the master transmits the next character every 500 ms and the slave receives it. And in the second demo the master requests the next character every 500 ms and the slave transmits it.

My demos are adapted from the arduino Wire examples found here and here.


[PDF] Making the Ada Drivers Library, Making the Ada Drivers Library. Embedded Embedded Software Engineer at AdaCore. Twitter Servo motor example. 2.5 ms. 1.5 ms BBC Micro:Bit (ARM Cortex-M0). 45 Linux GPIO/I2C/SPI support (on the Raspberry Pi for instance). This repository contains drivers and sample projects to program micro-controllers with the Ada and SPARK languages. The library also provides some middleware services and drivers for external devices such as sensors. We intend this to be a location for both AdaCore and the community in general to


I have not been able to test the code below, but it should at least give you some direction. Please note that the micro:bit acts as a master. I don't think the micro:bit can act as a slave on a I2C bus (but I might be wrong here). Also note that you may have to change the path to the microbit_zfp.gpr in the project file.

default.gpr

with "../Ada_Drivers_Library/boards/MicroBit/microbit_zfp.gpr";

project Default is

  for Runtime ("ada")      use MicroBit_ZFP'Runtime ("Ada");
  for Target               use "arm-eabi";
  for Main                 use ("main.adb");
  for Languages            use ("Ada");
  for Source_Dirs          use ("src");
  for Object_Dir           use "obj";
  for Create_Missing_Dirs  use "True";

  package Compiler renames MicroBit_ZFP.Compiler;

  package Linker is
     for Default_Switches ("Ada") use
       MicroBit_ZFP.Linker_Switches &
       ("-Wl,--print-memory-usage",
        "-Wl,--gc-sections",
        "-U__gnat_irq_trap");
  end Linker;

end Default;

main.adb

with MicroBit.Display; use MicroBit.Display;
with MicroBit.Time;    use MicroBit.Time;
with MicroBit.I2C;     use MicroBit.I2C;
with HAL.I2C;          use HAL.I2C;

procedure Main is
begin

   MicroBit.I2C.Initialize (S400kbps);   --  Change to desired speed.

   declare    
      Ctrl   : constant Any_I2C_Port := MicroBit.I2C.Controller;
      Addr   : constant I2C_Address := 16#08#;    --  Change to correct address.
      Data   : I2C_Data (0 .. 0);
      Status : I2C_Status;
   begin
      loop

         --  Data to be send (here: character 'x').
         Data (0) := Character'Pos ('x');

         --  Display a dot to indicate where we are.
         Display ('.');

         --  Send 1 byte of data (length of Data array is 1).
         Ctrl.Master_Transmit (Addr, Data, Status);

         --  Additional status checking could be done here....

         --  Display a colon to indicate where we are.
         Display (':');

         --  Wait for response (1 byte as the length of the Data array is 1).         
         Ctrl.Master_Receive (Addr, Data, Status);

         --  Check status, and display character if OK.
         if Status = Ok then
            Display (Character'Val (Data (0)));
         else
            Display ('!');
         end if;

         -- Take a short nap (time in milliseconds).
         Sleep (250);

      end loop;
   end;

end Main;

[PDF] Micro:bit with Arduino, https://learn.adafruit.com/use-micro-bit-with-arduino. Page 3 of 43 If you are running Windows 7 you need to install this driver. If you are on  If using an earlier version of the Arduino IDE (prior to 1.8.10), also locate and install Adafruit_BusIO (newer versions will install this dependency automatically).. Search for the Adafruit Microbit library and install it


I have a current interest in the BBC micro:bit and i2c and tried the program, having earlier got a program to build and upload successfully. Building with these two files have should have easier, still not got it to build, struggling with GPS ... I'll try again soon...

Using the Adafruit Library, LEDs · Maker Business · micro:bit · Microcontrollers · Programming · Projects Since the PWM Servo Driver is controlled over I2C, its super easy to use with In this demo we'll show using it with the Arduino IDE but the C++ code can be ported easily http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install​-use  The Ada Drivers Library (ADL) is a collection of Ada device drivers and examples for ARM-based embedded targets. The library is maintained by AdaCore, with development originally (and predominantly) by AdaCore personnel but also by the Ada community at large. It is available on GitHub and is licensed for both proprietary and non-proprietary use.


Ada on the micro:bit, In GNAT Community Edition 2018, the micro:bit is now directly Programming Studio IDE and an example to run on the micro:bit We also improved the micro:​bit support and documentation in the Ada Drivers Library project. The Adafruit Trinket M0 may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip with a lot of power. We wanted to design a microcontroller board that was small enough to fit into any project, and low cost enough to use without hesitation. Perfect for when you don't want to give up your expensive dev-board and you aren't


[PDF] Micro:bit with Arduino, Install Library & Example Code. Logging Temperature to Adafruit IO. Create a Microbit Temperature Feed. Temperature Logger Sketch. Did you know that the Arduino IDE can be used to program the micro:bit? Now you have yet another way to use this cool board! Learn how to set up Arduino to program your micro:bit, blink some LEDs, read the internal temperature sensor, send and receive data over Bluetooth - even log data to Adafruit.IO!


carlosperate/awesome-microbit: A curated list of BBC micro , MLX90614 - I2C driver for Infra Red Thermometer MLX90614. Adafruit Arduino micro:bit library - Wrapper code and examples for using micro:bit with Arduino IDE. DS3234 - Driver in example project using the DS3234 RTC via SPI. Ada Driver Library and Example code for Microbit on GitHub ; Ada for the C++ or Java Developer; Ada Keywords; GNAT IDE and Drivers; Conclusion. As I have already said, this is just a prototype hardware which I made with my limited resources. But Smart MCB is exactly the kind of application (safety critical) for which the spirit of Ada