My MateDealer project was entirely written in C because the Arduino IDE or more detailed the HardwareSerial part lacks the 9-bit support. It is easy to send a 8 bit data frame, but nearly impossible to do that with 9 bit frames. I worked for a while on implementing 9-bit support for the Arduino IDE and recently i finished my work!
I’ve implemented 9-bit support for Arduino IDE 1.0.5 (unfortunately the 1.0.6 version came out just days later :-/ ) as well as 1.5.7. The later includes support for AVR based boards such as the Mega2560 as well as for ARM based boards like the Due.
The maintainers have not yet merged my pull request into the main project and I’m not sure if they ever will. Therefore i explain how you can use my code anyway :-)
Setup ๐
These are the steps you need to do on a linux machine. I’ve not ried the proccess on Windows yet, but it should work as well.
- Clone the repo from github:
|
|
- Select the IDE Version you want to use:
For V1.0.5
|
|
For V1.5.7
|
|
- Build the IDE
|
|
The IDE should come up and you can write your programs as normally.
Example ๐
The API works like you would expect:
|
|
Details ๐
My implementation uses 2 bytes in the ringbuffer to store a single 9-bit frame. This has the downside for 9-bit users that the buffer is just half as big as normally, but has a great advantage for normal users. They don’t get the overhead a 16-bit ringbuffer would have (which is absolutely useless for all other framesizes).
All functions should work as far as I’ve tested them. If you find a bug, please let me know!