Bootloader: add bootloader version read out
This commit is contained in:
parent
b55a05e7a0
commit
637ff7ea68
@ -56,8 +56,10 @@ void Bootloader::get_version()
|
||||
int rec = uart.receive(buffer, sizeof(buffer));
|
||||
if ((rec == 5) && ((buffer[0] == ACK) && (buffer[4] == ACK)))
|
||||
{
|
||||
chip.bootloader_version_major = (buffer[1] & 0xf0) >> 4;
|
||||
chip.bootloader_version_minor = buffer[1] & 0x0f;
|
||||
// chip.bootloader_version_major = (buffer[1] & 0xf0) >> 4;
|
||||
// chip.bootloader_version_minor = buffer[1] & 0x0f;
|
||||
chip.option_byte_1 = buffer[2];
|
||||
chip.option_byte_2 = buffer[3];
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,9 +81,10 @@ void Bootloader::get_chip_id()
|
||||
|
||||
void Bootloader::get_bl_version()
|
||||
{
|
||||
unsigned char buffer[2];
|
||||
unsigned char buffer[1];
|
||||
read_memory(BL_VERSION_REGISTER_ADDRESS, buffer, sizeof(buffer));
|
||||
chip.flash_size = ((buffer[1] << 8) + buffer[0]) * 1024;
|
||||
chip.bootloader_version_major = (buffer[0] & 0xf0) >> 4;
|
||||
chip.bootloader_version_minor = buffer[0] & 0x0f;
|
||||
}
|
||||
|
||||
void Bootloader::get_flash_memory_size()
|
||||
|
@ -29,6 +29,8 @@ public:
|
||||
uint8_t bootloader_version_minor;
|
||||
uint8_t protocol_version_major;
|
||||
uint8_t protocol_version_minor;
|
||||
uint8_t option_byte_1;
|
||||
uint8_t option_byte_2;
|
||||
uint32_t flash_size;
|
||||
};
|
||||
|
||||
@ -85,6 +87,8 @@ private:
|
||||
.bootloader_version_minor = 0,
|
||||
.protocol_version_major = 0,
|
||||
.protocol_version_minor = 0,
|
||||
.option_byte_1 = 0,
|
||||
.option_byte_2 = 0,
|
||||
.flash_size = 0,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user