Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

tkem/mbino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mbino Build Status

mbino is a library that provides several mbed OS 2 APIs for the Arduino platform.

Currently, the following APIs are - at least partially - supported:

AnalogIn Assert BusIn BusOut
BusInOut Callback CriticalSectionLock Debug
DigitalIn DigitalOut DigitalInOut Error handling
InterruptIn I2C I2CSlave NonCopyable
PortIn PortOut PortInOut PwmOut
RawSerial Serial SPI SPISlave
Ticker Timeout Timer Wait

For an overview on how to use these, have a look at (and try out!) the example programs.

Known Bugs and Limitations

  • Only AVR 8-bit microcontroller boards are supported. This means no support for Arduino Due, Zero or M0, etc.

  • Although mbed programs usually have a main() function, you can still write sketches based on setup() and loop(), if you want to. This can be useful to sprinkle an existing sketch with printf() statements for debugging, for example.

  • The standard file descriptors stdin, stdout, and stderr are set up by default to point to Arduino's serial monitor, so that printf() et al. work out of the box. However, with the current implementation, this leads to a significant increase in code size, even if none of the stdio functions are ever used. If you are running out of space, define MBINO_CONF_PLATFORM_STDIO to 0 in mbed_config.h to disable stdio support.

  • Since the default AVR Libc printf() family of functions does not support floating point conversions, floating point values cannot be used with printf(), Serial::printf() or RawSerial::printf().

  • For portability (and so millis() and PWM still work), the Ticker API uses the Timer0 comparison register for generating ticker interrupts. Therefore, Ticker only provides a resolution of about one millisecond.

  • The PwmOut::period() and PwmOut::pulsewidth() methods are only supported for PWM pins controlled by 16-bit timers, e.g. pins 9 and 10 on the Arduino Uno. For now, these methods are ignored for all other pins. Note that setting a period for one pin will also affect other pins controlled by the same timer.

  • To avoid ambiguities with Arduino's own global Serial object, you have to use the fully qualified class name mbed::Serial when using the mbed Serial API.

  • Keep in mind that you are still developing for an 8-bit platform, so only 8-bit variables can be read atomically, e.g. when passing data between an ISR and your main program. Also note that int on AVR is only 16 bits wide - that's why some APIs, such as those taking baud or hz parameters have been changed from int to long.

License

Copyright (c) 2017, 2018 Thomas Kemmer

mbed Microcontroller Library Copyright (c) 2006-2018 ARM Limited

Licensed under the Apache License, Version 2.0.