24 lines
590 B
C
24 lines
590 B
C
|
#ifndef __ADS1115__
|
||
|
#define __ADS1115__
|
||
|
|
||
|
#include <stdint.h>
|
||
|
#include <libi2c_bb/i2c_bb.h>
|
||
|
|
||
|
struct ads1115_dev {
|
||
|
struct i2c_bb *i2c_dev;
|
||
|
uint8_t i2c_slave_address;
|
||
|
};
|
||
|
|
||
|
struct ads1115_conversation_result {
|
||
|
uint16_t raw;
|
||
|
float voltage;
|
||
|
};
|
||
|
|
||
|
int ads1115_open(const struct ads1115_dev *ads1115);
|
||
|
int ads1115_close(const struct ads1115_dev *ads1115);
|
||
|
int ads1115_start_conversation(const struct ads1115_dev *ads1115);
|
||
|
int ads1115_read_conversation_result(const struct ads1115_dev *ads1115,
|
||
|
struct ads1115_conversation_result *result);
|
||
|
|
||
|
#endif
|