main testing function for pwm input and output

This commit is contained in:
Jasper Güldenstein 2020-11-13 12:55:18 +01:00
parent 547237526a
commit 60944f55dd

View file

@ -24,6 +24,7 @@
#include "RFInput.h" #include "RFInput.h"
#include "IncrEncoder.h" #include "IncrEncoder.h"
#include "DcMotor.h" #include "DcMotor.h"
#include "Sail.h"
void SystemClock_Config(void); void SystemClock_Config(void);
@ -45,18 +46,18 @@ int main(void)
SystemClock_Config(); SystemClock_Config();
RF_INPUT_Init(); RF_INPUT_Init();
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM4);
DC_MOTOR_Init(); DC_MOTOR_Init();
SAIL_Init();
/* Infinite loop */ /* Infinite loop */
while (1) while (1)
{ {
LL_mDelay(1000); LL_mDelay(10);
counter = (counter + 1) % 100; counter = (counter + 1) % 100;
DC_MOTOR_SetSpeed(counter); DC_MOTOR_SetSpeed(counter);
val = RF_INPUT_GetValue1(); val = RF_INPUT_GetValue1();
val2 = RF_INPUT_GetValue2(); val2 = RF_INPUT_GetValue2();
SAIL_SetAngle(counter);
} }
} }