esp-open-rtos/extras/pcf8591/pcf8591.h

45 lines
892 B
C
Raw Normal View History

2017-04-23 08:35:23 +00:00
/**
* Driver for 8-bit analog-to-digital conversion and
* an 8-bit digital-to-analog conversion PCF8591
*
* Part of esp-open-rtos
* Copyright (C) 2017 Pham Ngoc Thanh <pnt239@gmail.com>
* BSD Licensed as described in the file LICENSE
*/
#ifndef _EXTRAS_PCF8591_H_
#define _EXTRAS_PCF8591_H_
2017-09-01 09:29:32 +00:00
#include <i2c/i2c.h>
2017-04-23 08:35:23 +00:00
#ifdef __cplusplus
extern "C"
{
#endif
2017-04-25 16:57:40 +00:00
/**
* CAUTION: PLEASE SET I2C_FREQUENCY_400K IS 'false' IN 'i2c.h' FILE
*/
#define PCF8591_DEFAULT_ADDRESS 0x48
2017-09-01 09:29:32 +00:00
void pcf8591_init(void); //FIXME : library incomplete ?
2017-04-23 08:35:23 +00:00
/**
2017-04-25 16:57:40 +00:00
* Read input value of an analog pin.
2017-04-23 08:35:23 +00:00
* @param[in] addr Pointer to device
2017-04-25 16:57:40 +00:00
* @param[in] analog_pin pin number:
* 0 - AIN0
* 1 - AIN1
* 2 - AIN2
* 3 - AIN3
* @return analog value
2017-04-23 08:35:23 +00:00
*/
2017-09-01 09:29:32 +00:00
uint8_t pcf8591_read(i2c_dev_t* dev, uint8_t analog_pin);
2017-04-23 08:35:23 +00:00
#ifdef __cplusplus
}
#endif
#endif /* _EXTRAS_PCF8591_H_ */