# HG changeset patch # User matthewreed # Date 2017-10-05 14:34:01 # Node ID 28d92b4af160534de023327aa59906ed1e27c967 # Parent 20618713ba15db54576863ba8bbf58ce14418d54 # Parent 2a21ae69e60caf0691c476e9cf68fd2218c4d236 Merge diff --git a/inc/flash.h b/inc/flash.h --- a/inc/flash.h +++ b/inc/flash.h @@ -8,12 +8,14 @@ #define PAGE_SIZE ((uint16_t)0x400) #define END_ADDR 0x08007FFF + typedef union { struct { uint32_t can_id; uint16_t data_rate; uint8_t led_brightness; + flash_user_vars_t user; } val; uint16_t data[128]; diff --git a/inc/protocol.h b/inc/protocol.h --- a/inc/protocol.h +++ b/inc/protocol.h @@ -62,6 +62,7 @@ typedef enum { void protocol_init(protocol_device_t device); flash_settings_t* protocol_get_settings(void); +void protocol_save_settings(void); bool protocol_receive_message(CanRxMsgTypeDef* can_message); bool protocol_send_message(protocol_message_t* message); bool protocol_process_message(protocol_message_t* message); diff --git a/src/can_buffer.c b/src/can_buffer.c --- a/src/can_buffer.c +++ b/src/can_buffer.c @@ -20,7 +20,7 @@ CanBufferStatus can_buffer_add(volatile volatile CanRxMsgTypeDef* can_buffer_remove(volatile CanBuffer *buffer) { - volatile CanRxMsgTypeDef* msg; + volatile CanRxMsgTypeDef* msg = NULL; if (buffer->count > 0) { msg = &buffer->data[buffer->tail]; buffer->tail = (buffer->tail + 1) % CAN_BUFFER_SIZE; diff --git a/src/protocol.c b/src/protocol.c --- a/src/protocol.c +++ b/src/protocol.c @@ -17,6 +17,11 @@ flash_settings_t* protocol_get_settings( return &protocol_settings; } +void protocol_save_settings(void) +{ + flash_save(&protocol_settings); +} + bool protocol_send_test() { bool result = true;