From c48f6c677b9768e872697844a558a0cf80e428de Mon Sep 17 00:00:00 2001 From: ReFil <31960031+ReFil@users.noreply.github.com> Date: Tue, 27 Jun 2023 07:39:19 +0100 Subject: [PATCH] Further work --- app/drivers/sensor/gen4/gen4.c | 8 ++++++++ app/drivers/sensor/gen4/gen4.h | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/app/drivers/sensor/gen4/gen4.c b/app/drivers/sensor/gen4/gen4.c index e69de29bb2d..ee8be181aa0 100644 --- a/app/drivers/sensor/gen4/gen4.c +++ b/app/drivers/sensor/gen4/gen4.c @@ -0,0 +1,8 @@ + + +uint8_t gen4_checksum(uint8_t *buffer, uint8_t length) { + uint16_t temp; + uint8_t checksum = 0; + for (temp = 0; temp < length; temp++) + checksum += *(buffer + temp); +} \ No newline at end of file diff --git a/app/drivers/sensor/gen4/gen4.h b/app/drivers/sensor/gen4/gen4.h index e69de29bb2d..4036d12cdcd 100644 --- a/app/drivers/sensor/gen4/gen4.h +++ b/app/drivers/sensor/gen4/gen4.h @@ -0,0 +1,16 @@ +#define GEN4_REG_CHIP_ID 0xC2C0 +#define GEN4_REG_FW_VER 0xC2C1 +#define GEN4_REG_SYSCONFIG_1 0xC2C2 +#define GEN4_REG_SYSCONFIG_2 0xC2C3 +#define GEN4_REG_FEEDCONFIG_1 0xC2C4 +#define GEN4_REG_FEEDCONFIG_2 0xC2C5 +#define GEN4_REG_FEEDCONFIG_3 0xC2C6 +#define GEN4_REG_COMPCONFIG_1 0xC2C7 +#define GEN4_REG_PS2_AUXCONTROL 0xC2C8 +#define GEN4_REG_SAMPLERATE 0xC2C9 +#define GEN4_REG_ZIDLE 0xC2CA +#define GEN4_REG_FILTERCONTROL 0xC2CB +#define GEN4_REG_POWERCONTROL 0xC2CE + +#define GEN4_EXT_ACCESS_WRITE 0x0900 +#define GEN4_EXT_ACCESS_READ 0x0901