blob: 28870e6ed80e0ce58fd6a74b0873e464d47f8643 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/*
* Copyright 2020 Daniel Friesel
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "driver/s5851a.h"
#if defined(CONFIG_meta_driver_hardware_i2c)
#include "driver/i2c.h"
#elif defined(CONFIG_driver_softi2c)
#include "driver/soft_i2c.h"
#endif
float S5851A::getTemp()
{
txbuf[0] = 0;
rxbuf[0] = 0;
rxbuf[1] = 0;
i2c.xmit(address, 0, txbuf, 2, rxbuf);
return rxbuf[0] + (rxbuf[1] / 256.0);
}
S5851A s5851a(0x4b);
|