Library for NXP (Philips) PCF8591 I2C 4 Channel, 8bit Analog to Digital converter and a 1 Channel, 8bit Digital to Analog converter.
Dependents: 812_hello PCF8591_test_LAAS
PCF8591 Class Reference
Create a PCF8591 object connected to the specified I2C bus and deviceAddress. More...
#include <PCF8591.h>
Public Member Functions | |
PCF8591 (I2C *i2c, uint8_t deviceAddress=PCF8591_SA0) | |
Create a PCF8591 AD and DA object using a specified I2C bus and slaveaddress. | |
void | setADCMode (uint8_t mode) |
Set ADC mode. | |
void | setDACMode (bool mode) |
Set DAC mode. | |
void | write (uint8_t analogOut) |
Write Analog Output. | |
uint8_t | read (uint8_t channel) |
Read Analog Channel. | |
Protected Member Functions | |
void | _init () |
Initialise AD and DA driver. |
Detailed Description
Create a PCF8591 object connected to the specified I2C bus and deviceAddress.
Definition at line 105 of file PCF8591.h.
Constructor & Destructor Documentation
PCF8591 | ( | I2C * | i2c, |
uint8_t | deviceAddress = PCF8591_SA0 |
||
) |
Create a PCF8591 AD and DA object using a specified I2C bus and slaveaddress.
- Parameters:
-
I2C &i2c the I2C port to connect to char deviceAddress the address of the PCF8591
Definition at line 17 of file PCF8591.cpp.
Member Function Documentation
void _init | ( | ) | [protected] |
Initialise AD and DA driver.
Definition at line 158 of file PCF8591.cpp.
uint8_t read | ( | uint8_t | channel ) |
Read Analog Channel.
- Parameters:
-
Channel ADC channel, valid range PCF8591_ADC0, PCF8591_ADC1, PCF8591_ADC2 or PCF8591_ADC3
- Returns:
- value uint8_t AD converted value (0..255, representing 0V..Vcc)
Definition at line 105 of file PCF8591.cpp.
void setADCMode | ( | uint8_t | mode ) |
Set ADC mode.
- Parameters:
-
adc_mode ADC Channel mode, valid Range (PCF8591_4S, PCF8591_3D, PCF8591_2S_1D, PCF8591_2D)
Definition at line 32 of file PCF8591.cpp.
void setDACMode | ( | bool | mode ) |
Set DAC mode.
- Parameters:
-
dac_mode DAC Channel mode, valid Range (false=disable, true=enable)
Definition at line 66 of file PCF8591.cpp.
void write | ( | uint8_t | analogOut ) |
Write Analog Output.
- Parameters:
-
analogOut output value (0..255)
Definition at line 87 of file PCF8591.cpp.
Generated on Tue Jul 12 2022 17:26:42 by 1.7.2