I2C_device_Arduino
1.0.5
An I²C utility class for Arduino
Loading...
Searching...
No Matches
src
test_LM75B.cpp
Go to the documentation of this file.
1
#include "
test_LM75B.h
"
2
3
/* LM75B class ******************************************/
4
5
test_LM75B::test_LM75B
(
const
uint8_t i2c_address ) :
I2C_device
( i2c_address )
6
{
7
}
8
9
test_LM75B::test_LM75B
( TwoWire& wire,
const
uint8_t i2c_address ) :
I2C_device
( wire, i2c_address )
10
{
11
}
12
13
test_LM75B::~test_LM75B
()
14
{
15
}
16
17
float
test_LM75B::read
()
18
{
19
return
read_r16
(
Temp
) / 256.0;
20
}
21
22
void
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
31
void
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
I2C_device
Definition
I2C_device.h:19
I2C_device::read_r8
uint8_t read_r8(uint8_t reg)
Definition
I2C_device.cpp:141
I2C_device::write_r8
void write_r8(uint8_t reg, uint8_t val)
Definition
I2C_device.cpp:126
I2C_device::read_r16
uint16_t read_r16(uint8_t reg)
Definition
I2C_device.cpp:146
I2C_device::write_r16
void write_r16(uint8_t reg, uint16_t val)
Definition
I2C_device.cpp:131
test_LM75B::os_mode
void os_mode(const mode flag)
Definition
test_LM75B.cpp:31
test_LM75B::thresholds
void thresholds(const float v0, const float v1)
Definition
test_LM75B.cpp:22
test_LM75B::~test_LM75B
~test_LM75B()
Definition
test_LM75B.cpp:13
test_LM75B::Tos
@ Tos
Definition
test_LM75B.h:40
test_LM75B::Thyst
@ Thyst
Definition
test_LM75B.h:39
test_LM75B::Temp
@ Temp
Definition
test_LM75B.h:37
test_LM75B::Conf
@ Conf
Definition
test_LM75B.h:38
test_LM75B::test_LM75B
test_LM75B(const uint8_t i2c_address=(0x90 > > 1))
Definition
test_LM75B.cpp:5
test_LM75B::read
float read(void)
Definition
test_LM75B.cpp:17
test_LM75B::mode
mode
Definition
test_LM75B.h:30
test_LM75B.h
Generated by
1.10.0