ESPHome  2024.9.2
mcp23s17.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include "esphome/core/hal.h"
7 
8 namespace esphome {
9 namespace mcp23s17 {
10 
12  public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
13  spi::DATA_RATE_8MHZ> {
14  public:
15  MCP23S17() = default;
16 
17  void setup() override;
18  void dump_config() override;
19  void set_device_address(uint8_t device_addr);
20 
21  protected:
22  bool read_reg(uint8_t reg, uint8_t *value) override;
23  bool write_reg(uint8_t reg, uint8_t value) override;
24 
25  uint8_t device_opcode_ = 0x40;
26 };
27 
28 } // namespace mcp23s17
29 } // namespace esphome
The SPIDevice is what components using the SPI will create.
Definition: spi.h:391
void set_device_address(uint8_t device_addr)
Definition: mcp23s17.cpp:9
void setup() override
Definition: mcp23s17.cpp:15
void dump_config() override
Definition: mcp23s17.cpp:44
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool write_reg(uint8_t reg, uint8_t value) override
Definition: mcp23s17.cpp:58
bool read_reg(uint8_t reg, uint8_t *value) override
Definition: mcp23s17.cpp:49