esphome/esphome/components/esp32_can/esp32_can.h
Sympatron GmbH 5026bc7a78
Native ESP32 CAN support (#1629)
Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-01-12 08:54:35 +13:00

29 lines
578 B
C++

#pragma once
#ifdef USE_ESP32
#include "esphome/components/canbus/canbus.h"
#include "esphome/core/component.h"
namespace esphome {
namespace esp32_can {
class ESP32Can : public canbus::Canbus {
public:
void set_rx(int rx) { rx_ = rx; }
void set_tx(int tx) { tx_ = tx; }
ESP32Can(){};
protected:
bool setup_internal() override;
canbus::Error send_message(struct canbus::CanFrame *frame) override;
canbus::Error read_message(struct canbus::CanFrame *frame) override;
int rx_{-1};
int tx_{-1};
};
} // namespace esp32_can
} // namespace esphome
#endif