reglage handler bordage
This commit is contained in:
parent
7453ce894f
commit
d7f41b71e8
4 changed files with 44 additions and 29 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
<RegID>0</RegID>
|
||||
<MDITabState>
|
||||
<Len>1350</Len>
|
||||
<Data>01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000009000000070000000100000064553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C536F757263655C7072696E636970616C2E63000000000B7072696E636970616C2E6300000000C5D4F200FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4D7954696D65722E6800000000094D7954696D65722E6800000000FFDC7800FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4D7954696D65722E6300000000094D7954696D65722E6300000000BECEA100FFFFFFFF67553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4472697665725F4750494F2E68000000000D4472697665725F4750494F2E6800000000F0A0A100FFFFFFFF67553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4472697665725F4750494F2E63000000000D4472697665725F4750494F2E6300000000BCA8E100FFFFFFFF51433A5C50726F6772616D646174615C4B65696C5C41726D5C5061636B735C4B65696C5C53544D3332463178785F4446505C322E332E305C4465766963655C496E636C7564655C73746D3332663130782E68000000000B73746D3332663130782E68000000009CC1B600FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C626F72646167652E680000000009626F72646167652E6800000000F7B88600FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C626F72646167652E630000000009626F72646167652E6300000000D9ADC200FFFFFFFF7F553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C5254455C4465766963655C53544D33324631303352425C737461727475705F73746D3332663130785F6D642E730000000016737461727475705F73746D3332663130785F6D642E7300000000A5C2D700FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD50001000000000000000200000004010000660000000008000061030000</Data>
|
||||
<Data>01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000009000000000000000100000064553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C536F757263655C7072696E636970616C2E63000000000B7072696E636970616C2E6300000000C5D4F200FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4D7954696D65722E6800000000094D7954696D65722E6800000000FFDC7800FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4D7954696D65722E6300000000094D7954696D65722E6300000000BECEA100FFFFFFFF67553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4472697665725F4750494F2E68000000000D4472697665725F4750494F2E6800000000F0A0A100FFFFFFFF67553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C4472697665725F4750494F2E63000000000D4472697665725F4750494F2E6300000000BCA8E100FFFFFFFF51433A5C50726F6772616D646174615C4B65696C5C41726D5C5061636B735C4B65696C5C53544D3332463178785F4446505C322E332E305C4465766963655C496E636C7564655C73746D3332663130782E68000000000B73746D3332663130782E68000000009CC1B600FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C626F72646167652E680000000009626F72646167652E6800000000F7B88600FFFFFFFF63553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C496E636C7564655C626F72646167652E630000000009626F72646167652E6300000000D9ADC200FFFFFFFF7F553A5C3449525C53544D33325C50726F6A65745F566F696C6965725C70726F6A65745F766F696C6965725C4B65696C5F456C6973655F59757765695C4C6F63616C5F536F75726365735C626F72646167655C5254455C4465766963655C53544D33324631303352425C737461727475705F73746D3332663130785F6D642E730000000016737461727475705F73746D3332663130785F6D642E7300000000A5C2D700FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD50001000000000000000200000004010000660000000008000061030000</Data>
|
||||
</MDITabState>
|
||||
</MDIClientArea>
|
||||
<ViewEx>
|
||||
|
@ -3634,12 +3634,12 @@
|
|||
<ActiveMDIGroup>0</ActiveMDIGroup>
|
||||
<MDIGroup>
|
||||
<Size>100</Size>
|
||||
<ActiveTab>7</ActiveTab>
|
||||
<ActiveTab>0</ActiveTab>
|
||||
<Doc>
|
||||
<Name>.\Source\principal.c</Name>
|
||||
<ColumnNumber>1</ColumnNumber>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>24</CurrentLine>
|
||||
<CurrentLine>7</CurrentLine>
|
||||
<Folding>1</Folding>
|
||||
<ContractedFolders></ContractedFolders>
|
||||
<PaneID>0</PaneID>
|
||||
|
@ -3691,7 +3691,7 @@
|
|||
</Doc>
|
||||
<Doc>
|
||||
<Name>.\Include\bordage.h</Name>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<ColumnNumber>10</ColumnNumber>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>9</CurrentLine>
|
||||
<Folding>0</Folding>
|
||||
|
@ -3700,9 +3700,9 @@
|
|||
</Doc>
|
||||
<Doc>
|
||||
<Name>.\Include\bordage.c</Name>
|
||||
<ColumnNumber>2</ColumnNumber>
|
||||
<TopLine>12</TopLine>
|
||||
<CurrentLine>34</CurrentLine>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<TopLine>13</TopLine>
|
||||
<CurrentLine>14</CurrentLine>
|
||||
<Folding>1</Folding>
|
||||
<ContractedFolders></ContractedFolders>
|
||||
<PaneID>0</PaneID>
|
||||
|
|
Loading…
Reference in a new issue