servo geht

This commit is contained in:
Tristan Krause 2019-06-27 15:29:18 +02:00
parent 7b2e5aa1ef
commit eaa8ca721a
207 changed files with 278 additions and 15300 deletions

View file

@ -91,6 +91,18 @@ void handleRequest()
case RQ_COUNTER_OFFSET:
rqGetInterruptCounterOffset();
break;
case RQ_SERVO_ENABLE:
rqServoEnable();
break;
case RQ_SERVO_DISABLE:
rqServoDisable();
break;
case RQ_SERVO_SET_POS:
rqServoSetPosition();
break;
default:
break;
@ -312,3 +324,31 @@ void rqGetInterruptCounterOffset()
usart.writeInt((volatile uint16_t) &interruptCounters[0]);
usart.flush();
}
void rqServoEnable()
{
usart.initTX();
servo.enable();
usart.writeByte(USART::MSG_OK);
usart.flush();
}
void rqServoDisable()
{
usart.initTX();
servo.disable();
usart.writeByte(USART::MSG_OK);
usart.flush();
}
void rqServoSetPosition()
{
usart.initTX();
uint16_t pos = usart.readInt();
servo.setPosition(pos);
usart.writeByte(USART::MSG_OK);
usart.flush();
}