aboutsummaryrefslogtreecommitdiff
path: root/driver_fw/ina226.c
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-08-27 22:31:09 +0200
committerjaseg <git@jaseg.de>2023-08-27 22:31:09 +0200
commitec28fcd9f905358759eea98161f451567135d17e (patch)
treeed8f0f4f96811433ddca5f294f731c7584549a36 /driver_fw/ina226.c
parent7c2cb09fad601facbb142d9378033d64d19b6488 (diff)
download8seg-ec28fcd9f905358759eea98161f451567135d17e.tar.gz
8seg-ec28fcd9f905358759eea98161f451567135d17e.tar.bz2
8seg-ec28fcd9f905358759eea98161f451567135d17e.zip
new driver blinkenlights
Diffstat (limited to 'driver_fw/ina226.c')
-rw-r--r--driver_fw/ina226.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/driver_fw/ina226.c b/driver_fw/ina226.c
deleted file mode 100644
index c740125..0000000
--- a/driver_fw/ina226.c
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#include "global.h"
-#include "i2c.h"
-#include "ina226.h"
-
-void ina226_init() {
- /* FIXME plug in final values for I meas backchannel */
- uint16_t config = INA226_CONFIG_AVG_1 | INA226_CONFIG_VBUSCT_204u | INA226_CONFIG_VSHCT_4m156 |
- INA226_CONFIG_MODE_SHUNT | INA226_CONFIG_MODE_BUS | INA226_CONFIG_MODE_CONT;
- ina226_write_reg(INA226_REG_CONFIG, config);
-
- ina226_write_reg(INA226_REG_CAL, INA226_CAL);
-}
-
-void ina226_write_reg(uint8_t reg, uint16_t val) {
- uint8_t buf[3] = { reg, val>>8, val&0xff };
- i2c_transmit(INA226_I2C_PERIPH, buf, sizeof(buf), INA226_I2C_ADDR, I2C_GENSTOP_YES);
-}
-
-uint16_t ina226_read_reg(uint8_t reg) {
- uint8_t buf2[1] = { reg };
- i2c_transmit(INA226_I2C_PERIPH, buf2, sizeof(buf2), INA226_I2C_ADDR, I2C_GENSTOP_NO);
- uint8_t rx[2];
- i2c_receive(INA226_I2C_PERIPH, rx, sizeof(rx), INA226_I2C_ADDR);
- return (rx[0]<<8) | rx[1];
-}
-