I'm trying to compile an example included in the LoRaFi library, for use with the SX1272 LoRa radio hat and the STM32 IoT Node Discovery kit. This is an STM32duino project.
The error specifically points to the the IoT Node's device header, included in the STM32core package.
C:\Users\monou\Documents\ArduinoData\packages\STM32\hardware\stm32\1.9.0\system/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l475xx.h:1397:43: error: expected ')' before '*' token
1397 | #define CRC ((CRC_TypeDef *) CRC_BASE)
| ~ ^
C:\Users\monou\Documents\Arduino\libraries\LoRaFi\src/LoRaFi.h:122:8: note: in expansion of macro 'CRC'
122 | void CRC(uint8_t crc = ON);
| ^~~
This error doesn't make any sense to me, as the structure for CRC_TypeDef is well defined in the header itself.
typedef struct
{
__IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */
__IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */
uint8_t RESERVED0; /*!< Reserved, 0x05 */
uint16_t RESERVED1; /*!< Reserved, 0x06 */
__IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */
uint32_t RESERVED2; /*!< Reserved, 0x0C */
__IO uint32_t INIT; /*!< Initial CRC value register, Address offset: 0x10 */
__IO uint32_t POL; /*!< CRC polynomial register, Address offset: 0x14 */
} CRC_TypeDef;
followed by CRC's own definition
#define FLASH ((FLASH_TypeDef *) FLASH_R_BASE)
#define CRC ((CRC_TypeDef *) CRC_BASE)
#define TSC ((TSC_TypeDef *) TSC_BASE)
The LoRa radio requires CRC to be turned on, so I can't just comment out the offending code in LoRaFi.h. I have no idea how to fix this. The CRC_TypeDef is properly defined, CRC should be definable as well.
Any help would be much appreciated.
In case it helps, here is the example provided by LoRaFi. It's worth noting that this error occurs with all provided examples, not just this one.
// LoRaFi receiving data using interrupt
#include <LoRaFi.h>
//creat object to call functions of LoRaFi library
LoRaFi LoRaFi;
const int messageLength = 11;
char message[messageLength];
void setup() {
//initialize serial communication
Serial.begin(9600);
delay(100);
//initialize LoRa module
LoRaFi.begin();
delay(100);
// activate the interrupt on LoRaFi receiving
LoRaFi.ReceivingInterrupt(receiveMessage);
}
void loop() {
//Just waiting the interrupt and do nothing
delay(1000);
}
//callback function to receve the temperature and humidity using interrupt routine
void receiveMessage()
{
Serial.print("Received Message: ");
//Receive message
LoRaFi.ReceivePackage(message,messageLength);
//Print received message
int i;
for(i=0; i<messageLength; i++)
{
Serial.print(message[i]);
}
Serial.println();
}