From d7f41b71e8c7bd047b725f4024cb0a9a5f85d2f2 Mon Sep 17 00:00:00 2001 From: Elise Date: Fri, 5 Nov 2021 13:18:03 +0100 Subject: [PATCH] reglage handler bordage --- .../Local_Sources/bordage/Include/bordage.c | 31 ++++++++++--------- .../Local_Sources/bordage/Include/bordage.h | 18 +++++++++++ .../Local_Sources/bordage/Source/principal.c | 8 ++--- .../bordage/drivers.uvguix.lerouxde | 16 +++++----- 4 files changed, 44 insertions(+), 29 deletions(-) diff --git a/Keil_Elise_Yuwei/Local_Sources/bordage/Include/bordage.c b/Keil_Elise_Yuwei/Local_Sources/bordage/Include/bordage.c index 14ed5d2..23394c9 100644 --- a/Keil_Elise_Yuwei/Local_Sources/bordage/Include/bordage.c +++ b/Keil_Elise_Yuwei/Local_Sources/bordage/Include/bordage.c @@ -4,22 +4,23 @@ #include "stm32f10x.h" #include "bordage.h" +/********** PWM **********/ #define TIMER_PWM (TIM3) #define CANAL_PWM (4) +#define GPIO_PWM (GPIOB) +#define GPIO_PIN_PWM (1) +/*************************/ + + #define TIMER_CI (TIM2) // Timer codeur incrémental #define GIROUETTE_PHA (PA1) #define GIROUETTE_PHB (PA4) #define GIROUETTE_INDEX (PB0) #define SERVO_VOILE_PWM (PA4) -/* -************************************************************************************************* -* @brief -* @param -> int angle : angle que l'on veut donner à la voile (entre 0 et 90°) -* @Note -> -************************************************************************************************* -*/ + int bordage ( int angle ) { + MyGPIO_Struct_TypeDef GPIO_Struct; float angle_servo = 90.0 - angle; @@ -32,7 +33,13 @@ int bordage ( int angle ) { TIM.PSC = 23; MyTimer_Base_Init(&TIM); - // PWM + // Configuration du GPIO sur lequel sort la PWM + GPIO_Struct.GPIO = GPIO_PWM; + GPIO_Struct.GPIO_Pin = GPIO_PIN_PWM; + GPIO_Struct.GPIO_Conf = AltOut_Ppull; + MyGPIO_Init(&GPIO_Struct); + + // Génération de la PWM MyTimer_PWM (TIMER_PWM, CANAL_PWM); Set_Duty_Cycle(TIMER_PWM, CANAL_PWM, duty_cycle); @@ -41,13 +48,7 @@ int bordage ( int angle ) { -/* -************************************************************************************************* -* @brief Handler a appeler lorsque l'angle de roulis est supérieur à 40° -* @param -> -* @Note -> -************************************************************************************************* -*/ + void Roulis_Handler ( void ) { bordage(0); diff --git a/Keil_Elise_Yuwei/Local_Sources/bordage/Include/bordage.h b/Keil_Elise_Yuwei/Local_Sources/bordage/Include/bordage.h index 2b17f67..5f92129 100644 --- a/Keil_Elise_Yuwei/Local_Sources/bordage/Include/bordage.h +++ b/Keil_Elise_Yuwei/Local_Sources/bordage/Include/bordage.h @@ -2,7 +2,25 @@ #define BORDAGE_H #include "stm32f10x.h" +/* +************************************************************************************************* +* @brief +* @param -> int angle : angle que l'on veut donner à la voile (entre 0 et 90°) +* @Note -> +************************************************************************************************* +*/ int bordage ( int angle ); + + + + +/* +************************************************************************************************* +* @brief Handler a appeler lorsque l'angle de roulis est supérieur à 40° +* @param -> +* @Note -> +************************************************************************************************* +*/ void Roulis_Handler ( void ); #endif diff --git a/Keil_Elise_Yuwei/Local_Sources/bordage/Source/principal.c b/Keil_Elise_Yuwei/Local_Sources/bordage/Source/principal.c index f9b5514..053a5ae 100644 --- a/Keil_Elise_Yuwei/Local_Sources/bordage/Source/principal.c +++ b/Keil_Elise_Yuwei/Local_Sources/bordage/Source/principal.c @@ -4,16 +4,12 @@ #include "stm32f10x.h" #include "bordage.h" -MyGPIO_Struct_TypeDef GPIO_Struct; + int main ( void ) { - // Configuration de la diode PA.6 - GPIO_Struct.GPIO = GPIOB; - GPIO_Struct.GPIO_Pin = 1; - GPIO_Struct.GPIO_Conf = AltOut_Ppull; - MyGPIO_Init(&GPIO_Struct); + Roulis_Handler(); diff --git a/Keil_Elise_Yuwei/Local_Sources/bordage/drivers.uvguix.lerouxde b/Keil_Elise_Yuwei/Local_Sources/bordage/drivers.uvguix.lerouxde index bed111e..564142f 100644 --- a/Keil_Elise_Yuwei/Local_Sources/bordage/drivers.uvguix.lerouxde +++ b/Keil_Elise_Yuwei/Local_Sources/bordage/drivers.uvguix.lerouxde @@ -142,7 +142,7 @@ 0 1350 - 01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000009000000070000000100000064553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C536F757263655C7072696E636970616C2E63000000000B7072696E636970616C2E6300000000C5D4F200FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4D7954696D65722E6800000000094D7954696D65722E6800000000FFDC7800FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4D7954696D65722E6300000000094D7954696D65722E6300000000BECEA100FFFFFFFF67553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4472697665725F4750494F2E68000000000D4472697665725F4750494F2E6800000000F0A0A100FFFFFFFF67553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4472697665725F4750494F2E63000000000D4472697665725F4750494F2E6300000000BCA8E100FFFFFFFF51433A5C50726F6772616D646174615C4B65696C5C41726D5C5061636B735C4B65696C5C53544D3332463178785F4446505C322E332E305C4465766963655C496E636C7564655C73746D3332663130782E68000000000B73746D3332663130782E68000000009CC1B600FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C626F72646167652E680000000009626F72646167652E6800000000F7B88600FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C626F72646167652E630000000009626F72646167652E6300000000D9ADC200FFFFFFFF7F553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C5254455C4465766963655C53544D33324631303352425C737461727475705F73746D3332663130785F6D642E730000000016737461727475705F73746D3332663130785F6D642E7300000000A5C2D700FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD50001000000000000000200000004010000660000000008000061030000 + 01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000009000000000000000100000064553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C536F757263655C7072696E636970616C2E63000000000B7072696E636970616C2E6300000000C5D4F200FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4D7954696D65722E6800000000094D7954696D65722E6800000000FFDC7800FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4D7954696D65722E6300000000094D7954696D65722E6300000000BECEA100FFFFFFFF67553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4472697665725F4750494F2E68000000000D4472697665725F4750494F2E6800000000F0A0A100FFFFFFFF67553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4472697665725F4750494F2E63000000000D4472697665725F4750494F2E6300000000BCA8E100FFFFFFFF51433A5C50726F6772616D646174615C4B65696C5C41726D5C5061636B735C4B65696C5C53544D3332463178785F4446505C322E332E305C4465766963655C496E636C7564655C73746D3332663130782E68000000000B73746D3332663130782E68000000009CC1B600FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C626F72646167652E680000000009626F72646167652E6800000000F7B88600FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C626F72646167652E630000000009626F72646167652E6300000000D9ADC200FFFFFFFF7F553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C5254455C4465766963655C53544D33324631303352425C737461727475705F73746D3332663130785F6D642E730000000016737461727475705F73746D3332663130785F6D642E7300000000A5C2D700FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD50001000000000000000200000004010000660000000008000061030000 @@ -3634,12 +3634,12 @@ 0 100 - 7 + 0 .\Source\principal.c - 1 + 0 1 - 24 + 7 1 0 @@ -3691,7 +3691,7 @@ .\Include\bordage.h - 0 + 10 1 9 0 @@ -3700,9 +3700,9 @@ .\Include\bordage.c - 2 - 12 - 34 + 0 + 13 + 14 1 0