B15F
Board 15 Famulus Edition
|
5 #include <bits/stdc++.h> 15 #include <sys/ioctl.h> 18 #include "driverexception.h" 19 #include "timeoutexception.h" 22 #define _AVR_IO_H_ 1 // Erzwinge die Inklusion 23 #include "/usr/lib/avr/include/avr/sfr_defs.h" 24 #include "/usr/lib/avr/include/avr/iom1284p.h" 26 typedef std::function<void(std::exception&)> errorhandler_t;
94 static std::string
exec(std::string cmd);
100 static void abort(std::string msg);
106 static void abort(std::exception& ex);
200 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);
226 bool setRegister(
volatile uint8_t* adr, uint8_t val);
239 const std::string
PRE =
"[B15F] ";
245 constexpr
static uint32_t
BAUDRATE = 57600;
256 static B15F* instance;
257 static errorhandler_t errorhandler;
260 constexpr
static uint8_t RQ_DISC = 0;
261 constexpr
static uint8_t RQ_TEST = 1;
262 constexpr
static uint8_t RQ_INFO = 2;
263 constexpr
static uint8_t RQ_INT = 3;
264 constexpr
static uint8_t RQ_ST = 4;
265 constexpr
static uint8_t RQ_BA0 = 5;
266 constexpr
static uint8_t RQ_BA1 = 6;
267 constexpr
static uint8_t RQ_BE0 = 7;
268 constexpr
static uint8_t RQ_BE1 = 8;
269 constexpr
static uint8_t RQ_DSW = 9;
270 constexpr
static uint8_t RQ_AA0 = 10;
271 constexpr
static uint8_t RQ_AA1 = 11;
272 constexpr
static uint8_t RQ_ADC = 12;
273 constexpr
static uint8_t RQ_ADC_DAC_STROKE = 13;
274 constexpr
static uint8_t RQ_PWM_SET_FREQ = 14;
275 constexpr
static uint8_t RQ_PWM_SET_VALUE = 15;
276 constexpr
static uint8_t RQ_SET_REG = 16;
277 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.
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)
uint8_t getRegister(volatile uint8_t *adr)
void delay_ms(uint16_t ms)
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)
bool setRegister(volatile uint8_t *adr, uint8_t val)
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.