skpang
Well-known member
What is the best way to port C code to Teensyduino ?
I want to use the Microchip MCP2517FD CAN FD controller with Teensy 3.2
The code is in C but Teensy wants C++.
I've tried adding:
#ifdef __cplusplus // Provide C++ Compatibility
extern "C" {
#endif
to the C code but when I want to access the SPI bus by adding SPI.begin() it won't compile.
Another method I've tried is to creating a class and copy each function into the class but it was a bit of a mess and won't compile.
The C code is at:
http://www.microchip.com/developmenttools/productdetails.aspx?partno=adm00576
It is the MCP2517FD canfdspi API (v1.0)
Any idea?
I want to use the Microchip MCP2517FD CAN FD controller with Teensy 3.2
The code is in C but Teensy wants C++.
I've tried adding:
#ifdef __cplusplus // Provide C++ Compatibility
extern "C" {
#endif
to the C code but when I want to access the SPI bus by adding SPI.begin() it won't compile.
Another method I've tried is to creating a class and copy each function into the class but it was a bit of a mess and won't compile.
The C code is at:
http://www.microchip.com/developmenttools/productdetails.aspx?partno=adm00576
It is the MCP2517FD canfdspi API (v1.0)
Any idea?