From 402fdcfe4e4a70854521be20da30bf0e1efe5e06 Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Mon, 20 Mar 2023 16:01:53 +0100 Subject: [PATCH] Ajout du bouton et de la led fonctionnant ensemble. --- ProjetsKEIL/Drivers/Source/Principale.c | 16 ++++++++++------ ProjetsKEIL/Drivers/gpiodriver.uvoptx | 16 ---------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/ProjetsKEIL/Drivers/Source/Principale.c b/ProjetsKEIL/Drivers/Source/Principale.c index 13624fb..038fe2a 100644 --- a/ProjetsKEIL/Drivers/Source/Principale.c +++ b/ProjetsKEIL/Drivers/Source/Principale.c @@ -4,13 +4,17 @@ int main ( void ) { int returnValue; - MyGPIO_Struct_TypeDef gpioA5_test = {GPIOA,5,Out_PullUp}; - MyGPIO_Init(&gpioA5_test); - MyGPIO_Set(GPIOA,5); - MyGPIO_Toggle(GPIOA,5); - MyGPIO_Toggle(GPIOA,5); - MyGPIO_Reset(GPIOA,5); + MyGPIO_Struct_TypeDef led = {GPIOA,5,Out_PullUp}; //led + MyGPIO_Struct_TypeDef bouton = {GPIOC,13,In_PullDown}; //bouton poussoir + MyGPIO_Init(&led); + MyGPIO_Init(&bouton); do{ + if(MyGPIO_Read(GPIOC,13)) + { + MyGPIO_Reset(GPIOA,5); + } else { + MyGPIO_Set(GPIOA,5); + } }while(1) ; } diff --git a/ProjetsKEIL/Drivers/gpiodriver.uvoptx b/ProjetsKEIL/Drivers/gpiodriver.uvoptx index 78cd3e0..b3f96d1 100644 --- a/ProjetsKEIL/Drivers/gpiodriver.uvoptx +++ b/ProjetsKEIL/Drivers/gpiodriver.uvoptx @@ -414,22 +414,6 @@ 0 0 - 10 - 1 -
134218772
- 0 - 0 - 0 - 0 - 0 - 1 - .\Source\Principale.c - - \\cool_reel\Source/Principale.c\10 -
- - 1 - 0 6 1
0