remote set and get register by address

This commit is contained in:
Tristan Krause 2019-05-29 10:13:36 +02:00
parent 2c47159df3
commit 2e88b9c980
69 changed files with 1595 additions and 117 deletions

View file

@ -70,6 +70,14 @@ void handleRequest()
case RQ_PWM_SET_VALUE:
rqPwmSetValue();
break;
case RQ_SET_REG:
rqSetRegister();
break;
case RQ_GET_REG:
rqGetRegister();
break;
default:
break;
@ -244,3 +252,24 @@ void rqPwmSetValue()
usart.writeByte(USART::MSG_OK);
usart.flush();
}
void rqSetRegister()
{
usart.initTX();
uint16_t reg = usart.readByte();
uint16_t val = usart.readByte();
(*(volatile uint8_t *) reg) = val;
usart.writeByte((*(volatile uint8_t *) reg));
usart.flush();
}
void rqGetRegister()
{
usart.initTX();
uint16_t reg = usart.readByte();
usart.writeByte((*(volatile uint8_t *) reg));
usart.flush();
}