Changeset - 28d92b4af160
[Not reviewed]
Merge default
0 4 0
matthewreed - 7 years ago 2017-10-05 14:34:01

Merge
4 files changed with 9 insertions and 1 deletions:
0 comments (0 inline, 0 general)
inc/flash.h
Show inline comments
 
@@ -5,18 +5,20 @@
 
#include "stm32f0xx_hal_flash.h"
 
#include "config.h"
 
 
#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];
 
} flash_settings_t;
 
 
void flash_save(flash_settings_t* tosave);
inc/protocol.h
Show inline comments
 
@@ -59,12 +59,13 @@ typedef enum {
 
    INPUT = 0x0103,
 
    OUTPUT = 0x0104,
 
} protocol_data_key_t;
 
 
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);
 
bool protocol_send_data(protocol_data_key_t key, uint8_t sensor, float data);
 
bool protocol_send_test();
 
bool _protocol_config(protocol_message_t* message);
src/can_buffer.c
Show inline comments
 
@@ -17,13 +17,13 @@ CanBufferStatus can_buffer_add(volatile 
 
        return CAN_BUFFER_FULL;
 
    }
 
}
 

	
 
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;
 
        buffer->count--;
 
    }
 
    return msg;
src/protocol.c
Show inline comments
 
@@ -14,12 +14,17 @@ void protocol_init(protocol_device_t dev
 
 
flash_settings_t* protocol_get_settings(void)
 
{
 
    return &protocol_settings;
 
}
 
 
void protocol_save_settings(void)
 
{
 
    flash_save(&protocol_settings);
 
}
 
 
bool protocol_send_test()
 
{
 
    bool result = true;
 
    can_send_test(protocol_settings.val.can_id | 0x00000001);
 
    return result;
 
}
0 comments (0 inline, 0 general)