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
b56c003f
Commit
b56c003f
authored
1 year ago
by
Carl Philipp Klemm
Browse files
Options
Downloads
Patches
Plain Diff
add support for controling watchdog and periodic recal for newer firmwares
parent
998a059b
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
+18
-0
18 additions, 0 deletions
coincellhell.c
coincellhell/coincellhell.h
+2
-0
2 additions, 0 deletions
coincellhell/coincellhell.h
coincellhell/usbcommands.h
+2
-11
2 additions, 11 deletions
coincellhell/usbcommands.h
main.c
+22
-0
22 additions, 0 deletions
main.c
with
44 additions
and
11 deletions
coincellhell.c
+
18
−
0
View file @
b56c003f
...
@@ -300,6 +300,23 @@ int coincellhell_reset(struct coincellhell* hell)
...
@@ -300,6 +300,23 @@ int coincellhell_reset(struct coincellhell* hell)
return
0
;
return
0
;
}
}
int
coincellhell_enable_watchdog
(
struct
coincellhell
*
hell
)
{
int
ret
;
while
((
ret
=
usbshm_writeControlTransfer
(
hell
->
priv
,
COMMAND_ENABLE_WATCHDOG
,
NULL
,
0
,
0
,
0
))
==
USBSHM_ERROR_AGAIN
)
usleep
(
100000
);
return
ret
;
}
int
coincellhell_set_periodic_recal
(
struct
coincellhell
*
hell
,
bool
recal
)
{
int
ret
;
while
((
ret
=
usbshm_writeControlTransfer
(
hell
->
priv
,
COMMAND_ENABLE_WATCHDOG
,
NULL
,
0
,
recal
,
0
))
==
USBSHM_ERROR_AGAIN
)
usleep
(
100000
);
return
ret
;
}
void
coincellhell_disconnect
(
struct
coincellhell
*
hell
)
void
coincellhell_disconnect
(
struct
coincellhell
*
hell
)
{
{
if
(
!
hell
||
!
hell
->
priv
)
if
(
!
hell
||
!
hell
->
priv
)
...
@@ -329,3 +346,4 @@ const char* coincellhell_string_for_fault(fault_t fault)
...
@@ -329,3 +346,4 @@ const char* coincellhell_string_for_fault(fault_t fault)
}
}
}
}
This diff is collapsed.
Click to expand it.
coincellhell/coincellhell.h
+
2
−
0
View file @
b56c003f
...
@@ -176,6 +176,8 @@ uint16_t coincellhell_read_eeprom(struct coincellhell* hell, uint16_t addr);
...
@@ -176,6 +176,8 @@ 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
);
const
uint8_t
*
coincellhell_get_fw_git_revision
(
struct
coincellhell
*
hell
);
int
coincellhell_enable_watchdog
(
struct
coincellhell
*
hell
);
int
coincellhell_set_periodic_recal
(
struct
coincellhell
*
hell
,
bool
recal
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
This diff is collapsed.
Click to expand it.
coincellhell/usbcommands.h
+
2
−
11
View file @
b56c003f
#pragma once
#pragma once
/**
Api to controll EISmultiplexer devices.
* @addtogroup API User API
* This api allows you to controll the EISmultiplexer device.
* @{
*/
typedef
enum
{
typedef
enum
{
COMMAND_LED_ON
=
0
,
COMMAND_LED_ON
=
0
,
COMMAND_LED_OFF
,
COMMAND_LED_OFF
,
...
@@ -23,6 +16,8 @@ typedef enum {
...
@@ -23,6 +16,8 @@ typedef enum {
COMMAND_WRITE_EEPROM
,
COMMAND_WRITE_EEPROM
,
COMMAND_READ_OSCAL
,
COMMAND_READ_OSCAL
,
COMMAND_GET_FIRMWARE_GITREV
,
COMMAND_GET_FIRMWARE_GITREV
,
COMMAND_ENABLE_WATCHDOG
,
COMMAND_SET_RECAL
}
usb_command_t
;
}
usb_command_t
;
typedef
enum
{
typedef
enum
{
...
@@ -40,7 +35,3 @@ typedef enum {
...
@@ -40,7 +35,3 @@ typedef enum {
FAULT_UNDERTEMP
,
FAULT_UNDERTEMP
,
FAULT_UNSPECIFIED
FAULT_UNSPECIFIED
}
fault_t
;
}
fault_t
;
/*
* @}
*/
This diff is collapsed.
Click to expand it.
main.c
+
22
−
0
View file @
b56c003f
...
@@ -50,6 +50,8 @@ static void print_commands(void)
...
@@ -50,6 +50,8 @@ static void print_commands(void)
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"
);
puts
(
"git
\t\t\t
| get the git revision of the firmware on the device"
);
puts
(
"watchdog
\t\t\t
| enables the on device command watchdog"
);
puts
(
"recal [BOOLEAN]
\t\t
| enables or disables periodic recal"
);
}
}
static
int
convert_string_to_heater_id
(
const
char
*
str
)
static
int
convert_string_to_heater_id
(
const
char
*
str
)
...
@@ -345,6 +347,26 @@ static int process_commands(char** commands, size_t command_count, struct coince
...
@@ -345,6 +347,26 @@ static int process_commands(char** commands, size_t command_count, struct coince
const
uint8_t
*
rev
=
coincellhell_get_fw_git_revision
(
hell
);
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
]);
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
if
(
strcmp
(
commands
[
0
],
"watchdog"
)
==
0
)
{
ret
=
coincellhell_enable_watchdog
(
hell
);
if
(
ret
<
0
)
puts
(
"could not enable watchdog"
);
}
else
if
(
strcmp
(
commands
[
0
],
"recal"
)
==
0
)
{
if
(
command_count
<
2
)
{
printf
(
"Usage %s %s [BLOOEAN]
\n
"
,
name
,
commands
[
0
]);
return
2
;
}
bool
enable
=
strtol
(
commands
[
1
],
NULL
,
10
);
printf
(
"Seting recal to %s
\n
"
,
enable
?
"true"
:
"false"
);
ret
=
coincellhell_set_periodic_recal
(
hell
,
enable
);
if
(
ret
<
0
)
puts
(
"could not enable watchdog"
);
}
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