ads1115/inc/ads1115.h

24 lines
587 B
C
Raw Permalink Normal View History

2019-07-25 14:36:38 +00:00
#ifndef __ADS1115__
#define __ADS1115__
#include <stdint.h>
2019-07-29 09:18:14 +00:00
#include <libi2c_bb/i2c.h>
2019-07-25 14:36:38 +00:00
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