Skip to content
Snippets Groups Projects
Commit d42b4b93 authored by Carl Philipp Klemm's avatar Carl Philipp Klemm
Browse files

add the ability to print the last 8 bytes of the firmware git revision

parent c864a09f
No related branches found
No related tags found
No related merge requests found
...@@ -228,6 +228,13 @@ uint32_t coincellhell_get_seconds(struct coincellhell* hell) ...@@ -228,6 +228,13 @@ uint32_t coincellhell_get_seconds(struct coincellhell* hell)
return seconds; return seconds;
} }
const uint8_t* coincellhell_get_fw_git_revision(struct coincellhell* hell)
{
static uint8_t gitrev[9] = {0};
usbshm_readControlTransferSync(hell->priv, COMMAND_GET_FIRMWARE_GITREV, 0, 0, gitrev, 8);
return gitrev;
}
void coincellhell_disconnect(struct coincellhell* hell) void coincellhell_disconnect(struct coincellhell* hell)
{ {
usbshm_distroy(hell->priv); usbshm_distroy(hell->priv);
......
...@@ -169,6 +169,7 @@ int coincellhell_write_eeprom(struct coincellhell* hell, uint16_t addr, uint16_t ...@@ -169,6 +169,7 @@ int coincellhell_write_eeprom(struct coincellhell* hell, uint16_t addr, uint16_t
uint16_t coincellhell_read_eeprom(struct coincellhell* hell, uint16_t addr); uint16_t coincellhell_read_eeprom(struct coincellhell* hell, uint16_t addr);
uint8_t coincellhell_read_oscal(struct coincellhell* hell); uint8_t coincellhell_read_oscal(struct coincellhell* hell);
uint32_t coincellhell_get_seconds(struct coincellhell* hell); uint32_t coincellhell_get_seconds(struct coincellhell* hell);
const uint8_t* coincellhell_get_fw_git_revision(struct coincellhell* hell);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -22,6 +22,7 @@ typedef enum { ...@@ -22,6 +22,7 @@ typedef enum {
COMMAND_READ_EEPROM, COMMAND_READ_EEPROM,
COMMAND_WRITE_EEPROM, COMMAND_WRITE_EEPROM,
COMMAND_READ_OSCAL, COMMAND_READ_OSCAL,
COMMAND_GET_FIRMWARE_GITREV,
} usb_command_t; } usb_command_t;
typedef enum { typedef enum {
......
...@@ -47,6 +47,7 @@ static void print_commands(void) ...@@ -47,6 +47,7 @@ static void print_commands(void)
puts("disable\t\t\t | disable the heaters"); puts("disable\t\t\t | disable the heaters");
puts("read [ADDRESS] [LENGTH]\t | read from the device eeprom at address"); puts("read [ADDRESS] [LENGTH]\t | read from the device eeprom at address");
puts("write [ADDRESS] [LENGTH] | write to the device eeprom at address"); puts("write [ADDRESS] [LENGTH] | write to the device eeprom at address");
puts("git\t\t\t | get the git revision of the firmware on the device");
} }
static int convert_string_to_heater_id(const char* str) static int convert_string_to_heater_id(const char* str)
...@@ -296,6 +297,11 @@ static int process_commands(char** commands, size_t command_count, struct coince ...@@ -296,6 +297,11 @@ static int process_commands(char** commands, size_t command_count, struct coince
{ {
printf("Seconds: %u\n", coincellhell_get_seconds(hell)); printf("Seconds: %u\n", coincellhell_get_seconds(hell));
} }
else if(strcmp(commands[0], "git") == 0)
{
const uint8_t* rev = coincellhell_get_fw_git_revision(hell);
printf("Git: %x%x%x%x%x%x%x%x\n", rev[0], rev[1], rev[2], rev[3], rev[4], rev[5], rev[6], rev[7]);
}
else else
{ {
printf("%s is not a valid command!", commands[0]); printf("%s is not a valid command!", commands[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment