This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52840 complining c and c++ code combined

hello,

i am using nrf52840 with sx1276 module i am using an library which consists of c and c++ files i want to complie both the file but when i complied the following c++ files i got error as below

********************************************************************************************
* TYPE DEFINITION
********************************************************************************************
*/


#define LORAWAN_VERSION "1.0.0"
/*
*****************************************************************************************
* CLASS
*****************************************************************************************
*/

class LoRaWANClass
{
    public:

        LoRaWANClass();
        ~LoRaWANClass();
        
        bool init(void);
        bool join(void);
        void setDeviceClass(devclass_t dev_class);
        // OTAA credentials
        void setDevEUI(const char *devEUI_in);
        void setAppEUI(const char *appEUI_in);
        void setAppKey(const char *appKey_in);
        // ABP credentials
        void setNwkSKey(const char *NwkKey_in);
        void setAppSKey(const char *ApskKey_in);
        void setDevAddr(const char *devAddr_in);
        void sendUplink(char *data, unsigned int len, unsigned char confirm, unsigned char mport);
        void setDataRate(unsigned char data_rate);
        void setChannel(unsigned char channel);
        unsigned char getChannel();
        unsigned char getDataRate();
        void setTxPower1(unsigned char power_idx);
        void setTxPower(int level,txPin_t pinTx);
        int getRssi();
        int readData(char *outBuff);
        bool readAck(void);
        void update(void);

        // frame counter
        unsigned int getFrameCounter();
        void setFrameCounter(unsigned int FrameCounter);

    private:
        void randomChannel();

    private:        
        // Messages
        unsigned char Data_Tx[MAX_UPLINK_PAYLOAD_SIZE];
        sBuffer Buffer_Tx;
        unsigned char Data_Rx[MAX_DOWNLINK_PAYLOAD_SIZE];
        sBuffer Buffer_Rx;
        sLoRa_Message Message_Rx;

        // Declare ABP session
        unsigned char Address_Tx[4];
        unsigned char NwkSKey[16];
        unsigned char AppSKey[16];
        unsigned int Frame_Counter_Tx;
        sLoRa_Session Session_Data;

        // Declare OTAA data struct
        unsigned char DevEUI[8];
        unsigned char AppEUI[8];
        unsigned char AppKey[16];
        unsigned char DevNonce[2];
        unsigned char AppNonce[3];
        unsigned char NetID[3];
        sLoRa_OTAA OTAA_Data;

        // Declare LoRA settings struct
        sSettings LoRa_Settings;
      //  sRFM_pins LoRa_Pins;

        unsigned char drate_common;

        // Lora Setting Class
        devclass_t dev_class;

        // channel mode
        unsigned char currentChannel;

        // UART
        RFM_command_t RFM_Command_Status;
        rx_t Rx_Status;

        // ACK reception
        ack_t Ack_Status;
};

#endif

error

Building ‘spi_pca10056’ from solution ‘spi_pca10056’ in configuration ‘Release’


unknown type name 'class'
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
'lora' undeclared (first use in this function)
each undeclared identifier is reported only once for each function it appears in
Build failed

can you tell me how can i rectify this

thanks and regards

manikandan v

Related