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 :-)
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:
1 2 3 4 5
- Build the IDE
1 2 3
The IDE should come up and you can write your programs as normally.
The API works like you would expect:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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!