Hi all, This is my first post so please feel free to critique the formatting etc.
Background: I do a bit of sim racing and am building a button box where I want to use Sim Hub's base code for arduino and expand on it. Sim Hub only supports some of the arduinos but I would like to use Arduino Due as it has the most pins and also allows using Joystick library for native HID support as a game controller. However, Due is not an option in Sim Hub configurator. Sim Hub software has a GUI configurator which allows configuring various inputs and outputs of the arduino, which can then be directly uploaded to the arduino. You can also configure everything and open the sketch allowing you to modify the code and change the arduino target.
Setup: I have configured everything for Arduino Leonardo within the Sim Hub GUI and then opened up the code in the Arduino IDE to change the arduino from Leonardo to Due (since Due is not available within Sim Hub GUI). However,
Problem When I compile the code for Leonardo or Pro Micro, everything compiles fine. However, when I select Due, I get an error:
Simhub\Arduino\DisplayClientV2\RingBuffer.h:50:61: error: 'RingBuffer' is not a template type
template <typename rg_element_t, uint8_t __maxSize__> class RingBuffer {
^
This is the first error that comes up. There are more errors but they all relate to this first one (I believe). Happy to post them all if needed, just didn't want to clutter the post as it's long enough as it is.
The code to which this error is pointing:
#ifndef __RINGBUFFER_H__
#define __RINGBUFFER_H__
#include <Arduino.h>
template <typename rg_element_t, uint8_t __maxSize__>
class RingBuffer
{
private:
rg_element_t mBuffer[__maxSize__];
uint8_t mReadIndex;
uint8_t mSize;
uint8_t writeIndex();
public:
/* Constructor. Init mReadIndex to 0 and mSize to 0 */
RingBuffer();
/* Push a data at the end of the buffer */
bool push(const rg_element_t inElement) __attribute__ ((noinline));
/* Push a data at the end of the buffer. Copy it from its pointer */
bool push(const rg_element_t * const inElement) __attribute__ ((noinline));
bool push(const rg_element_t* inElements, uint8_t length) __attribute__((noinline));
/* Push a data at the end of the buffer with interrupts disabled */
bool lockedPush(const rg_element_t inElement);
/* Push a data at the end of the buffer with interrupts disabled. Copy it from its pointer */
bool lockedPush(const rg_element_t * const inElement);
/* Pop the data at the beginning of the buffer */
bool pop(rg_element_t &outElement) __attribute__ ((noinline));
/* Pop the data at the beginning of the buffer */
bool pop() __attribute__((noinline));
/* Pop the data at the beginning of the buffer with interrupt disabled */
bool lockedPop(rg_element_t &outElement);
/* Return true if the buffer is full */
bool isFull() { return mSize == __maxSize__; }
/* Return true if the buffer is empty */
bool isEmpty() { return mSize == 0; }
/* Reset the buffer to an empty state */
void clear() { mSize = 0; }
/* return the size of the buffer */
uint8_t size() { return mSize; }
/* return the maximum size of the buffer */
uint8_t maxSize() { return __maxSize__; }
/* access the buffer using array syntax, not interrupt safe */
rg_element_t &operator[](uint8_t inIndex);
};
Why does this not compile correctly for Due?
Any help is much appreciated.