diff options
author | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-01-26 18:26:26 +0100 |
---|---|---|
committer | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-01-26 18:26:26 +0100 |
commit | bc481107298791bf0efd984ecc53dc92b8719878 (patch) | |
tree | 332af7837f310af85b261611ed016e0e6312262c /Core/Src/led.c | |
parent | 816804c9c114e20d2231258cc346c3714590b9ea (diff) |
Insertion du projet dans sa totalité
Diffstat (limited to 'Core/Src/led.c')
-rw-r--r-- | Core/Src/led.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/Core/Src/led.c b/Core/Src/led.c deleted file mode 100644 index 1a5c58f..0000000 --- a/Core/Src/led.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * led.c - * - * Created on: 2 déc. 2020 - * Author: root - */ - -#include "led.h" - -void Led_init(LED_TypeDef *led, GPIO_TypeDef * port, uint16_t pn){ -led->gpioPort=port; -led->pin=pn; - -//Activation de l'horloge sur le port en question - -//déterminer le numéro du port 0--> GPIOA, 1-->GPIOB, etc. -uint8_t nb_port; -nb_port=(uint32_t)((uint32_t *)port - IOPPERIPH_BASE)/ (uint32_t)0x400; -//activation de l'hologe -RCC->IOPENR|=1<<nb_port; - -//configuration de la pin en sortie -led->gpioPort->MODER&=~(0b11<<2*pn); -led->gpioPort->MODER|=(0b01<<2*pn); -} - -uint8_t Led_isOn(LED_TypeDef *led){ -return ((led->gpioPort->ODR&(1<<led->pin))!=0); -} - -uint8_t Led_isOff(LED_TypeDef *led){ -return ((led->gpioPort->ODR&(1<<led->pin))==0); -} -void Led_turnOn(LED_TypeDef *led){ -led->gpioPort->ODR|=(1<<led->pin); -} - -void Led_turnOff(LED_TypeDef *led){ -led->gpioPort->ODR&=~(1<<led->pin); -} - -void Led_toggle(LED_TypeDef *led){ - led->gpioPort->ODR^=(1<<led->pin); -} |