I previously had the following code when dealing with my sync tuple:
static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) {
persist_write_bool(key,new_tuple->value->bool);
}
However, I just tried building this (in Cloud Pebble), and got the error:
../src/main.c: In function 'sync_tuple_changed_callback':
../src/main.c:25:44: error: expected identifier before '_Bool'
What's going on?
There is no bool
member of the value
union - your best bet is to use the uint8
member instead, passing 1 for true and 0 for false:
static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) {
persist_write_bool(key,new_tuple->value->uint8 != 0);
}