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