152template <
typename Transport>
164 config.transport_config.Defaults();
230 ClearBit(
iodir, pin);
298 if(ReadBit(
gpio, pin))
359 pin_data =
a |
b << 8;
379 uint8_t SetBit(uint8_t data, uint8_t pos)
381 data = (data | (1 << pos));
385 uint8_t ClearBit(uint8_t data, uint8_t pos)
387 data = (data & (~(1 << pos)));
391 uint8_t ReadBit(uint16_t data, uint8_t pos)
393 return data & (1 << pos) ? 0xff : 0x00;
396 uint8_t LowByte(uint16_t val) {
return val & 0xFF; }
397 uint8_t HighByte(uint16_t val) {
return (val >> 8) & 0xff; }
Result ReadDataAtAddress(uint16_t address, uint16_t mem_address, uint16_t mem_address_size, uint8_t *data, uint16_t data_size, uint32_t timeout)
Result Init(const Config &config)
Result
Definition i2c.h:72
Result WriteDataAtAddress(uint16_t address, uint16_t mem_address, uint16_t mem_address_size, uint8_t *data, uint16_t data_size, uint32_t timeout)
Definition leddriver.h:33
void Init(I2CHandle i2c, const uint8_t(&addresses)[numDrivers], DmaBuffer dma_buffer_a, DmaBuffer dma_buffer_b, Pin oe_pin=Pin(PORTX, 0))
Definition leddriver.h:65
void ReadReg(MCPRegister reg, uint8_t &portA, uint8_t &portB)
Definition mcp23x17.h:137
uint8_t timeout
Definition mcp23x17.h:149
void Init(const Config &config)
Definition mcp23x17.h:109
uint8_t i2c_address_
Definition mcp23x17.h:148
uint8_t ReadReg(MCPRegister reg)
Definition mcp23x17.h:129
void Init()
Definition mcp23x17.h:102
I2CHandle::Result WriteReg(MCPRegister reg, uint8_t portA, uint8_t portB)
Definition mcp23x17.h:122
I2CHandle::Result WriteReg(MCPRegister reg, uint8_t val)
Definition mcp23x17.h:115
daisy::I2CHandle i2c_
Definition mcp23x17.h:147
Definition mcp23x17.h:154
void WritePin(uint8_t pin, uint8_t state)
Definition mcp23x17.h:255
uint16_t Read()
Definition mcp23x17.h:354
uint8_t ReadPort(MCPPort port)
Definition mcp23x17.h:327
void PinMode(uint8_t pin, MCPMode mode, bool inverted)
Definition mcp23x17.h:213
uint8_t GetPin(uint8_t id)
Fetches pin state from the result of recent Read() call. Useful to preserve unneeded reads.
Definition mcp23x17.h:369
void Init(const Config &config)
Definition mcp23x17.h:168
void Write(uint16_t value)
Definition mcp23x17.h:340
void Init()
Definition mcp23x17.h:161
uint8_t ReadPin(uint8_t pin)
Definition mcp23x17.h:287
void PortMode(MCPPort port, uint8_t directions, uint8_t pullups=0xFF, uint8_t inverted=0x00)
Definition mcp23x17.h:194
void WritePort(MCPPort port, uint8_t value)
Definition mcp23x17.h:314
Hardware defines and helpers for daisy field platform.
Definition index.h:2
@ PORTB
Definition daisy_core.h:178
MCPPort
Definition mcp23x17.h:54
MCPMode
Definition mcp23x17.h:66
MCPRegister
Definition mcp23x17.h:19
MCPRegister operator+(MCPRegister a, MCPPort b)
Definition mcp23x17.h:59
struct daisy::I2CHandle::Config::@15 pin_config
Mode mode
Definition i2c.h:65
Speed speed
Definition i2c.h:64
Peripheral periph
Definition i2c.h:57
uint8_t i2c_address
Definition mcp23x17.h:90
I2CHandle::Config i2c_config
Definition mcp23x17.h:89
void Defaults()
Definition mcp23x17.h:91
Definition mcp23x17.h:157
Transport::Config transport_config
Definition mcp23x17.h:158
representation of hardware port/pin combination
Definition daisy_core.h:193