/ firmware / src / hardware / rs485.h
rs485.h
 1  #pragma once
 2  #include <config.h>
 3  
 4  #include <Arduino.h>
 5  
 6  namespace hardware::rs485 {
 7  
 8  enum class Channel : uint8_t {
 9    Bus0 = 0,
10    Bus1 = 1,
11  };
12  
13  struct BusDescriptor {
14    Channel channel;
15    HardwareSerial *serial;
16    int8_t de_re_gpio;
17    uint32_t baud_rate;
18    bool ready;
19  };
20  
21  bool initialize();
22  bool accessDescriptor(BusDescriptor *descriptor);
23  
24  }
25