I am attempting to modify the Adafruit library for a VEML6070 sensor to get the library to compile and run on a Z.Uno device. The .h file I am adapting has the following code to create a C++ union:
Code: Select all
typedef union {
struct {
uint8_t SD:1;
uint8_t :1;
uint8_t IT:2;
uint8_t ACK_THD:1;
uint8_t ACK:1;
} bit;
uint8_t reg;
} commandRegister;
commandRegister _commandRegister;
This is used to set the i2c address of the device and bits of the structure during runtime. Unfortunately, when trying to compile the code the preprocessor runs into this condition:
Code: Select all
sdcc: Calling preprocessor...
sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\Karl\AppData\Local\Arduino15\packages\Z-Uno\tools\zuno_toolchain\00.08.80/zuno_toolchain/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\Karl\AppData\Local\Arduino15\packages\Z-Uno\tools\zuno_toolchain\00.08.80/zuno_toolchain/sdcc/\bin\..\include" "C:\Users\Karl\AppData\Local\Temp\arduino_build_611864\ZUNO_VEML6070_ucxx.c"
sdcc: Generating code...
sdcpp.exe: fatal error: when writing output to : Broken pipe
strncpyz prevented buffer overrun!
C:\Users\Karl\AppData\Local\Temp\arduino_build_355225\ZUNO_VEML6070_ucxx.c:647: syntax error: token -> ':' ; column 27
Error. SDCC returned: 1
exit status 1
Error compiling for board Z-Wave>ME Z-Uno.
Code: Select all
typedef struct cxx__class__ZUNO_VEML6070_s
{
cxx__class__TwoWire * _i2c;
struct ZUNO_VEML6070::commandRegister _commandRegister;
}cxx__class__ZUNO_VEML6070;
Code: Select all
struct ZUNO_VEML6070::commandRegister _commandRegister;
Could it be that the compiler is having an issue with the definition of the union and structure? Does anybody have any suggestions on how to work around this? Is this something that needs to be raised with the makers of the board?
Any help and direction is greatly appreciated.
Thanks,
Karl Baker