Jämför commits
1 commit
master
...
Telecomman
Upphovsman | SHA1 | Datum | |
---|---|---|---|
83991e64d0 |
3 ändrade filer med 42 tillägg och 10 borttagningar
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 "Driver_ADC.h"
|
||||||
#include "MySPI.h"
|
#include "MySPI.h"
|
||||||
#include "Driver_IMU.h"
|
#include "Driver_IMU.h"
|
||||||
|
#include "Orientation.h"
|
||||||
|
signed char direction = 0;
|
||||||
int main() {
|
int main() {
|
||||||
//Pour le Driver_IMU
|
//Pour la direction
|
||||||
char DATAX0 = 0x32;
|
//Initialisation de l'UART pour le XBEE
|
||||||
unsigned char values[6];
|
telecommande_init();
|
||||||
|
|
||||||
MyGPIO_Struct_TypeDef GPIO_ADC1;
|
|
||||||
|
|
||||||
driver_adc_1_launch_read();
|
|
||||||
|
|
||||||
driver_IMU_init();
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
driver_IMU_read(DATAX0, 6, values);
|
direction = telecommande_direction(); //direction = valeur pour l'orientation des voiles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Laddar…
Referens i nytt ärende