diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/pb/moddrv.c | 21 | ||||
-rw-r--r-- | shared/pb/moddrv.h | 2 |
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(); |