LoRa_APRS_iGate/lib/BoardFinder/BoardFinder.h

63 wiersze
1.4 KiB
C
Czysty Zwykły widok Historia

2021-01-01 22:23:27 +00:00
#ifndef BOARD_FINDER_H_
#define BOARD_FINDER_H_
#include <list>
#include <memory>
#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
2021-01-01 22:23:27 +00:00
enum BoardType
{
eHELTEC_WIFI_LORA_32_V1,
eHELTEC_WIFI_LORA_32_V2,
eTTGO_LORA32_V1,
eTTGO_LORA32_V2,
eTTGO_T_Beam_V0_7,
eTTGO_T_Beam_V1_0,
eETH_BOARD,
eTRACKERD
2021-01-01 22:23:27 +00:00
};
class BoardConfig {
2021-01-01 22:23:27 +00:00
public:
explicit BoardConfig(String name, BoardType type, uint8_t oledsda, uint8_t oledscl, uint8_t oledaddr, uint8_t oledreset, uint8_t lorasck, uint8_t loramiso, uint8_t loramosi, uint8_t loracs, uint8_t lorareset, uint8_t lorairq, bool needcheckpowerchip = false, bool powercheckstatus = false);
2021-01-01 22:23:27 +00:00
String Name;
BoardType Type;
2021-01-01 22:23:27 +00:00
uint8_t OledSda;
uint8_t OledScl;
uint8_t OledAddr;
uint8_t OledReset;
2021-01-01 22:23:27 +00:00
uint8_t LoraSck;
uint8_t LoraMiso;
uint8_t LoraMosi;
uint8_t LoraCS;
uint8_t LoraReset;
uint8_t LoraIRQ;
2021-01-01 22:23:27 +00:00
bool needCheckPowerChip;
bool powerCheckStatus;
2021-01-01 22:23:27 +00:00
};
class BoardFinder {
2021-01-01 22:23:27 +00:00
public:
explicit BoardFinder(std::list<std::shared_ptr<BoardConfig>> &boardConfigs);
2021-01-01 22:23:27 +00:00
std::shared_ptr<BoardConfig> searchBoardConfig();
2021-01-01 22:23:27 +00:00
std::shared_ptr<BoardConfig> getBoardConfig(String name);
2021-01-01 22:23:27 +00:00
private:
std::list<std::shared_ptr<BoardConfig>> _boardConfigs;
2021-01-01 22:23:27 +00:00
bool checkOledConfig(std::shared_ptr<BoardConfig> boardConfig);
bool checkModemConfig(std::shared_ptr<BoardConfig> boardConfig);
bool checkPowerConfig(std::shared_ptr<BoardConfig> boardConfig);
2021-01-01 22:23:27 +00:00
};
#endif