diff --git a/keil_project/MDK-ARM/Project.uvoptx b/keil_project/MDK-ARM/Project.uvoptx index 051d5ca..c5a8424 100644 --- a/keil_project/MDK-ARM/Project.uvoptx +++ b/keil_project/MDK-ARM/Project.uvoptx @@ -404,6 +404,22 @@ + + 2 + 0 + 40 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\Services\RFInput.c + + +
@@ -520,7 +536,7 @@ 2 2 1 - 1 + 0 0 0 ..\Services\Chrono.c @@ -532,7 +548,7 @@ 2 3 1 - 1 + 0 0 0 ..\Services\alimentation.c @@ -543,12 +559,84 @@ 2 4 - 5 + 1 0 0 0 - ..\Services\alimentation.h - alimentation.h + ..\Services\accelerometer.c + accelerometer.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\Services\DcMotor.c + DcMotor.c + 0 + 0 + + + 2 + 6 + 1 + 1 + 0 + 0 + ..\Services\emetteur_rf.c + emetteur_rf.c + 0 + 0 + + + 2 + 7 + 1 + 0 + 0 + 0 + ..\Services\IncrEncoder.c + IncrEncoder.c + 0 + 0 + + + 2 + 8 + 1 + 1 + 0 + 0 + ..\Services\RFInput.c + RFInput.c + 0 + 0 + + + 2 + 9 + 1 + 0 + 0 + 0 + ..\Services\Sail.c + Sail.c + 0 + 0 + + + 2 + 10 + 1 + 0 + 0 + 0 + ..\Services\Servo.c + Servo.c 0 0 @@ -562,7 +650,7 @@ 0 3 - 5 + 11 1 0 0 @@ -582,7 +670,7 @@ 0 4 - 6 + 12 1 0 0 @@ -594,7 +682,7 @@ 4 - 7 + 13 1 0 0 @@ -606,7 +694,7 @@ 4 - 8 + 14 1 0 0 @@ -618,9 +706,9 @@ 4 - 9 + 15 1 - 1 + 0 0 0 ..\LLDrivers\src\stm32f1xx_ll_gpio.c @@ -630,7 +718,7 @@ 4 - 10 + 16 1 0 0 @@ -640,6 +728,30 @@ 0 0 + + 4 + 17 + 1 + 0 + 0 + 0 + ..\LLDrivers\src\stm32f1xx_ll_exti.c + stm32f1xx_ll_exti.c + 0 + 0 + + + 4 + 18 + 1 + 0 + 0 + 0 + ..\LLDrivers\src\stm32f1xx_ll_usart.c + stm32f1xx_ll_usart.c + 0 + 0 + @@ -650,7 +762,7 @@ 0 5 - 11 + 19 5 0 0 @@ -670,7 +782,7 @@ 0 6 - 12 + 20 1 0 0 @@ -690,7 +802,7 @@ 0 7 - 13 + 21 2 0 0 diff --git a/keil_project/MDK-ARM/Project.uvprojx b/keil_project/MDK-ARM/Project.uvprojx index 0f7722b..2b5fcdb 100644 --- a/keil_project/MDK-ARM/Project.uvprojx +++ b/keil_project/MDK-ARM/Project.uvprojx @@ -185,6 +185,7 @@ 0 0 0 + 0 0 0 8 @@ -351,7 +352,7 @@ 0 0 0 - 0 + 4 @@ -403,9 +404,39 @@ ..\Services\alimentation.c - alimentation.h - 5 - ..\Services\alimentation.h + accelerometer.c + 1 + ..\Services\accelerometer.c + + + DcMotor.c + 1 + ..\Services\DcMotor.c + + + emetteur_rf.c + 1 + ..\Services\emetteur_rf.c + + + IncrEncoder.c + 1 + ..\Services\IncrEncoder.c + + + RFInput.c + 1 + ..\Services\RFInput.c + + + Sail.c + 1 + ..\Services\Sail.c + + + Servo.c + 1 + ..\Services\Servo.c @@ -447,6 +478,16 @@ 1 ..\LLDrivers\src\stm32f1xx_ll_adc.c + + stm32f1xx_ll_exti.c + 1 + ..\LLDrivers\src\stm32f1xx_ll_exti.c + + + stm32f1xx_ll_usart.c + 1 + ..\LLDrivers\src\stm32f1xx_ll_usart.c + @@ -488,7 +529,7 @@ Simulateur 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::ARMCC + 5060750::V5.06 update 6 (build 750)::.\ARMCC 0 @@ -663,6 +704,7 @@ 0 0 0 + 0 0 0 8 @@ -829,7 +871,7 @@ 0 0 0 - 0 + 4 @@ -881,9 +923,39 @@ ..\Services\alimentation.c - alimentation.h - 5 - ..\Services\alimentation.h + accelerometer.c + 1 + ..\Services\accelerometer.c + + + DcMotor.c + 1 + ..\Services\DcMotor.c + + + emetteur_rf.c + 1 + ..\Services\emetteur_rf.c + + + IncrEncoder.c + 1 + ..\Services\IncrEncoder.c + + + RFInput.c + 1 + ..\Services\RFInput.c + + + Sail.c + 1 + ..\Services\Sail.c + + + Servo.c + 1 + ..\Services\Servo.c @@ -925,6 +997,16 @@ 1 ..\LLDrivers\src\stm32f1xx_ll_adc.c + + stm32f1xx_ll_exti.c + 1 + ..\LLDrivers\src\stm32f1xx_ll_exti.c + + + stm32f1xx_ll_usart.c + 1 + ..\LLDrivers\src\stm32f1xx_ll_usart.c + @@ -978,4 +1060,19 @@ + + + + <Project Info> + + + + + + 0 + 1 + + + + diff --git a/keil_project/Services/RFInput.h b/keil_project/Services/RFInput.h index 5be206f..dfd6df6 100644 --- a/keil_project/Services/RFInput.h +++ b/keil_project/Services/RFInput.h @@ -1,5 +1,12 @@ +// initializes the PWM input of the remote on PB6 void RF_INPUT_Init(void); -int RF_INPUT_GetValue1(void); -int RF_INPUT_GetValue2(void); +// returns the period of the PWM signal of the remote in us +int RF_INPUT_GetPeriodUs(void); + +// returns the duty time of the PWM signal of the remote in us +int RF_INPUT_GetDutyTimeUs(void); + +// returns the duty time of the PWM signal of the remote as a value between -100 and 100 +int RF_INPUT_GetDutyTimeRelative(void); diff --git a/keil_project/Services/emetteur_rf.h b/keil_project/Services/emetteur_rf.h index 8592eae..787b8fb 100644 --- a/keil_project/Services/emetteur_rf.h +++ b/keil_project/Services/emetteur_rf.h @@ -6,9 +6,9 @@ #include "stm32f1xx_ll_usart.h" #include "stm32f1xx_ll_gpio.h" -void emetteur_rf_init(); +void emetteur_rf_init(void); void emetteur_send_bytes(USART_TypeDef * uart_port,char* buf, int len); -#endif \ No newline at end of file +#endif diff --git a/keil_project/Src/main.c b/keil_project/Src/main.c index c2331fd..84b9601 100644 --- a/keil_project/Src/main.c +++ b/keil_project/Src/main.c @@ -58,8 +58,8 @@ int main(void) LL_mDelay(10); counter = (counter + 1) % 100; DC_MOTOR_SetSpeed(counter); - val = RF_INPUT_GetValue1(); - val2 = RF_INPUT_GetValue2(); + val = RF_INPUT_GetPeriodUs(); + val2 = RF_INPUT_GetDutyTimeUs(); SAIL_SetAngle(counter); level = get_battery_level(); level_enough = is_level_enough();