diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-10-25 11:54:42 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-10-25 11:54:42 -0400 |
| commit | d7e085b5868dc3386eaf96813feaa0f02ee3727f (patch) | |
| tree | 7dffd423bfa801e952ae6babe4510108bf558ad7 /fw/table.h | |
| parent | 5bcd2f2926f2cd0da3f77755d7109faad28751ff (diff) | |
| download | can-gauge-interface-d7e085b5868dc3386eaf96813feaa0f02ee3727f.zip | |
read/write CAN ID in EEPROM
Diffstat (limited to 'fw/table.h')
| -rw-r--r-- | fw/table.h | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1,8 +1,8 @@ /* Table datastructure for storing calibrations in the EEPROM. * * A table has a fixed number of rows that define a key/value mapping. - * Keys and values are each U16. - * T: U16->U16 + * Keys and values are each U32. + * T: U32->U32 * Numbers are stored little-endian. * * Keys must be monotonically increasing. @@ -12,21 +12,23 @@ * * Usage: * + * #include <stdbool.h> * #include <stdint.h> * #include "types.h" + * #include "can.h" + * #include "eeprom.h" * #include "table.h" */ enum { - TAB_KEY_SIZE = 2, // U16 - TAB_VAL_SIZE = 2, // U16 + TAB_KEY_SIZE = 4, // U32 + TAB_VAL_SIZE = 4, // U32 TAB_ROWS = 32, TAB_ROW_SIZE = TAB_KEY_SIZE + TAB_VAL_SIZE, - TAB_SIZE = TAB_ROWS * TAB_ROW_SIZE, }; typedef struct { - U16 offset; // starting address + EepromAddr offset; // starting address } Table; // Set the key and value of row k. |