aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-04 18:27:40 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-04 18:27:40 +0200
commit078c6661c24a9460240d9c7c063a44e9bed6f96a (patch)
tree4d19d628210d5e0414228f1330c0d998b44c02e8 /shared
parent18d06c79b9f6a625eb218a15c8216556fb99dc02 (diff)
add i2ctcp unit tests
Diffstat (limited to 'shared')
-rw-r--r--shared/pb/moddrv.c21
-rw-r--r--shared/pb/moddrv.h2
2 files changed, 3 insertions, 20 deletions
diff --git a/shared/pb/moddrv.c b/shared/pb/moddrv.c
index 1f7fab8..9677341 100644
--- a/shared/pb/moddrv.c
+++ b/shared/pb/moddrv.c
@@ -17,25 +17,8 @@ __weak void pbdrv_hook_mod_state_write(enum pb_state state) {
_global_state = state;
}
-__weak void pbdrv_i2c_recv(uint16_t i2c_addr, const char * buf, size_t sz) {
- if (sz == 0) return;
- enum pb_cmd cmd = (enum pb_cmd) buf[0];
-
- // shift buffer pointer to only contain the puzzle bus message buf
- buf++;
- sz--;
-
- // allow user to implement custom commands
- if (pbdrv_hook_cmd(i2c_addr, cmd, buf, sz))
- return;
-
- switch (cmd) {
- case PB_CMD_READ: return pbdrv_handle_read(i2c_addr, buf, sz);
- case PB_CMD_WRITE: return pbdrv_handle_write(i2c_addr, buf, sz);
- case PB_CMD_MAGIC: return pbdrv_handle_magic(i2c_addr, buf, sz);
- case PB_CMD_SEX: return pbdrv_handle_sex(i2c_addr, buf, sz);
- default: return;
- }
+__weak void pbdrv_i2c_recv(const char * buf, size_t sz) {
+ return;
}
__weak void pbdrv_handle_read(uint16_t i2c_addr, const char * buf, size_t sz) {
diff --git a/shared/pb/moddrv.h b/shared/pb/moddrv.h
index ecfc13a..d2e2d97 100644
--- a/shared/pb/moddrv.h
+++ b/shared/pb/moddrv.h
@@ -24,7 +24,7 @@
extern "C" {
#endif
-void pbdrv_i2c_recv(uint16_t i2c_addr, const char * buf, size_t sz);
+void pbdrv_i2c_recv(const char * buf, size_t sz);
void pbdrv_i2c_send(uint16_t i2c_addr, const char * buf, size_t sz);
enum pb_state pbdrv_hook_mod_state_read();