ESPHome  2024.11.0
esp32_can.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ESP32
4 
7 
8 namespace esphome {
9 namespace esp32_can {
10 
11 class ESP32Can : public canbus::Canbus {
12  public:
13  void set_rx(int rx) { rx_ = rx; }
14  void set_tx(int tx) { tx_ = tx; }
15  void set_tx_queue_len(uint32_t tx_queue_len) { this->tx_queue_len_ = tx_queue_len; }
16  void set_rx_queue_len(uint32_t rx_queue_len) { this->rx_queue_len_ = rx_queue_len; }
17  ESP32Can(){};
18 
19  protected:
20  bool setup_internal() override;
21  canbus::Error send_message(struct canbus::CanFrame *frame) override;
22  canbus::Error read_message(struct canbus::CanFrame *frame) override;
23 
24  int rx_{-1};
25  int tx_{-1};
28 };
29 
30 } // namespace esp32_can
31 } // namespace esphome
32 
33 #endif
optional< uint32_t > tx_queue_len_
Definition: esp32_can.h:26
bool setup_internal() override
Definition: esp32_can.cpp:69
optional< uint32_t > rx_queue_len_
Definition: esp32_can.h:27
void set_rx_queue_len(uint32_t rx_queue_len)
Definition: esp32_can.h:16
void set_tx_queue_len(uint32_t tx_queue_len)
Definition: esp32_can.h:15
canbus::Error read_message(struct canbus::CanFrame *frame) override
Definition: esp32_can.cpp:134
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
canbus::Error send_message(struct canbus::CanFrame *frame) override
Definition: esp32_can.cpp:104