Compare commits
2 commits
7e19976938
...
7163e05d17
Author | SHA1 | Date | |
---|---|---|---|
7163e05d17 | |||
bea44470ab |
8 changed files with 102 additions and 71 deletions
|
@ -18,12 +18,12 @@ void UART_init(MyUART_Struct_Typedef * UART)
|
|||
USART1->CR1 |= USART_CR1_UE; // Activer l'USART
|
||||
USART1->CR1 &= ~USART_CR1_M; // Choisir la taille 8bits de donnée
|
||||
USART1->CR2 |= USART_CR2_STOP; // 1 seul bit de stop
|
||||
//USART1->BRR |= 468 << 4; // Fixe le baud rate à 9600bps partie entière
|
||||
//USART1->BRR |= 75; // Fixe le baud rate à 9600bps partie fractionnaire
|
||||
//USART1->BRR |= 468 << 4; // Fixe le baud rate à 9600bps partie entière
|
||||
//USART1->BRR |= 75; // Fixe le baud rate à 9600bps partie fractionnaire
|
||||
UART->UART->BRR = 72000000/(UART->baudrate);
|
||||
USART1->CR1 |= USART_CR1_TE; // Autoriser la transmission
|
||||
USART1->CR1 |= USART_CR1_RE; // Activer la réception
|
||||
// USART1->CR1 |= USART_CR1_TCIE; // Activer l'interruption de transmission
|
||||
USART1->CR1 |= USART_CR1_TE; // Autoriser la transmission
|
||||
USART1->CR1 |= USART_CR1_RE; // Activer la réception
|
||||
// USART1->CR1 |= USART_CR1_TCIE; // Activer l'interruption de transmission
|
||||
USART1->CR1 |= USART_CR1_RXNEIE; // Activer l'interruption de réception
|
||||
UART_interruption(UART);
|
||||
|
||||
|
|
|
@ -9,26 +9,29 @@ void Plateau_init(void)
|
|||
MyTimer_Struct_TypeDef Timer;
|
||||
MyGPIO_Struct_TypeDef Pin_Sens;
|
||||
|
||||
Pin_Sens.GPIO=GPIOB;
|
||||
Pin_Sens.GPIO_Pin=1;
|
||||
Pin_Sens.GPIO_Conf = Out_PullUp;
|
||||
|
||||
//Fréquence
|
||||
Timer.Timer = TIM3;
|
||||
Timer.ARR=3599;
|
||||
Timer.PSC=0;
|
||||
|
||||
Pin_Sens.GPIO=GPIOB;
|
||||
Pin_Sens.GPIO_Pin=1;
|
||||
Pin_Sens.GPIO_Conf = Out_PullUp;
|
||||
|
||||
|
||||
MyTimer_Base_Init(&Timer);
|
||||
MyGPIO_Init(&Pin_Sens);
|
||||
|
||||
//MyTimer_PWM(TIM3, 50);
|
||||
MyTimer_PWM(&Timer, 50);
|
||||
|
||||
//MyTimer_Base_Start(Timer);
|
||||
MyTimer_Base_Start(TIM3);
|
||||
|
||||
Plateau_direction(DROITE);
|
||||
}
|
||||
|
||||
|
||||
void MyMotor_ChangeDirection(uint8_t Sens)
|
||||
void Plateau_direction(uint8_t Sens)
|
||||
{
|
||||
if(Sens == DROITE)
|
||||
MyGPIO_Set(GPIOB,1);
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
|
||||
|
||||
void Plateau_init(void);
|
||||
void MyMotor_ChangeDirection(uint8_t Sens);
|
||||
void Plateau_direction(uint8_t Sens);
|
||||
|
||||
#endif
|
||||
|
|
32
Drivers/Voilier_fonction/telecommande.c
Normal file
32
Drivers/Voilier_fonction/telecommande.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "telecommande.h"
|
||||
#include "Driver_GPIO.h"
|
||||
#include "Plateau.h"
|
||||
|
||||
MyUART_Struct_Typedef UART_plateau = {USART1,9600};
|
||||
|
||||
void init_telecommande(void)
|
||||
{
|
||||
UART_InitGPIO(&UART_plateau);
|
||||
UART_init(&UART_plateau);
|
||||
}
|
||||
|
||||
|
||||
void telecommande_plateau (int data)
|
||||
{
|
||||
int datar;
|
||||
UART_send(data);
|
||||
datar = data;
|
||||
|
||||
if(datar >= 0)
|
||||
Plateau_direction(DROITE);
|
||||
else
|
||||
Plateau_direction(GAUCHE);
|
||||
}
|
||||
void testRemote(void)
|
||||
{
|
||||
UART_send('t');
|
||||
UART_send('e');
|
||||
UART_send('s');
|
||||
UART_send('t');
|
||||
}
|
||||
|
12
Drivers/Voilier_fonction/telecommande.h
Normal file
12
Drivers/Voilier_fonction/telecommande.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef TELECOMMANDE_H
|
||||
#define TELECOMMANDE_H
|
||||
#include "Driver_UART.h"
|
||||
#include "stm32f10x.h"
|
||||
|
||||
|
||||
void init_telecommande(void);
|
||||
void telecommande_plateau (int data);
|
||||
void testRemote(void);
|
||||
|
||||
|
||||
#endif
|
|
@ -75,7 +75,7 @@
|
|||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
|
@ -125,7 +125,7 @@
|
|||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGDARM</Key>
|
||||
<Name>(1010=937,133,1313,690,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1357,482,1778,909,0)(121=-1,-1,-1,-1,0)(122=546,289,967,716,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=911,135,1505,886,0)(131=997,343,1591,1094,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=1375,56,1823,470,0)(161=1383,268,1831,682,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=240,283,843,1034,0)(151=-1,-1,-1,-1,0)</Name>
|
||||
<Name>(1010=937,133,1313,690,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1357,482,1778,909,0)(121=1042,189,1463,616,0)(122=546,289,967,716,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=911,135,1505,886,0)(131=997,343,1591,1094,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=1375,56,1823,470,0)(161=1383,268,1831,682,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=240,283,843,1034,0)(151=-1,-1,-1,-1,0)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
|
@ -143,40 +143,7 @@
|
|||
<Name>-U -O206 -S8 -C0 -P00 -N00("") -D00(00000000) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>69</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>0</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>.\Sources\Main.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>1</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>69</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134219582</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>U:\INSA\Microcontrôleur\Projet_Voilier_grp\Voilier\GPIO_Test\Sources\Main.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\GPIO_Test\Sources/Main.c\69</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
|
@ -290,7 +257,7 @@
|
|||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
|
@ -462,7 +429,7 @@
|
|||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Drivers\Sources\Driver_ADC.c</PathWithFileName>
|
||||
|
@ -505,8 +472,8 @@
|
|||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Drivers\Voilier_fonction\Girouette.c</PathWithFileName>
|
||||
<FilenameWithoutPath>Girouette.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\Voilier_fonction\telecommande.c</PathWithFileName>
|
||||
<FilenameWithoutPath>telecommande.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
|
@ -517,20 +484,20 @@
|
|||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Drivers\Voilier_fonction\Plateau.c</PathWithFileName>
|
||||
<FilenameWithoutPath>Plateau.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\Voilier_fonction\Girouette.c</PathWithFileName>
|
||||
<FilenameWithoutPath>Girouette.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Drivers\Voilier_fonction\Plateau.h</PathWithFileName>
|
||||
<FilenameWithoutPath>Plateau.h</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\Voilier_fonction\Plateau.c</PathWithFileName>
|
||||
<FilenameWithoutPath>Plateau.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
|
|
|
@ -418,6 +418,11 @@
|
|||
<Group>
|
||||
<GroupName>Voilier_fonction</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>telecommande.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\Voilier_fonction\telecommande.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Girouette.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@ -428,11 +433,6 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\Voilier_fonction\Plateau.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Plateau.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Drivers\Voilier_fonction\Plateau.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@ -776,7 +776,7 @@
|
|||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\Drivers\Include</IncludePath>
|
||||
<IncludePath>..\Drivers\Include;..\Drivers\Voilier_fonction</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
|
@ -855,6 +855,11 @@
|
|||
<Group>
|
||||
<GroupName>Voilier_fonction</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>telecommande.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\Voilier_fonction\telecommande.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Girouette.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@ -865,11 +870,6 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\Voilier_fonction\Plateau.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Plateau.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Drivers\Voilier_fonction\Plateau.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
|
|
@ -2,12 +2,29 @@
|
|||
#include "Driver_Timer.h"
|
||||
#include "Driver_UART.h"
|
||||
#include "Driver_ADC.h"
|
||||
#include "Plateau.h"
|
||||
#include "telecommande.h"
|
||||
|
||||
|
||||
|
||||
char data[] = "Hello World";
|
||||
int i = 0;
|
||||
int len = sizeof(data) - 1; // -1 pour ne pas envoyer le caractère nul
|
||||
|
||||
|
||||
int main (void){
|
||||
|
||||
while(1){
|
||||
init_telecommande();
|
||||
Plateau_init();
|
||||
Plateau_direction(DROITE);
|
||||
|
||||
|
||||
testRemote();
|
||||
|
||||
|
||||
|
||||
while(1){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue