PCAL9555 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Functions | Variables
Register map

Command bytes, fields and power-up defaults. More...

Functions

constexpr bool pcal9555::reg::IsImplemented (uint8_t command, bool agile) noexcept
 Whether a part implements a command byte (table 4): 0x00 to 0x07 on both parts, and on the PCAL9555A also 0x40 to 0x4D and 0x4F. The PCA9555 data sheet does not define its answer to any other command byte, so the driver never sends one.
 

Variables

constexpr uint8_t pcal9555::reg::kInputPort0 = 0x00
 Input port 0 (R): pin levels; 0x01 is port 1.
 
constexpr uint8_t pcal9555::reg::kOutputPort0 = 0x02
 Output port 0 (R/W); 0x03 is port 1.
 
constexpr uint8_t pcal9555::reg::kPolarityPort0 = 0x04
 Polarity inversion 0 (R/W); 0x05 is port 1.
 
constexpr uint8_t pcal9555::reg::kConfigPort0 = 0x06
 Configuration 0 (R/W): 1 = input; 0x07 port 1.
 
constexpr uint8_t pcal9555::reg::kDriveStrength0 = 0x40
 Drive strength 0 (R/W): P0_0-3; 0x41 P0_4-7.
 
constexpr uint8_t pcal9555::reg::kDriveStrength2 = 0x42
 Drive strength 2 (R/W): P1_0-3; 0x43 P1_4-7.
 
constexpr uint8_t pcal9555::reg::kInputLatch0 = 0x44
 Input latch 0 (R/W): 1 = latched; 0x45 port 1.
 
constexpr uint8_t pcal9555::reg::kPullEnable0 = 0x46
 Pull-up/pull-down enable 0 (R/W); 0x47 port 1.
 
constexpr uint8_t pcal9555::reg::kPullSelect0 = 0x48
 Pull-up/pull-down selection 0 (R/W): 1 = pull-up.
 
constexpr uint8_t pcal9555::reg::kInterruptMask0 = 0x4A
 Interrupt mask 0 (R/W): 1 = masked.
 
constexpr uint8_t pcal9555::reg::kInterruptStatus0 = 0x4C
 Interrupt status 0 (R); 0x4D is port 1.
 
constexpr uint8_t pcal9555::reg::kOutputPortConfig = 0x4F
 Output port configuration (R/W).
 
constexpr uint8_t pcal9555::reg::kOutputConfigOden0 = 1U << 0
 0x4F ODEN0: port 0 open-drain.
 
constexpr uint8_t pcal9555::reg::kOutputConfigOden1 = 1U << 1
 
constexpr uint16_t pcal9555::reg::kIdentityPattern = 0x55AA
 
constexpr uint8_t pcal9555::reg::kOutputConfigReservedMask = 0xFC
 0x4F bits 7..2 are reserved and read 0 (PCAL9555A table 27).
 
constexpr uint32_t pcal9555::reg::kDriveBitsPerPin = 2U
 Bits per pin in the drive strength registers: pin n of a port uses bits 2(n%4)+1..2(n%4).
 
constexpr uint32_t pcal9555::reg::kDriveCodeMask = 0x3
 Mask of one pin's drive strength code.
 
constexpr uint16_t pcal9555::reg::kOutputReset = 0xFFFF
 Output ports: every pin high.
 
constexpr uint16_t pcal9555::reg::kPolarityReset = 0x0000
 Polarity inversion: none.
 
constexpr uint16_t pcal9555::reg::kConfigReset = 0xFFFF
 
constexpr uint32_t pcal9555::reg::kDriveStrengthReset = 0xFFFF'FFFFU
 Drive strength: full on every pin (0x40 to 0x43 all 0xFF).
 
constexpr uint16_t pcal9555::reg::kInputLatchReset = 0x0000
 Input latch: off.
 
constexpr uint16_t pcal9555::reg::kPullEnableReset = 0xFFFF
 Pull resistors: enabled.
 
constexpr uint16_t pcal9555::reg::kPullSelectReset = 0xFFFF
 Pull resistors: pull-up.
 
constexpr uint16_t pcal9555::reg::kInterruptMaskReset = 0xFFFF
 Interrupts: every pin masked.
 
constexpr uint8_t pcal9555::reg::kOutputPortConfigReset = 0x00
 Both ports push-pull.
 

Detailed Description

Command bytes, fields and power-up defaults.

Function Documentation

◆ IsImplemented()

constexpr bool pcal9555::reg::IsImplemented ( uint8_t  command,
bool  agile 
)
constexprnoexcept

Whether a part implements a command byte (table 4): 0x00 to 0x07 on both parts, and on the PCAL9555A also 0x40 to 0x4D and 0x4F. The PCA9555 data sheet does not define its answer to any other command byte, so the driver never sends one.

Parameters
commandThe command byte.
agiletrue for the PCAL9555A.
Returns
true when the part has the register.

Variable Documentation

◆ kConfigReset

constexpr uint16_t pcal9555::reg::kConfigReset = 0xFFFF
inlineconstexpr

Configuration: every pin an input.

◆ kIdentityPattern

constexpr uint16_t pcal9555::reg::kIdentityPattern = 0x55AA
inlineconstexpr

Written to the polarity inversion pair at start-up and read back before the configuration is written: alternating bits, so that neither a line stuck at 0 or 1 nor a device that acknowledges everything and returns a fixed byte can echo it. Polarity only changes how inputs read.

◆ kOutputConfigOden1

constexpr uint8_t pcal9555::reg::kOutputConfigOden1 = 1U << 1
inlineconstexpr

0x4F ODEN1: port 1 open-drain.