TP_Voilier/Sources/main.c
Newg 4a8421eb37 Merge remote-tracking branch 'origin/girouette'
# Conflicts:
#	FileInclude/MyTimer.c
#	Listings/Projet1_Simulation.map
#	Listings/startup_stm32f10x_md.lst
#	Objects/Projet1_Réel.dep
#	Objects/Projet1_SImulation.dep
#	Objects/Projet1_Simulation.axf
#	Objects/Projet1_Simulation.build_log.htm
#	Objects/Projet1_Simulation.htm
#	Objects/Projet1_Simulation.lnp
#	Objects/driver_gpio.crf
#	Objects/driver_gpio.d
#	Objects/driver_gpio.o
#	Objects/main.crf
#	Objects/main.d
#	Objects/main.o
#	Objects/myadc.crf
#	Objects/myadc.d
#	Objects/myadc.o
#	Objects/mytimer.crf
#	Objects/mytimer.d
#	Objects/mytimer.o
#	Objects/startup_stm32f10x_md.o
#	Objects/system_stm32f10x.crf
#	Objects/system_stm32f10x.d
#	Objects/system_stm32f10x.o
#	Projet1.uvoptx
#	Projet1.uvprojx
#	RTE/Device/STM32F103RB/system_stm32f10x.c
#	Sources/main.c
2022-11-14 18:45:28 +01:00

72 lines
1.2 KiB
C

#include "stm32f10x.h"
#include <Driver_GPIO.h>
#include <MyTimer.h>
#include <MyADC.h>
#include <Plateau.h>
#include <Telecommande.h>
#include <Batterie.h>
#include <MyGirouette.h>
#include <MyVoile.h>
int droite;
int b;
int testBatterie ;
int bat;
void f (char a) {
if (a>> 7 & 1) {
droite = 1;
b = 256 - a;
Set_Moteur_Plateau(HORRAIRE, b);
}
else {
droite = 0;
b = a;
Set_Moteur_Plateau(ANTI_HORRAIRE, b);
}
}
int main (void)
{
char* visuBatterie = "[-----]";
/* Pour la telecommande */
Init_USART(USART1);
Init_Message_Reception(&f);
Init_Plateau();
Init_Girouette();
MyVoile_Init();
/* Batterie */
Init_Batterie();
while (1) {
Set_Voile(Get_Angle());
bat = Get_Batterie();
if (bat < 20) {
visuBatterie = "[-----]";
} else if (bat < 40) {
visuBatterie = "[##---]";
} else if (bat < 60) {
visuBatterie = "[###--]";
} else if (bat < 80) {
visuBatterie = "[####-]";
} else {
visuBatterie = "[#####]";
}
Send_Message("Batterie : ");
Send_Message(visuBatterie);
Send_Message("\r");
}
do {
}
while (1);
}