B15F
Board 15 Famulus Edition
|
5 #include <bits/stdc++.h> 15 #include <sys/ioctl.h> 18 #include "driverexception.h" 19 #include "timeoutexception.h" 21 typedef std::function<void(std::exception&)> errorhandler_t;
89 static std::string
exec(std::string cmd);
95 static void abort(std::string msg);
101 static void abort(std::exception& ex);
195 void analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count);
233 const std::string
PRE =
"[B15F] ";
239 constexpr
static uint32_t
BAUDRATE = 57600;
250 static B15F* instance;
251 static errorhandler_t errorhandler;
254 constexpr
static uint8_t RQ_DISC = 0;
255 constexpr
static uint8_t RQ_TEST = 1;
256 constexpr
static uint8_t RQ_INFO = 2;
257 constexpr
static uint8_t RQ_INT = 3;
258 constexpr
static uint8_t RQ_ST = 4;
259 constexpr
static uint8_t RQ_BA0 = 5;
260 constexpr
static uint8_t RQ_BA1 = 6;
261 constexpr
static uint8_t RQ_BE0 = 7;
262 constexpr
static uint8_t RQ_BE1 = 8;
263 constexpr
static uint8_t RQ_DSW = 9;
264 constexpr
static uint8_t RQ_AA0 = 10;
265 constexpr
static uint8_t RQ_AA1 = 11;
266 constexpr
static uint8_t RQ_ADC = 12;
267 constexpr
static uint8_t RQ_ADC_DAC_STROKE = 13;
268 constexpr
static uint8_t RQ_PWM_SET_FREQ = 14;
269 constexpr
static uint8_t RQ_PWM_SET_VALUE = 15;
270 constexpr
static uint8_t RQ_SET_REG = 16;
271 constexpr
static uint8_t RQ_GET_REG = 17;
static std::string exec(std::string cmd)
constexpr static uint8_t MSG_FAIL
Value to reject a received command.
uint8_t getRegister(uint8_t adr)
void delay_us(uint16_t us)
uint8_t digitalRead0(void)
uint8_t pwmSetFrequency(uint32_t freq)
void analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
bool testConnection(void)
uint8_t readDipSwitch(void)
void delay_ms(uint16_t ms)
bool setRegister(uint8_t adr, uint8_t val)
static B15F & getInstance(void)
static void abort(std::string msg)
uint16_t analogRead(uint8_t channel)
bool digitalWrite0(uint8_t)
const std::string PRE
B15F stdout prefix.
bool activateSelfTestMode(void)
std::vector< std::string > getBoardInfo(void)
constexpr static uint16_t RECONNECT_TIMEOUT
Time in ms after which a reconnect attempt aborts.
bool analogWrite1(uint16_t port)
bool digitalWrite1(uint8_t)
bool pwmSetValue(uint8_t value)
constexpr static uint8_t MSG_OK
Value to acknowledge a received command.
uint8_t digitalRead1(void)
constexpr static uint16_t WDT_TIMEOUT
Time in ms after which the watch dog timer resets the MCU.
constexpr static uint32_t BAUDRATE
USART baudrate for communication with the MCU.
static void setAbortHandler(errorhandler_t func)
bool analogWrite0(uint16_t port)
constexpr static uint8_t RECONNECT_TRIES
Maximum count of reconnect attempts after which the driver stops.