I2C_device_Arduino 1.0.5
An I²C utility class for Arduino
Loading...
Searching...
No Matches
test_LM75B.cpp
Go to the documentation of this file.
1#include "test_LM75B.h"
2
3/* LM75B class ******************************************/
4
5test_LM75B::test_LM75B( const uint8_t i2c_address ) : I2C_device( i2c_address )
6{
7}
8
9test_LM75B::test_LM75B( TwoWire& wire, const uint8_t i2c_address ) : I2C_device( wire, i2c_address )
10{
11}
12
16
18{
19 return read_r16( Temp ) / 256.0;
20}
21
22void test_LM75B::thresholds( const float v0, const float v1 )
23{
24 float higher = (v0 < v1) ? v1 : v0;
25 float lower = (v0 < v1) ? v0 : v1;
26
27 write_r16( Tos, ((uint16_t)(higher * 256.0)) & 0xFF80 );
28 write_r16( Thyst, ((uint16_t)(lower * 256.0)) & 0xFF80 );
29}
30
31void test_LM75B::os_mode( const mode flag )
32{
33 uint8_t v;
34
35 v = read_r8( Conf );
36 v &= ~0x02;
37 v |= flag << 1;
38
39 write_r8( Conf, v );
40}
41
uint8_t read_r8(uint8_t reg)
void write_r8(uint8_t reg, uint8_t val)
uint16_t read_r16(uint8_t reg)
void write_r16(uint8_t reg, uint16_t val)
void os_mode(const mode flag)
void thresholds(const float v0, const float v1)
test_LM75B(const uint8_t i2c_address=(0x90 > > 1))
Definition test_LM75B.cpp:5
float read(void)