Begin of servo

This commit is contained in:
Tristan Krause 2019-06-25 11:06:25 +02:00
parent c09e5b5b48
commit 61ee69dc84
5 changed files with 38 additions and 1 deletions

View file

@ -10,4 +10,4 @@ volatile ADU adu;
volatile USART usart;
volatile PWM pwm;
volatile bool nextRequest = false;
volatile uint16_t interruptCounters[35];
volatile uint16_t interruptCounters[35] = { 0 }; // alle Einträge mit 0 initialisieren

View file

@ -78,6 +78,19 @@ void handleRequest()
case RQ_GET_MEM_8:
rqGetMem8();
break;
break;
case RQ_SET_MEM_16:
rqSetMem16();
break;
case RQ_GET_MEM_16:
rqGetMem16();
break;
case RQ_COUNTER_OFFSET:
rqGetInterruptCounterOffset();
break;
default:
break;
@ -293,3 +306,9 @@ void rqGetMem16()
usart.flush();
}
void rqGetInterruptCounterOffset()
{
usart.initTX();
usart.writeInt((volatile uint16_t) &interruptCounters[0]);
usart.flush();
}

View file

@ -32,5 +32,8 @@ void rqPwmSetFreq(void);
void rqPwmSetValue(void);
void rqSetMem8(void);
void rqGetMem8(void);
void rqSetMem16(void);
void rqGetMem16(void);
void rqGetInterruptCounterOffset(void);
#endif // REQUEST_HANDLERS_H

1
firmware/servo.cpp Normal file
View file

@ -0,0 +1 @@
#include "servo.h"

14
firmware/servo.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef SERVO_H
#define SERVO_H
class Server
{
public:
/**
* Initialisiert die Servo Funktion (Timer 1 & 2).
*/
void init(void) const volatile;
};
#endif // SERVO_H