Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Libcoincellhell
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klemm, Carl Philipp
Libcoincellhell
Commits
d42b4b93
Commit
d42b4b93
authored
1 year ago
by
Carl Philipp Klemm
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
coincellhell.c
+7
-0
7 additions, 0 deletions
coincellhell.c
coincellhell/coincellhell.h
+1
-0
1 addition, 0 deletions
coincellhell/coincellhell.h
coincellhell/usbcommands.h
+1
-0
1 addition, 0 deletions
coincellhell/usbcommands.h
main.c
+6
-0
6 additions, 0 deletions
main.c
with
15 additions
and
0 deletions
coincellhell.c
+
7
−
0
View file @
d42b4b93
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
coincellhell/coincellhell.h
+
1
−
0
View file @
d42b4b93
...
@@ -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
}
}
...
...
This diff is collapsed.
Click to expand it.
coincellhell/usbcommands.h
+
1
−
0
View file @
d42b4b93
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
main.c
+
6
−
0
View file @
d42b4b93
...
@@ -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
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment