#include <ads1015.h>
Definition at line 5 of file ads1015.h.
◆ init()
Definition at line 21 of file ads1015.cpp.
21 {
23 return false;
24 }
25
26
27 uint16_t loThresh =
readReg(ADS1015_LO_THRESH);
28
29 if (loThresh != 0x8000) {
30 return false;
31 }
32
34 return true;
35}
uint16_t readReg(uint8_t reg)
bool init(brain_pin_e scl, brain_pin_e sda)
◆ readChannel()
float Ads1015::readChannel |
( |
uint8_t |
ch | ) |
|
|
private |
Definition at line 43 of file ads1015.cpp.
43 {
44
45
47
48
49
50 while ((
readReg(ADS1015_CONFIG) & 0x8000) == 0) ;
51
52
53 int16_t result =
readReg(ADS1015_CONV);
54
55 result = result >> 4;
56
57
58 constexpr float ratio = 6.144f / 2048;
59 return result * ratio;
60}
void writeReg(uint8_t reg, uint16_t data)
Referenced by readChannels().
◆ readChannels()
void Ads1015::readChannels |
( |
float(&) |
result[4] | ) |
|
Definition at line 37 of file ads1015.cpp.
37 {
38 for (size_t i = 0; i < 4; i++) {
40 }
41}
float readChannel(uint8_t ch)
◆ readReg()
uint16_t Ads1015::readReg |
( |
uint8_t |
reg | ) |
|
|
private |
Definition at line 72 of file ads1015.cpp.
72 {
73 uint16_t res;
77}
void read(uint8_t addr, uint8_t *data, size_t size)
void write(uint8_t addr, const uint8_t *data, size_t size)
uint16_t SWAP_UINT16(uint16_t x)
Referenced by init(), and readChannel().
◆ writeReg()
void Ads1015::writeReg |
( |
uint8_t |
reg, |
|
|
uint16_t |
data |
|
) |
| |
|
private |
Definition at line 62 of file ads1015.cpp.
62 {
63 uint8_t packet[3];
64
65 packet[0] = reg;
66 packet[1] = data >> 8;
67 packet[2] = data & 0xFF;
68
70}
Referenced by readChannel().
◆ m_hasInit
bool Ads1015::m_hasInit = false |
|
private |
◆ m_i2c
The documentation for this class was generated from the following files: