File renaming
This commit is contained in:
47
lib/GPIO/TCA9554PWR_Driver.h
Normal file
47
lib/GPIO/TCA9554PWR_Driver.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
#include "I2C_Driver.h"
|
||||
|
||||
/****************************************************** The macro defines the TCA9554PWR information ******************************************************/
|
||||
|
||||
#define TCA9554_ADDRESS 0x20 // TCA9554PWR I2C address
|
||||
#define TCA9554_INPUT_REG 0x00 // Input register, input level
|
||||
#define TCA9554_OUTPUT_REG 0x01 // Output register, high and low level output
|
||||
#define TCA9554_POLARITY_REG 0x02 // The Polarity Inversion register (register 2) allows polarity inversion of pins defined as inputs by the Configuration register.
|
||||
#define TCA9554_CONFIG_REG 0x03 // Configuration register, mode configuration
|
||||
|
||||
#define TCA9554_OUT_MODE 0x00 // Configuration register value, output mode
|
||||
#define TCA9554_IN_MODE 0xff // Configuration register value, input mode
|
||||
|
||||
#define Low 0x00
|
||||
#define High 0x01
|
||||
|
||||
#define EXIO_PIN1 0
|
||||
#define EXIO_PIN2 1
|
||||
#define EXIO_PIN3 2
|
||||
#define EXIO_PIN4 3
|
||||
#define EXIO_PIN5 4
|
||||
#define EXIO_PIN6 5
|
||||
#define EXIO_PIN7 6
|
||||
#define EXIO_PIN8 7
|
||||
|
||||
namespace drivers
|
||||
{
|
||||
class TCA9554PWR
|
||||
{
|
||||
I2C &m_i2c;
|
||||
uint8_t m_address;
|
||||
|
||||
private:
|
||||
const bool writeRegister(const uint8_t reg, const uint8_t val);
|
||||
const bool readRegister(const uint8_t reg, uint8_t &val);
|
||||
|
||||
public:
|
||||
TCA9554PWR(I2C &i2c, const uint8_t address);
|
||||
|
||||
const bool setOut(const uint8_t channel, const bool state);
|
||||
const bool setPort(const uint8_t state);
|
||||
|
||||
const bool readOut(const uint8_t channel);
|
||||
const bool readPort(uint8_t &state);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user