From 2e86eb6f77361883b970cec55ee340ce9714a546 Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Mon, 20 Mar 2023 15:56:26 +0100 Subject: [PATCH] LED set et reset. toggle fonctionnel --- ProjetsKEIL/Drivers/Source/Principale.c | 15 ++++----- ProjetsKEIL/Drivers/gpiodriver.c | 4 +-- ProjetsKEIL/Drivers/gpiodriver.uvoptx | 44 +++++++++++-------------- 3 files changed, 27 insertions(+), 36 deletions(-) diff --git a/ProjetsKEIL/Drivers/Source/Principale.c b/ProjetsKEIL/Drivers/Source/Principale.c index 60e40ca..13624fb 100644 --- a/ProjetsKEIL/Drivers/Source/Principale.c +++ b/ProjetsKEIL/Drivers/Source/Principale.c @@ -4,15 +4,12 @@ int main ( void ) { int returnValue; - MyGPIO_Struct_TypeDef gpioB8_test = {GPIOB,8,In_PullDown}; - MyGPIO_Struct_TypeDef gpioB4_test = {GPIOB,4,Out_PullUp}; - MyGPIO_Init(&gpioB8_test); - returnValue = MyGPIO_Read(GPIOB,8); - MyGPIO_Init(&gpioB4_test); - MyGPIO_Set(GPIOB,4); - MyGPIO_Toggle(GPIOB,4); - MyGPIO_Toggle(GPIOB,4); - MyGPIO_Reset(GPIOB,4); + 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); do{ }while(1) ; diff --git a/ProjetsKEIL/Drivers/gpiodriver.c b/ProjetsKEIL/Drivers/gpiodriver.c index 49b8011..4d69645 100644 --- a/ProjetsKEIL/Drivers/gpiodriver.c +++ b/ProjetsKEIL/Drivers/gpiodriver.c @@ -35,14 +35,14 @@ void MyGPIO_Set(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin) void MyGPIO_Reset(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin) { - GPIO->BSRR = (1 << (GPIO_Pin+0x16)); //BRX = BSX+16 reset register + GPIO->BRR = (1 << GPIO_Pin); //BRX = BSX+16 reset register } void MyGPIO_Toggle(GPIO_TypeDef * GPIO, uint8_t GPIO_Pin) { if((GPIO->ODR = GPIO->ODR & (1 << GPIO_Pin)) > 0) { - GPIO->BSRR = (1 << (GPIO_Pin+0x16)); //reset + GPIO->BRR = (1 << GPIO_Pin); //reset } else { GPIO->BSRR = (1 << GPIO_Pin); //set } diff --git a/ProjetsKEIL/Drivers/gpiodriver.uvoptx b/ProjetsKEIL/Drivers/gpiodriver.uvoptx index 73aca3c..78cd3e0 100644 --- a/ProjetsKEIL/Drivers/gpiodriver.uvoptx +++ b/ProjetsKEIL/Drivers/gpiodriver.uvoptx @@ -75,7 +75,7 @@ 1 0 - 1 + 0 18 @@ -332,7 +332,7 @@ 1 0 - 0 + 1 18 @@ -414,25 +414,9 @@ 0 0 - 6 - 1 -
134218782
- 0 - 0 - 0 - 0 - 0 - 1 - .\Source\Principale.c - - \\cool_reel\Source/Principale.c\6 -
- - 1 - 0 10 1 -
134218808
+
134218772
0 0 0 @@ -443,6 +427,22 @@ \\cool_reel\Source/Principale.c\10
+ + 1 + 0 + 6 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\Source\Principale.c + + +
@@ -498,12 +498,6 @@ - - - System Viewer\GPIOB - 35905 - - 1 0