[avr] add {hw,sw} {major,minor} sensor board versioning
This commit is contained in:
parent
b2e7f486f9
commit
b641230fc8
|
@ -34,8 +34,8 @@ cBuffer ctrlTxBuffer; // ctrl transmit buffer
|
|||
static char ctrlRxData[CTRL_RX_BUFFER_SIZE];
|
||||
static char ctrlTxData[CTRL_TX_BUFFER_SIZE];
|
||||
|
||||
extern uint16_t EEMEM EEPROM_version;
|
||||
extern uint16_t version;
|
||||
extern struct version_struct EEMEM EEPROM_version;
|
||||
extern struct version_struct version;
|
||||
|
||||
extern struct event_struct EEMEM EEPROM_event;
|
||||
extern struct event_struct event;
|
||||
|
@ -257,8 +257,14 @@ void ctrlCmdGet(uint8_t cmd)
|
|||
uint32_t tmp32, tmp32_bis;
|
||||
|
||||
switch (cmd) {
|
||||
case 'v':
|
||||
ctrlWriteShortToTxBuffer(version);
|
||||
case 'h':
|
||||
ctrlWriteShortToTxBuffer(version.hw_major);
|
||||
ctrlWriteCharToTxBuffer(version.hw_minor);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
ctrlWriteCharToTxBuffer(version.sw_major);
|
||||
ctrlWriteCharToTxBuffer(version.sw_minor);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
|
@ -315,19 +321,30 @@ void ctrlCmdGet(uint8_t cmd)
|
|||
|
||||
void ctrlCmdSet(uint8_t cmd)
|
||||
{
|
||||
uint8_t i = 0, tmp8 = 0;
|
||||
uint8_t i = 0, tmp8 = 0, tmp8_bis = 0;
|
||||
uint16_t tmp16 = 0;
|
||||
uint32_t tmp32 = 0;
|
||||
|
||||
switch (cmd) {
|
||||
case 'v':
|
||||
case 'h':
|
||||
ctrlReadShortFromRxBuffer(&tmp16);
|
||||
ctrlReadCharFromRxBuffer(&tmp8);
|
||||
|
||||
cli();
|
||||
version = tmp16;
|
||||
version.hw_major = tmp16;
|
||||
version.hw_minor = tmp8;
|
||||
sei();
|
||||
break;
|
||||
|
||||
case 's':
|
||||
ctrlReadCharFromRxBuffer(&tmp8);
|
||||
ctrlReadCharFromRxBuffer(&tmp8_bis);
|
||||
|
||||
cli();
|
||||
version.sw_major = tmp8;
|
||||
version.sw_minor = tmp8_bis;
|
||||
sei();
|
||||
|
||||
case 'p':
|
||||
for (i = 0 ; i < MAX_SENSORS; i++) {
|
||||
ctrlReadCharFromRxBuffer(&tmp8);
|
||||
|
|
|
@ -40,8 +40,9 @@ uint8_t spi_high_hex;
|
|||
|
||||
uint8_t EEMEM first_EEPROM_byte_not_used_to_protect_from_brownout_corruption = 0xbe;
|
||||
|
||||
uint8_t EEMEM EEPROM_version[2] = {2, 1};
|
||||
uint8_t version[2];
|
||||
struct version_struct EEMEM EEPROM_version =
|
||||
{HW_VERSION_MAJOR, HW_VERSION_MINOR, SW_VERSION_MAJOR, SW_VERSION_MINOR};
|
||||
struct version_struct version;
|
||||
|
||||
struct event_struct EEMEM EEPROM_event = {0, 0};
|
||||
struct event_struct event;
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
struct version_struct {
|
||||
uint16_t hw_major;
|
||||
uint8_t hw_minor;
|
||||
uint8_t sw_major;
|
||||
uint8_t sw_minor;
|
||||
};
|
||||
|
||||
#define SPI_NO_OP_1 1
|
||||
#define SPI_NO_OP_2 2
|
||||
#define SPI_START_TX 4
|
||||
|
|
|
@ -49,6 +49,11 @@
|
|||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Sensor board versioning:
|
||||
HW_VERSION_MAJOR = 2
|
||||
HW_VERSION_MINOR = 0
|
||||
SW_VERSION_MAJOR = 1
|
||||
SW_VERSION_MINOR = 0
|
||||
|
||||
# MCU name
|
||||
MCU = atmega168
|
||||
|
@ -125,6 +130,13 @@ CDEFS += -Winline
|
|||
# Inline all 'simple-enough' functions (seems to be done by default in -Os)
|
||||
CDEFS += -finline-functions
|
||||
|
||||
# Sensor board ID
|
||||
CDEFS += -DBOARD_ID=$(BOARD_ID)
|
||||
|
||||
# Sensor board hw/sw major/minor version
|
||||
CDEFS += -DHW_VERSION_MAJOR=$(HW_VERSION_MAJOR) -DHW_VERSION_MINOR=$(HW_VERSION_MINOR)
|
||||
CDEFS += -DSW_VERSION_MAJOR=$(SW_VERSION_MAJOR) -DSW_VERSION_MINOR=$(SW_VERSION_MINOR)
|
||||
|
||||
# uncomment and adapt these line if you want different UART library buffer size
|
||||
CDEFS += -DUART_RX_BUFFER_SIZE=64
|
||||
CDEFS += -DUART_TX_BUFFER_SIZE=64
|
||||
|
|
Loading…
Reference in New Issue