Updates to Arduino_STM32 code

Updates to Arduino_STM32 code

posted in: Arduino | 0

Over the last 2 or 3 weeks, I’ve made a lot of changes to the code on GitHub (https://github.com/rogerclarkmelbourne/Arduino_STM32 )

The main addition has been SPI, which generally conforms to the Arduino 1.0.x API, and I have successfully compiled and run the SD card example sketch CardInfo.ino that comes with the IDE, and read the contents of several SD cards.

The changed actually required rather a lot of re-factoring of the code structure, but it worked in the end.

Today I’ve updated HardwareSerial to include more functions in the Arduino 1.0.x API that were not in the original libmaple files, specifically Serial.peek and also Serial.find.

HardwareSerial now inherits from the Stream class (instead of the Print class) and this gives the find()

Arduino 1.5.8 appears to have added implementation for buffering of the Serial output, via a ring buffer like the incoming side of Serial, however as this is very new and not documented (as far as I’m aware), I have not done a full implementation. i.e I have not implemented a serial output ring buffer, I just return 1 from serial.availableForWrite as this is the same as just continuously calling serial.write i.e no harm can be done.

In the longer term, when the dust settles on the new 1.5.8 + functionality; output ring buffering may need to be added. However I’m not even sure why this has been added to Serial, as it will waste precious ram on the little AVR boards.