There are two different makefiles for this firmware that I am working on. Data Version 1 and Data Version 2. Both versions are using the same file called ble_communication.c in each own make file.
To differentiate between the two versions, we have two variables declared inside ble_communication.c
static uint8_t data_version1[] = {0x00, 0x00, 0x00, 0x00, 0x00};
static uint8_t data_version2[] = {0x01, 0x00, 0x00, 0x00, 0x00};
Inside the ble_communication.c file we have a function called
uint32_t start_broadcasting(void)
{
send_beacon(OPCODE, 0, /* determine data version here to send at runtime */, key);
}
My question is since we are using the same file ble_communication.c for both versions of the build, how can the code select which variable to use for its build during the runtime of the code? If it's Data Version 1, I want it to use data_version1[] and if's is Data Version 2 it uses data_version2[].
I can't use #ifndef switch statements as I am not allowed to use them due to the new design guidelines