I'm a newbie in C and, for my apprenticeship, I have to try to convert an Arduino code to a C code, but I'm in trouble. Into one of headers, I have this template:
template <class LinkType> class TPixy
{
public:
TPixy(uint16_t arg=PIXY_DEFAULT_ARGVAL);
~TPixy();
uint16_t getBlocks(uint16_t maxBlocks=1000);
int8_t setServos(uint16_t s0, uint16_t s1);
int8_t setBrightness(uint8_t brightness);
int8_t setLED(uint8_t r, uint8_t g, uint8_t b);
void init();
Block *blocks;
private:
boolean getStart();
void resize();
LinkType link;
boolean skipStart;
BlockType blockType;
uint16_t blockCount;
uint16_t blockArraySize;
};
But C language doesn't have template, so I have to convert it to something "compatible" considering that there is a typedef
in another header that calls this template:
typedef TPixy<LinkUART> PixyUART;
I thought I could convert the template to a macro by using #define
, but I do not know if it's right, and if it were, I do not know how to do.
How can I resolve the problem? Can you help me?