From 098fd9b55d055204b811317f2e117232637a48ab Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 8 Mar 2020 15:35:48 +0100 Subject: HDC1080: Add heater toggle --- src/driver/hdc1080.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/driver/hdc1080.cc b/src/driver/hdc1080.cc index 8da2ba7..26c97ef 100644 --- a/src/driver/hdc1080.cc +++ b/src/driver/hdc1080.cc @@ -39,10 +39,22 @@ unsigned int HDC1080::getManufacturerID() return (unsigned int)rxbuf[0] << 8 | rxbuf[1]; } +void HDC1080::heater(bool on) +{ + txbuf[0] = 0x02; + i2c.xmit(address, 1, txbuf, 2, rxbuf); + if (on) { + txbuf[1] = rxbuf[0] | (1<<5); + } else { + txbuf[1] = rxbuf[0] & ~(1<<5); + } + i2c.xmit(address, 2, txbuf, 0, rxbuf); +} + void HDC1080::init() { txbuf[0] = 0x02; - txbuf[1] = 0x08; + txbuf[1] = 0x00; txbuf[2] = 0x00; i2c.xmit(address, 3, txbuf, 0, rxbuf); arch.delay_ms(15); -- cgit v1.2.3