Sterling
Sterling
DIIDevHeads IoT Integration Server
Created by Sterling on 7/21/2024 in #firmware-and-baremetal
Issue with word Data Type When Porting Arduino Library to STM32
Hi @Middleware & OS I am porting some Arduino library code to STM32 and encountering issues with the word data type. The compiler gives me the error: "expected expression before 'word'". Here is the code:
uint8_t au8Buffer[MAX_BUFFER];
uint16_t *au16regs;
....
if(i % 2)
{
au16regs[i / 2] = word(au8Buffer[i + u8byte], lowByte(au16regs[i / 2]));
}
uint8_t au8Buffer[MAX_BUFFER];
uint16_t *au16regs;
....
if(i % 2)
{
au16regs[i / 2] = word(au8Buffer[i + u8byte], lowByte(au16regs[i / 2]));
}
The Arduino compiler does not produce an error for this code. Do you have any suggestions? I tried replacing word with unsigned short or uint16_t, but the error persists.
6 replies