This commit is contained in:
Tristan Krause 2019-06-27 16:19:47 +02:00
parent e8ee9c6cd7
commit eec2dd0db6
74 changed files with 503 additions and 368 deletions

View file

@ -100,7 +100,7 @@ void init()
// set view context
View::setWinContext(newwin(WIN_HEIGHT, WIN_WIDTH, 0, 0));
// set graphical error handler
B15F::setAbortHandler(&abort_handler);
}

120
control/src/cli.cpp.orig Normal file
View file

@ -0,0 +1,120 @@
//#define B15F_CLI_DEBUG
#include <stdio.h>
#include <ncurses.h> // sudo apt-get install libncurses5-dev
#include <vector>
#include <string>
#include <iostream>
#include <signal.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <signal.h>
#include <future>
#include <thread>
#include <chrono>
#include "drv/b15f.h"
#include "ui/ui.h"
#include "ui/view_selection.h"
#include "ui/view_info.h"
#include "ui/view_monitor.h"
#include "ui/view_promt.h"
constexpr uint8_t WIN_WIDTH = 80;
constexpr uint8_t WIN_HEIGHT = 24;
volatile int win_changed_cooldown = 0;
volatile bool t_refresh_active = false;
void signal_handler(int signal)
{
if(signal == SIGWINCH)
{
win_changed_cooldown = 10; // 100ms
if (!t_refresh_active)
{
if(t_refresh.joinable())
t_refresh.join();
t_refresh_active = true;
t_refresh = std::thread([]()
{
while(win_changed_cooldown--)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
t_refresh_active = false;
if(win_stack.size())
win_stack.back()->repaint();
});
}
}
else if(signal == SIGINT)
{
cleanup();
std::cout << "SIGINT - Abbruch." << std::endl;
exit(EXIT_FAILURE);
}
}
void abort_handler(std::exception& ex)
{
ViewInfo* view = new ViewInfo();
view->setTitle("Fehler");
std::string msg(ex.what());
msg += "\n\nBeende in 5 Sekunden.";
view->setText(msg.c_str());
view->setLabelClose("");
view->repaint();
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
cleanup();
std::cerr << std::endl << "*** EXCEPTION ***" << std::endl << ex.what() << std::endl;
exit(EXIT_FAILURE);
}
void init()
{
// init b15 driver
B15F::getInstance();
#ifndef B15F_CLI_DEBUG
std::cout << std::endl << "Starte in 3s ..." << std::endl;
sleep(3);
#endif
// init all ncurses stuff
initscr();
start_color();
curs_set(0); // 0: invisible, 1: normal, 2: very visible
clear();
noecho();
cbreak(); // Line buffering disabled. pass on everything
mousemask(ALL_MOUSE_EVENTS, NULL);
// connect signals to handler
signal(SIGWINCH, signal_handler);
signal(SIGINT, signal_handler);
// set view context
View::setWinContext(newwin(WIN_HEIGHT, WIN_WIDTH, 0, 0));
// set graphical error handler
B15F::setAbortHandler(&abort_handler);
}
int main()
{
init();
int exit_code = EXIT_SUCCESS;
show_main(0);
cleanup();
return exit_code;
}

View file

@ -195,7 +195,7 @@ void B15F::activateSelfTestMode()
{
RQ_SELF_TEST
};
assertRequestLength(rq, RQ_SELF_TEST);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -211,7 +211,7 @@ void B15F::digitalWrite0(uint8_t port)
RQ_DIGITAL_WRITE_0,
port
};
assertRequestLength(rq, RQ_DIGITAL_WRITE_0);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -227,7 +227,7 @@ void B15F::digitalWrite1(uint8_t port)
RQ_DIGITAL_WRITE_1,
port
};
assertRequestLength(rq, RQ_DIGITAL_WRITE_1);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -243,7 +243,7 @@ uint8_t B15F::digitalRead0()
{
RQ_DIGITAL_READ_0
};
assertRequestLength(rq, RQ_DIGITAL_READ_0);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -259,7 +259,7 @@ uint8_t B15F::digitalRead1()
{
RQ_DIGITAL_READ_1
};
assertRequestLength(rq, RQ_DIGITAL_READ_1);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -275,7 +275,7 @@ uint8_t B15F::readDipSwitch()
{
RQ_READ_DIP_SWITCH
};
assertRequestLength(rq, RQ_READ_DIP_SWITCH);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -295,7 +295,7 @@ void B15F::analogWrite0(uint16_t value)
static_cast<uint8_t >(value & 0xFF),
static_cast<uint8_t >(value >> 8)
};
assertRequestLength(rq, RQ_ANALOG_WRITE_0);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -312,7 +312,7 @@ void B15F::analogWrite1(uint16_t value)
static_cast<uint8_t >(value & 0xFF),
static_cast<uint8_t >(value >> 8)
};
assertRequestLength(rq, RQ_ANALOG_WRITE_1);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -345,7 +345,7 @@ uint16_t B15F::analogRead(uint8_t channel)
}
void B15F::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)
uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
{
// prepare pointers
buffer_a += offset_a;
@ -593,7 +593,7 @@ void B15F::setServoPosition(uint16_t pos)
static_cast<uint8_t >(pos & 0xFF),
static_cast<uint8_t >(pos >> 8)
};
assertRequestLength(rq, RQ_SERVO_SET_POS);
usart.transmit(&rq[0], 0, sizeof(rq));
@ -625,7 +625,7 @@ void B15F::init()
// normal PC serial interface
std::string device = exec("bash -c 'ls /dev/ttyUSB* 2> /dev/null'");
#endif
while (device.find(' ') != std::string::npos || device.find('\n') != std::string::npos ||
device.find('\t') != std::string::npos)
device.pop_back();

View file

@ -171,7 +171,6 @@ void B15F::abort(std::exception &ex)
errorhandler(ex);
else
{
std::cerr << "NOTICE: B15F::errorhandler not set" << std::endl;
std::cout << ex.what() << std::endl;
throw DriverException(ex.what());
}
@ -190,45 +189,51 @@ void B15F::setAbortHandler(errorhandler_t func)
* Steuerbefehle für B15 *
*************************/
bool B15F::activateSelfTestMode()
void B15F::activateSelfTestMode()
{
uint8_t rq[] =
{
RQ_SELF_TEST
};
assertRequestLength(rq, RQ_SELF_TEST);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
usart.receive(&aw, 0, sizeof(aw));
return aw == MSG_OK;
assertCode(aw, MSG_OK);
}
bool B15F::digitalWrite0(uint8_t port)
void B15F::digitalWrite0(uint8_t port)
{
uint8_t rq[] =
{
RQ_DIGITAL_WRITE_0,
port
};
assertRequestLength(rq, RQ_DIGITAL_WRITE_0);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
usart.receive(&aw, 0, sizeof(aw));
return aw == MSG_OK;
assertCode(aw, MSG_OK);
}
bool B15F::digitalWrite1(uint8_t port)
void B15F::digitalWrite1(uint8_t port)
{
uint8_t rq[] =
{
RQ_DIGITAL_WRITE_1,
port
};
assertRequestLength(rq, RQ_DIGITAL_WRITE_1);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
usart.receive(&aw, 0, sizeof(aw));
return aw == MSG_OK;
assertCode(aw, MSG_OK);
}
uint8_t B15F::digitalRead0()
@ -238,6 +243,8 @@ uint8_t B15F::digitalRead0()
{
RQ_DIGITAL_READ_0
};
assertRequestLength(rq, RQ_DIGITAL_READ_0);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
@ -252,6 +259,8 @@ uint8_t B15F::digitalRead1()
{
RQ_DIGITAL_READ_1
};
assertRequestLength(rq, RQ_DIGITAL_READ_1);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
@ -266,6 +275,8 @@ uint8_t B15F::readDipSwitch()
{
RQ_READ_DIP_SWITCH
};
assertRequestLength(rq, RQ_READ_DIP_SWITCH);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
@ -276,7 +287,7 @@ uint8_t B15F::readDipSwitch()
return aw;
}
bool B15F::analogWrite0(uint16_t value)
void B15F::analogWrite0(uint16_t value)
{
uint8_t rq[] =
{
@ -284,14 +295,16 @@ bool B15F::analogWrite0(uint16_t value)
static_cast<uint8_t >(value & 0xFF),
static_cast<uint8_t >(value >> 8)
};
assertRequestLength(rq, RQ_ANALOG_WRITE_0);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
usart.receive(&aw, 0, sizeof(aw));
return aw == MSG_OK;
assertCode(aw, MSG_OK);
}
bool B15F::analogWrite1(uint16_t value)
void B15F::analogWrite1(uint16_t value)
{
uint8_t rq[] =
{
@ -299,11 +312,13 @@ bool B15F::analogWrite1(uint16_t value)
static_cast<uint8_t >(value & 0xFF),
static_cast<uint8_t >(value >> 8)
};
assertRequestLength(rq, RQ_ANALOG_WRITE_1);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
usart.receive(&aw, 0, sizeof(aw));
return aw == MSG_OK;
assertCode(aw, MSG_OK);
}
uint16_t B15F::analogRead(uint8_t channel)
@ -318,6 +333,7 @@ uint16_t B15F::analogRead(uint8_t channel)
channel
};
assertRequestLength(rq, RQ_ANALOG_READ);
usart.transmit(&rq[0], 0, sizeof(rq));
uint16_t aw;
@ -328,8 +344,7 @@ uint16_t B15F::analogRead(uint8_t channel)
return aw;
}
void
B15F::analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b,
void B15F::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)
{
// prepare pointers
@ -351,6 +366,7 @@ B15F::analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, u
static_cast<uint8_t >(count >> 8)
};
assertRequestLength(rq, RQ_ADC_DAC_STROKE);
usart.transmit(&rq[0], 0, sizeof(rq));
for (uint16_t i = 0; i < count; i++)
@ -382,8 +398,7 @@ B15F::analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, u
uint8_t aw;
usart.receive(&aw, 0, sizeof(aw));
if(aw != MSG_OK)
abort("Sequenz unterbrochen");
assertCode(aw, MSG_OK);
}
uint8_t B15F::pwmSetFrequency(uint32_t freq)
@ -399,6 +414,7 @@ uint8_t B15F::pwmSetFrequency(uint32_t freq)
static_cast<uint8_t>((freq >> 24) & 0xFF)
};
assertRequestLength(rq, RQ_PWM_SET_FREQ);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
@ -406,7 +422,7 @@ uint8_t B15F::pwmSetFrequency(uint32_t freq)
return aw;
}
bool B15F::pwmSetValue(uint8_t value)
void B15F::pwmSetValue(uint8_t value)
{
usart.clearInputBuffer();
@ -416,14 +432,15 @@ bool B15F::pwmSetValue(uint8_t value)
value
};
assertRequestLength(rq, RQ_PWM_SET_VALUE);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
usart.receive(&aw, 0, sizeof(aw));
return aw == MSG_OK;
assertCode(aw, MSG_OK);
}
bool B15F::setMem8(volatile uint8_t* adr, uint8_t val)
void B15F::setMem8(volatile uint8_t* adr, uint8_t val)
{
usart.clearInputBuffer();
@ -435,11 +452,12 @@ bool B15F::setMem8(volatile uint8_t* adr, uint8_t val)
val
};
assertRequestLength(rq, RQ_SET_MEM_8);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
usart.receive(&aw, 0, sizeof(aw));
return aw == val;
assertCode(aw, MSG_OK);
}
uint8_t B15F::getMem8(volatile uint8_t* adr)
@ -453,6 +471,7 @@ uint8_t B15F::getMem8(volatile uint8_t* adr)
static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8)
};
assertRequestLength(rq, RQ_GET_MEM_8);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
@ -460,7 +479,7 @@ uint8_t B15F::getMem8(volatile uint8_t* adr)
return aw;
}
bool B15F::setMem16(volatile uint16_t* adr, uint16_t val)
void B15F::setMem16(volatile uint16_t* adr, uint16_t val)
{
usart.clearInputBuffer();
@ -473,11 +492,12 @@ bool B15F::setMem16(volatile uint16_t* adr, uint16_t val)
static_cast<uint8_t >(val >> 8)
};
assertRequestLength(rq, RQ_SET_MEM_16);
usart.transmit(&rq[0], 0, sizeof(rq));
uint16_t aw;
usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
return aw == val;
assertCode(aw, MSG_OK);
}
uint16_t B15F::getMem16(volatile uint16_t* adr)
@ -491,6 +511,7 @@ uint16_t B15F::getMem16(volatile uint16_t* adr)
static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8)
};
assertRequestLength(rq, RQ_GET_MEM_16);
usart.transmit(&rq[0], 0, sizeof(rq));
uint16_t aw;
@ -498,9 +519,9 @@ uint16_t B15F::getMem16(volatile uint16_t* adr)
return aw;
}
bool B15F::setRegister(volatile uint8_t* adr, uint8_t val)
void B15F::setRegister(volatile uint8_t* adr, uint8_t val)
{
return setMem8(adr, val);
setMem8(adr, val);
}
uint8_t B15F::getRegister(volatile uint8_t* adr)
@ -517,6 +538,7 @@ uint16_t* B15F::getInterruptCounterOffset()
RQ_COUNTER_OFFSET
};
assertRequestLength(rq, RQ_COUNTER_OFFSET);
usart.transmit(&rq[0], 0, sizeof(rq));
uint16_t aw;
@ -533,6 +555,7 @@ void B15F::setServoEnabled(void)
RQ_SERVO_ENABLE
};
assertRequestLength(rq, RQ_SERVO_ENABLE);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
@ -549,6 +572,7 @@ void B15F::setServoDisabled(void)
RQ_SERVO_DISABLE
};
assertRequestLength(rq, RQ_SERVO_DISABLE);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
@ -560,7 +584,7 @@ void B15F::setServoPosition(uint16_t pos)
{
if(pos > 19000)
throw DriverException("Impulslänge ist zu lang: " + std::to_string(pos));
usart.clearInputBuffer();
uint8_t rq[] =
@ -569,7 +593,8 @@ void B15F::setServoPosition(uint16_t pos)
static_cast<uint8_t >(pos & 0xFF),
static_cast<uint8_t >(pos >> 8)
};
assertRequestLength(rq, RQ_SERVO_SET_POS);
usart.transmit(&rq[0], 0, sizeof(rq));
uint8_t aw;
@ -593,7 +618,14 @@ B15F::B15F()
void B15F::init()
{
std::string device = exec("bash -c 'ls /dev/ttyUSB*'");
#ifdef __arm__
// Raspberry Pi serial interface
std::string device = exec("bash -c 'ls /dev/ttyAMA* 2> /dev/null'");
#else
// normal PC serial interface
std::string device = exec("bash -c 'ls /dev/ttyUSB* 2> /dev/null'");
#endif
while (device.find(' ') != std::string::npos || device.find('\n') != std::string::npos ||
device.find('\t') != std::string::npos)
device.pop_back();
@ -635,9 +667,3 @@ void B15F::init()
std::cout << PRE << "AVR Firmware Version: " << info[0] << " um " << info[1] << " Uhr (" << info[2] << ")"
<< std::endl;
}
void B15F::assertCode(uint8_t& code, uint8_t expectation) const
{
if(code != expectation)
throw DriverException("Ungültige Antwort erhalten: " + std::to_string((int) code) + " (erwartet: " + std::to_string((int) expectation) + ")");
}

View file

@ -335,7 +335,7 @@ private:
if(code != static_cast<CodeType>(expectation))
throw DriverException("Ungültige Antwort erhalten: " + std::to_string((int) code) + " (erwartet: " + std::to_string((int) expectation) + ")");
}
/**
* Wirft eine Exception, falls die Request die falsche Länge hat.
* \throws DriverException

View file

@ -130,21 +130,21 @@ public:
* WICHTIG: Es darf dabei nichts an den Klemmen angeschlossen sein!
* \throws DriverException
*/
bool activateSelfTestMode(void);
void activateSelfTestMode(void);
/**
* Setzt den Wert des digitalen Ausgabeports 0
* \param port Wert für gesamten Port
* \throws DriverException
*/
bool digitalWrite0(uint8_t);
void digitalWrite0(uint8_t);
/**
* Setzt den Wert des digitalen Ausgabeports 1
* \param port Wert für gesamten Port
* \throws DriverException
*/
bool digitalWrite1(uint8_t);
void digitalWrite1(uint8_t);
/**
* Liest den Wert des digitalen Eingabeports 0
@ -172,14 +172,14 @@ public:
* \param port 10-Bit Wert
* \throws DriverException
*/
bool analogWrite0(uint16_t port);
void analogWrite0(uint16_t port);
/**
* Setzt den Wert des Digital-Analog-Converters (DAC / DAU) 1
* \param port 10-Bit Wert
* \throws DriverException
*/
bool analogWrite1(uint16_t port);
void analogWrite1(uint16_t port);
/**
* Liest den Wert des Analog-Digital-Converters (ADC / ADU)
@ -221,7 +221,7 @@ public:
* \param value PWM Wert [0..TOP]
* \throws DriverException
*/
bool pwmSetValue(uint8_t value);
void pwmSetValue(uint8_t value);
/**
* Setzt direkt den Wert einer MCU Speicherzelle der Größe 8 Bit.
@ -231,7 +231,7 @@ public:
* \param val Neuer Wert für die Zelle
* \return true, falls Vorgang erfolgreich
*/
bool setMem8(volatile uint8_t* adr, uint8_t val);
void setMem8(volatile uint8_t* adr, uint8_t val);
/**
* Liefert den Wert einer MCU Speicherzelle der Größe 8 Bit.
@ -247,9 +247,9 @@ public:
* *Wichtig:* bei einer falschen Adresse kann das Board 15 ernsthaften Schaden nehmen!
* \param adr Speicheradresse
* \param val Neuer Wert für die Zelle
* \return true, falls Vorgang erfolgreich
* \throws DriverException
*/
bool setMem16(volatile uint16_t* adr, uint16_t val);
void setMem16(volatile uint16_t* adr, uint16_t val);
/**
* Liefert den Wert einer MCU Speicherzelle der Größe 16 Bit.
@ -264,9 +264,9 @@ public:
* *Wichtig:* bei einer falschen Adresse kann das Board 15 ernsthaften Schaden nehmen!
* \param adr Speicheradresse
* \param val Neuer Wert für das Register
* \return true, falls Vorgang erfolgreich
* \throws DriverException
*/
bool setRegister(volatile uint8_t* adr, uint8_t val);
void setRegister(volatile uint8_t* adr, uint8_t val);
/**
* Diese Funktion ist ein Alias für getMem8().
@ -280,20 +280,23 @@ public:
* \return Adresse (in der MCU)
*/
uint16_t* getInterruptCounterOffset(void);
/**
* Aktiviert das Servo Signal an PB2 und Initialisiert es mit 1,5ms Pulselänge.
* \throws DriverException
*/
void setServoEnabled(void);
/**
* Deaktiviert das Servo Signal an PB2.
* \throws DriverException
*/
void setServoDisabled(void);
/**
* Setzt die Pulselänge des Servo Signals und damit die Position.
* \param pos Pulselänge des Signals in Mikrosekunden
* \throws DriverException
*/
void setServoPosition(uint16_t pos);
@ -321,12 +324,28 @@ private:
* \throws DriverException
*/
void init(void);
/**
* Wirft eine Exception, falls der Code ungleich dem erwarteten Wert ist.
* \throws DriverException
*/
void assertCode(uint8_t& code, uint8_t expectation) const;
template<typename CodeType, typename ExpectationType>
void assertCode(CodeType& code, ExpectationType expectation) const
{
if(code != static_cast<CodeType>(expectation))
throw DriverException("Ungültige Antwort erhalten: " + std::to_string((int) code) + " (erwartet: " + std::to_string((int) expectation) + ")");
}
/**
* Wirft eine Exception, falls die Request die falsche Länge hat.
* \throws DriverException
*/
template<size_t RequestLength>
void assertRequestLength(uint8_t (&)[RequestLength], uint8_t rq_num)
{
if(RequestLength != rq_len[rq_num])
throw DriverException("Ungültige Request Länge: " + std::to_string(RequestLength) + " (erwartet: " + std::to_string(rq_len[rq_num]) + ")");
}
USART usart; //!< USART Instanz für serielle Verbindung
static B15F* instance; //!< private Instanz für Singleton

View file

@ -1,57 +0,0 @@
#ifndef REQUESTS_H
#define REQUESTS_H
constexpr static uint8_t RQ_DISCARD = 0;
constexpr static uint8_t RQ_TEST = 1;
constexpr static uint8_t RQ_INFO = 2;
constexpr static uint8_t RQ_INT_TEST = 3;
constexpr static uint8_t RQ_SELF_TEST = 4;
constexpr static uint8_t RQ_DIGITAL_WRITE_0 = 5;
constexpr static uint8_t RQ_DIGITAL_WRITE_1 = 6;
constexpr static uint8_t RQ_DIGITAL_READ_0 = 7;
constexpr static uint8_t RQ_DIGITAL_READ_1 = 8;
constexpr static uint8_t RQ_READ_DIP_SWITCH = 9;
constexpr static uint8_t RQ_ANALOG_WRITE_0 = 10;
constexpr static uint8_t RQ_ANALOG_WRITE_1 = 11;
constexpr static uint8_t RQ_ANALOG_READ = 12;
constexpr static uint8_t RQ_ADC_DAC_STROKE = 13;
constexpr static uint8_t RQ_PWM_SET_FREQ = 14;
constexpr static uint8_t RQ_PWM_SET_VALUE = 15;
constexpr static uint8_t RQ_SET_MEM_8 = 16;
constexpr static uint8_t RQ_GET_MEM_8 = 17;
constexpr static uint8_t RQ_SET_MEM_16 = 18;
constexpr static uint8_t RQ_GET_MEM_16 = 19;
constexpr static uint8_t RQ_COUNTER_OFFSET = 20;
constexpr static uint8_t RQ_SERVO_ENABLE = 21;
constexpr static uint8_t RQ_SERVO_DISABLE = 22;
constexpr static uint8_t RQ_SERVO_SET_POS = 23;
uint8_t const rq_len[] =
{
1 /* RQ_DISCARD */,
1 /* RQ_TEST */ + 1 /* test byte */,
1 /* RQ_INFO */,
1 /* RQ_INT_TEST */ + 1 /* test int high low */ + 1 /* test int high high */,
1 /* RQ_SELF_TEST */,
1 /* RQ_DIGITAL_WRITE_0 */ + 1 /* port value */,
1 /* RQ_DIGITAL_WRITE_1 */ + 1 /* port value */,
1 /* RQ_DIGITAL_READ_0 */,
1 /* RQ_DIGITAL_READ_1 */,
1 /* RQ_READ_DIP_SWITCH */,
1 /* RQ_ANALOG_WRITE_0 */ + 1 /* test int high low */ + 1 /* test int high high */,
1 /* RQ_ANALOG_WRITE_1 */ + 1 /* test int high low */ + 1 /* test int high high */,
1 /* RQ_ANALOG_READ */ + 1 /* adc channel */,
1 /* RQ_ADC_DAC_STROKE */ + 1 /* channel a */ + 1 /* channel b */ + 1 /* start low */ + 1 /* start high */ + 1 /* delta low */ + 1 /* delta high */ + 1 /* count low */ + 1 /* count high */,
1 /* RQ_PWM_SET_FREQ */ + 1 /* freq low low */ + 1 /* freq low high */ + 1 /* freq high low */ + 1 /* freq high high */,
1 /* RQ_PWM_SET_VALUE */ + 1 /* pwm value */,
1 /* RQ_SET_MEM_8 */ + 1 /* memory address low */ + 1 /* memory address high */ + 1 /* memory value (8-bit) */,
1 /* RQ_GET_MEM_8 */ + 1 /* memory address low */ + 1 /* memory address high */,
1 /* RQ_SET_MEM_16 */ + 1 /* memory address low */ + 1 /* memory address high */ + 1 /* memory value low */ + 1 /* memory value high */,
1 /* RQ_GET_MEM_16 */ + 1 /* memory address low */ + 1 /* memory address high */,
1 /* RQ_COUNTER_OFFSET */,
1 /* RQ_SERVO_ENABLE */,
1 /* RQ_SERVO_DISABLE */,
1 /* RQ_SERVO_SET_POS */ + 1 /* pulse length low */ + 1 /* pulse length high */,
};
#endif // REQUESTS_H