request names refactored

This commit is contained in:
Tristan Krause 2019-06-21 14:37:42 +02:00
parent 257b33b77a
commit 193a3254b8
3 changed files with 26 additions and 26 deletions

View file

@ -235,7 +235,7 @@ uint8_t B15F::digitalRead0()
usart.clearInputBuffer(); usart.clearInputBuffer();
uint8_t rq[] = uint8_t rq[] =
{ {
RQ_BE0 RQ_DIGITAL_READ_0
}; };
usart.transmit(&rq[0], 0, sizeof(rq)); usart.transmit(&rq[0], 0, sizeof(rq));
@ -249,7 +249,7 @@ uint8_t B15F::digitalRead1()
usart.clearInputBuffer(); usart.clearInputBuffer();
uint8_t rq[] = uint8_t rq[] =
{ {
RQ_BE1 RQ_DIGITAL_READ_1
}; };
usart.transmit(&rq[0], 0, sizeof(rq)); usart.transmit(&rq[0], 0, sizeof(rq));
@ -263,7 +263,7 @@ uint8_t B15F::readDipSwitch()
usart.clearInputBuffer(); usart.clearInputBuffer();
uint8_t rq[] = uint8_t rq[] =
{ {
RQ_DSW RQ_READ_DIP_SWITCH
}; };
usart.transmit(&rq[0], 0, sizeof(rq)); usart.transmit(&rq[0], 0, sizeof(rq));
@ -276,7 +276,7 @@ bool B15F::analogWrite0(uint16_t value)
{ {
uint8_t rq[] = uint8_t rq[] =
{ {
RQ_AA0, RQ_ANALOG_WRITE_0,
static_cast<uint8_t >(value & 0xFF), static_cast<uint8_t >(value & 0xFF),
static_cast<uint8_t >(value >> 8) static_cast<uint8_t >(value >> 8)
}; };
@ -291,7 +291,7 @@ bool B15F::analogWrite1(uint16_t value)
{ {
uint8_t rq[] = uint8_t rq[] =
{ {
RQ_AA1, RQ_ANALOG_WRITE_1,
static_cast<uint8_t >(value & 0xFF), static_cast<uint8_t >(value & 0xFF),
static_cast<uint8_t >(value >> 8) static_cast<uint8_t >(value >> 8)
}; };
@ -310,7 +310,7 @@ uint16_t B15F::analogRead(uint8_t channel)
uint8_t rq[] = uint8_t rq[] =
{ {
RQ_ADC, RQ_ANALOG_READ,
channel channel
}; };
@ -425,7 +425,7 @@ bool B15F::setRegister(volatile uint8_t* adr, uint8_t val)
uint8_t rq[] = uint8_t rq[] =
{ {
RQ_SET_REG, RQ_SET_REGISTER,
static_cast<uint8_t>(reinterpret_cast<size_t>(adr)), static_cast<uint8_t>(reinterpret_cast<size_t>(adr)),
val val
}; };
@ -443,7 +443,7 @@ uint8_t B15F::getRegister(volatile uint8_t* adr)
uint8_t rq[] = uint8_t rq[] =
{ {
RQ_GET_REG, RQ_GET_REGISTER,
static_cast<uint8_t>(reinterpret_cast<size_t>(adr)) static_cast<uint8_t>(reinterpret_cast<size_t>(adr))
}; };

View file

@ -27,35 +27,35 @@ void handleRequest()
rqSelfTest(); rqSelfTest();
break; break;
case RQ_BA0: case RQ_DIGITAL_WRITE_0:
rqDigitalWrite0(); rqDigitalWrite0();
break; break;
case RQ_BA1: case RQ_DIGITAL_WRITE_1:
rqDigitalWrite1(); rqDigitalWrite1();
break; break;
case RQ_BE0: case RQ_DIGITAL_READ_0:
rqDigitalRead0(); rqDigitalRead0();
break; break;
case RQ_BE1: case RQ_DIGITAL_READ_1:
rqDigitalRead1(); rqDigitalRead1();
break; break;
case RQ_DSW: case RQ_READ_DIP_SWITCH:
rqReadDipSwitch(); rqReadDipSwitch();
break; break;
case RQ_AA0: case RQ_ANALOG_WRITE_0:
rqAnalogWrite0(); rqAnalogWrite0();
break; break;
case RQ_AA1: case RQ_ANALOG_WRITE_1:
rqAnalogWrite1(); rqAnalogWrite1();
break; break;
case RQ_ADC: case RQ_ANALOG_READ:
rqAnalogRead(); rqAnalogRead();
break; break;
@ -71,11 +71,11 @@ void handleRequest()
rqPwmSetValue(); rqPwmSetValue();
break; break;
case RQ_SET_REG: case RQ_SET_REGISTER:
rqSetRegister(); rqSetRegister();
break; break;
case RQ_GET_REG: case RQ_GET_REGISTER:
rqGetRegister(); rqGetRegister();
break; break;

View file

@ -8,17 +8,17 @@ constexpr static uint8_t RQ_INT_TEST = 3;
constexpr static uint8_t RQ_SELF_TEST = 4; constexpr static uint8_t RQ_SELF_TEST = 4;
constexpr static uint8_t RQ_DIGITAL_WRITE_0 = 5; constexpr static uint8_t RQ_DIGITAL_WRITE_0 = 5;
constexpr static uint8_t RQ_DIGITAL_WRITE_1 = 6; constexpr static uint8_t RQ_DIGITAL_WRITE_1 = 6;
constexpr static uint8_t RQ_BE0 = 7; constexpr static uint8_t RQ_DIGITAL_READ_0 = 7;
constexpr static uint8_t RQ_BE1 = 8; constexpr static uint8_t RQ_DIGITAL_READ_1 = 8;
constexpr static uint8_t RQ_DSW = 9; constexpr static uint8_t RQ_READ_DIP_SWITCH = 9;
constexpr static uint8_t RQ_AA0 = 10; constexpr static uint8_t RQ_ANALOG_WRITE_0 = 10;
constexpr static uint8_t RQ_AA1 = 11; constexpr static uint8_t RQ_ANALOG_WRITE_1 = 11;
constexpr static uint8_t RQ_ADC = 12; constexpr static uint8_t RQ_ANALOG_READ = 12;
constexpr static uint8_t RQ_ADC_DAC_STROKE = 13; 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_FREQ = 14;
constexpr static uint8_t RQ_PWM_SET_VALUE = 15; constexpr static uint8_t RQ_PWM_SET_VALUE = 15;
constexpr static uint8_t RQ_SET_REG = 16; constexpr static uint8_t RQ_SET_REGISTER = 16;
constexpr static uint8_t RQ_GET_REG = 17; constexpr static uint8_t RQ_GET_REGISTER = 17;
uint8_t const rq_len[] = { uint8_t const rq_len[] = {
/* RQ_DISC */ 1, /* RQ_DISC */ 1,