diff options
author | Timofey Titovets <nefelim4ag@gmail.com> | 2024-09-13 22:02:05 +0200 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2024-10-26 22:06:30 -0400 |
commit | 08a85ba869c3232ca7063c737c238ca41e20885e (patch) | |
tree | 85f6db1bf9f85a6957bacd525ec336e58408fe0d /src/i2ccmds.h | |
parent | 39f08aeda184c5dcf257f88f66b3173f9593f1b7 (diff) | |
download | kutter-08a85ba869c3232ca7063c737c238ca41e20885e.tar.gz kutter-08a85ba869c3232ca7063c737c238ca41e20885e.tar.xz kutter-08a85ba869c3232ca7063c737c238ca41e20885e.zip |
i2ccmds: abstract i2c dev from bus implementation
Added wrapper around sw/hw bus API,
pins.py code will ensure that pins will not mix
between HW/SW buses.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Diffstat (limited to 'src/i2ccmds.h')
-rw-r--r-- | src/i2ccmds.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/i2ccmds.h b/src/i2ccmds.h index 9ce54aa0..477cee02 100644 --- a/src/i2ccmds.h +++ b/src/i2ccmds.h @@ -5,12 +5,17 @@ #include "board/gpio.h" // i2c_config struct i2cdev_s { - struct i2c_config i2c_config; - struct i2c_software *i2c_software; + union { + struct i2c_config i2c_hw; + struct i2c_software *i2c_sw; + }; uint8_t flags; }; struct i2cdev_s *i2cdev_oid_lookup(uint8_t oid); void i2cdev_set_software_bus(struct i2cdev_s *i2c, struct i2c_software *is); +void i2c_dev_read(struct i2cdev_s *i2c, uint8_t reg_len, uint8_t *reg + , uint8_t read_len, uint8_t *read); +void i2c_dev_write(struct i2cdev_s *i2c, uint8_t write_len, uint8_t *data); #endif |