I2C_device_Arduino 0.2
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( uint8_t i2c_address ) : I2C_device( i2c_address )
6{
7 // do nothing.
8 // leave it in default state.
9}
10
12{
13}
14
16{
17 return read_r16( Temp ) / 256.0;
18}
19
20void test_LM75B::thresholds( float v0, float v1 )
21{
22 float higher = (v0 < v1) ? v1 : v0;
23 float lower = (v0 < v1) ? v0 : v1;
24
25 write_r16( Tos, ((uint16_t)(higher * 256.0)) & 0xFF80 );
26 write_r16( Thyst, ((uint16_t)(lower * 256.0)) & 0xFF80 );
27}
28
30{
31 uint8_t v;
32
33 v = read_r8( Conf );
34 v &= ~0x02;
35 v |= flag << 1;
36
37 write_r8( Conf, v );
38}
39
uint8_t read_r8(uint8_t reg)
Definition: I2C_device.cpp:133
void write_r8(uint8_t reg, uint8_t val)
Definition: I2C_device.cpp:118
uint16_t read_r16(uint8_t reg)
Definition: I2C_device.cpp:138
void write_r16(uint8_t reg, uint16_t val)
Definition: I2C_device.cpp:123
void thresholds(float v0, float v1)
Definition: test_LM75B.cpp:20
float read(void)
Definition: test_LM75B.cpp:15
test_LM75B(uint8_t i2c_address=(0x90 > > 1))
Definition: test_LM75B.cpp:5
void os_mode(mode flag)
Definition: test_LM75B.cpp:29