used by the I2cCardHelper class to manage I2C card information for connsumers and producers classes The I2cCardHelper class creates an I2cCard instance for each of the producer/consumer configured cards Handles I2C connection initialization and status, including callbacks for I2C devices connect/disconnects (hot-plug and play support). For producers, handles managing Event IDs associated with the specific card.
More...
#include <LccNodeCommons.h>
|
|
| ~I2cCard () |
| | destructor to delete objects created by the class
|
| |
| bool | begin (uint8_t bus, uint8_t offset) |
| | initializes the I2C connection to a device More...
|
| |
|
LccNodeI2c & | getLccNodeI2c () |
| | returns handle to the I2C object
|
| |
| bool | isConnected () |
| |
| void | initI2cCardPins (uint8_t startPin=0, uint8_t endPin=MAX_NUM_MCP_PINS, uint8_t mode=OUTPUT, lccnode::McpGpioPullup pullup=lccnode::McpGpioPullup::NO_PULLUP) |
| | Initializes a range of pins for the current I2C card type. More...
|
| |
| void | pwmSetDuty (uint8_t channel, uint16_t duty) |
| | Sets the PWM duty cycle for a specific PCA9685 channel using a FaBo PWM pin wrapper. More...
|
| |
| void | write (uint8_t channel, uint16_t value) |
| | sets a MCP pin to either HIGH or LOW, or a PWM channel to a value More...
|
| |
| uint16_t | read (uint8_t channel) |
| | reads the value of a MCP pin More...
|
| |
| bool | isSet (uint8_t pinNum) |
| | returns the current state of a pin More...
|
| |
| bool | isMcpPinLow (uint8_t pin) |
| |
|
|
Adafruit_MCP23017 * | pMcp_ = nullptr |
| | Object for card's I2C connection.
|
| |
used by the I2cCardHelper class to manage I2C card information for connsumers and producers classes The I2cCardHelper class creates an I2cCard instance for each of the producer/consumer configured cards Handles I2C connection initialization and status, including callbacks for I2C devices connect/disconnects (hot-plug and play support). For producers, handles managing Event IDs associated with the specific card.
Definition at line 136 of file LccNodeCommons.h.
◆ begin()
| bool I2cCard::begin |
( |
uint8_t |
bus, |
|
|
uint8_t |
offset |
|
) |
| |
|
inline |
initializes the I2C connection to a device
- Parameters
-
| bus | user configured hardware bus (0 or 1) for I2C connection |
| offset | user configured I2C address offset (0-7) of the I2C (slave) device. Must match the address settings of the physical I2C device (dip slide switches) |
- Note
- the bus and address values are set by the user via the CDI based configuration
- Returns
- true if the I2C device is connect and initialized.
Definition at line 178 of file LccNodeCommons.h.
◆ initI2cCardPins()
| void I2cCard::initI2cCardPins |
( |
uint8_t |
startPin = 0, |
|
|
uint8_t |
endPin = MAX_NUM_MCP_PINS, |
|
|
uint8_t |
mode = OUTPUT, |
|
|
lccnode::McpGpioPullup |
pullup = lccnode::McpGpioPullup::NO_PULLUP |
|
) |
| |
|
inline |
Initializes a range of pins for the current I2C card type.
For MCP cards, sets the pin mode (INPUT/OUTPUT) and pull-up state. For PWM cards (PCA9685), sets output mode and default value. No action for unsupported types.
- Parameters
-
| startPin | First pin in the range (0-15 for MCP/PWM) |
| endPin | Last pin in the range (0-15 for MCP/PWM) |
| mode | Pin mode (INPUT/OUTPUT for MCP; default OUTPUT for PWM) |
| pullup | Pull-up resistor state (MCP only; default NO_PULLUP) |
Definition at line 218 of file LccNodeCommons.h.
◆ isConnected()
| bool I2cCard::isConnected |
( |
| ) |
|
|
inline |
- Returns
- the current I2C connection status. Connection status can change dynamically as I2C cards are hot-pluggable in the network.
Definition at line 202 of file LccNodeCommons.h.
◆ isMcpPinLow()
| bool I2cCard::isMcpPinLow |
( |
uint8_t |
pin | ) |
|
|
inline |
◆ isSet()
| bool I2cCard::isSet |
( |
uint8_t |
pinNum | ) |
|
|
inline |
returns the current state of a pin
- Parameters
-
| pinNum | is the pin to check |
- Returns
- is the pin's current state; Gpio::Value::SET=HIGH or Gpio::Value::CLR=LOW
Definition at line 314 of file LccNodeCommons.h.
◆ pwmSetDuty()
| void I2cCard::pwmSetDuty |
( |
uint8_t |
channel, |
|
|
uint16_t |
duty |
|
) |
| |
|
inline |
Sets the PWM duty cycle for a specific PCA9685 channel using a FaBo PWM pin wrapper.
This sets the pulse width used to control a servo position. For example, a duty of ~205 sets ~1ms (0%), and ~410 sets ~2ms (100%) at 60Hz.
- Parameters
-
| channel | PWM output channel (0–15). |
| duty | Duty cycle in ticks (0–4095), corresponds to servo position. |
Definition at line 262 of file LccNodeCommons.h.
◆ read()
| uint16_t I2cCard::read |
( |
uint8_t |
channel | ) |
|
|
inline |
reads the value of a MCP pin
- Parameters
-
| channel | is the pin to read |
- Returns
- the value of the pin; 0=LOW, 1=HIGH
Definition at line 299 of file LccNodeCommons.h.
◆ write()
| void I2cCard::write |
( |
uint8_t |
channel, |
|
|
uint16_t |
value |
|
) |
| |
|
inline |
sets a MCP pin to either HIGH or LOW, or a PWM channel to a value
- Parameters
-
| channel | is the MCP/PWM pin (0-15) to set |
| value | is the value (HIGH or LOW) to set the pin too |
Definition at line 283 of file LccNodeCommons.h.
The documentation for this class was generated from the following file: