ESPHome 2025.5.0
Loading...
Searching...
No Matches
weikai_spi.h
Go to the documentation of this file.
1
7
8#pragma once
9#include <bitset>
10#include <memory>
15
16namespace esphome {
17namespace weikai_spi {
22 public:
23 WeikaiRegisterSPI(weikai::WeikaiComponent *const comp, uint8_t reg, uint8_t channel)
24 : weikai::WeikaiRegister(comp, reg, channel) {}
25
26 uint8_t read_reg() const override;
27 void write_reg(uint8_t value) override;
28 void read_fifo(uint8_t *data, size_t length) const override;
29 void write_fifo(uint8_t *data, size_t length) override;
30};
31
37 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
38 spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
39 public:
40 weikai::WeikaiRegister &reg(uint8_t reg, uint8_t channel) override {
42 reg_spi_.channel_ = channel;
43 return reg_spi_;
44 }
45
46 void setup() override;
47 void dump_config() override;
48
49 protected:
51};
52
53} // namespace weikai_spi
54} // namespace esphome
The SPIDevice is what components using the SPI will create.
Definition spi.h:421
The WeikaiComponent class stores the information global to the WeiKai component and provides methods ...
Definition weikai.h:197
WeikaiRegister objects acts as proxies to access remote register independently of the bus type.
Definition weikai.h:139
uint8_t register_
address of the register
Definition weikai.h:186
uint8_t channel_
channel for this register
Definition weikai.h:187
The WeikaiComponentSPI class stores the information to the WeiKai component connected through an SPI ...
Definition weikai_spi.h:38
weikai::WeikaiRegister & reg(uint8_t reg, uint8_t channel) override
Definition weikai_spi.h:40
WeikaiRegisterSPI reg_spi_
init to this component
Definition weikai_spi.h:50
WeikaiRegisterSPI objects acts as proxies to access remote register through an SPI Bus.
Definition weikai_spi.h:21
WeikaiRegisterSPI(weikai::WeikaiComponent *const comp, uint8_t reg, uint8_t channel)
Definition weikai_spi.h:23
void write_reg(uint8_t value) override
uint8_t read_reg() const override
void write_fifo(uint8_t *data, size_t length) override
void read_fifo(uint8_t *data, size_t length) const override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t length
Definition tt21100.cpp:0
WeiKai component family - classes declaration.