Compare commits
1 commit
master
...
Telecomman
Author | SHA1 | Date | |
---|---|---|---|
83991e64d0 |
3 changed files with 42 additions and 10 deletions
30
projet-voilier/src/Orientation.c
Normal file
30
projet-voilier/src/Orientation.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "Driver_GPIO.h"
|
||||
#include "stm32f10x.h"
|
||||
#include "stdio.h"
|
||||
#include "Driver_UART.h"
|
||||
|
||||
MyUART_Struct_TypeDef MY_UART;
|
||||
|
||||
void telecommande_init(void)
|
||||
{
|
||||
MyGPIO_Struct_TypeDef UART;
|
||||
UART.GPIO_Pin = 10;
|
||||
UART.GPIO_Conf = AltOut_Ppull;
|
||||
UART.GPIO = GPIOB;
|
||||
MyGPIO_Init(&UART);
|
||||
|
||||
UART.GPIO_Pin = 11;
|
||||
UART.GPIO_Conf = In_Floating;
|
||||
UART.GPIO = GPIOB;
|
||||
MyGPIO_Init(&UART);
|
||||
|
||||
//MyUART_Struct_TypeDef MY_UART;
|
||||
MY_UART.baudrate = 9600;
|
||||
MY_UART.UART = USART3; // USART3_TX : PB10
|
||||
MyUART_Init(&MY_UART);
|
||||
}
|
||||
|
||||
char telecommande_direction(void)
|
||||
{
|
||||
return MyUART_ReceiveByte(&MY_UART);
|
||||
}
|
6
projet-voilier/src/Orientation.h
Normal file
6
projet-voilier/src/Orientation.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef ORIENTATION_H
|
||||
#define ORIENTATION_H
|
||||
void telecommande_init(void);
|
||||
char telecommande_direction(void);
|
||||
|
||||
#endif
|
|
@ -6,18 +6,14 @@
|
|||
#include "Driver_ADC.h"
|
||||
#include "MySPI.h"
|
||||
#include "Driver_IMU.h"
|
||||
#include "Orientation.h"
|
||||
signed char direction = 0;
|
||||
int main() {
|
||||
//Pour le Driver_IMU
|
||||
char DATAX0 = 0x32;
|
||||
unsigned char values[6];
|
||||
|
||||
MyGPIO_Struct_TypeDef GPIO_ADC1;
|
||||
|
||||
driver_adc_1_launch_read();
|
||||
|
||||
driver_IMU_init();
|
||||
//Pour la direction
|
||||
//Initialisation de l'UART pour le XBEE
|
||||
telecommande_init();
|
||||
while(1)
|
||||
{
|
||||
driver_IMU_read(DATAX0, 6, values);
|
||||
direction = telecommande_direction(); //direction = valeur pour l'orientation des voiles
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue