From ed6e3c6a5ed9af3cf31e0ef057289954bfd90452 Mon Sep 17 00:00:00 2001 From: Esraa1Moshsen Date: Fri, 3 May 2019 21:00:59 +0200 Subject: [PATCH] updated #7 --- Tivac2/pushButton_Init.c | 17 +++++++++++++++++ Tivac2/push_buttons.c | 12 ------------ Tivac2/push_buttons.h | 10 +++++++--- 3 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 Tivac2/pushButton_Init.c delete mode 100644 Tivac2/push_buttons.c diff --git a/Tivac2/pushButton_Init.c b/Tivac2/pushButton_Init.c new file mode 100644 index 0000000..bd57a0b --- /dev/null +++ b/Tivac2/pushButton_Init.c @@ -0,0 +1,17 @@ +#include "lcd.h" + +void pushButtons_Init (void) +{ +void Port_Init (PF); +void Port_SetPinDirection (PF, PF_pins_mask, PORT_PIN_IN); +void Port_AnalogOrDigital (PF,PF_pins_mask, 1); +void Port_AlternateFunction (PF, PF_pins_mask, 0, PCTL_pins_mask); +void Port_SetPinPullUp (PF, PF_pins_mask, 1); + GPIO_PORTF_IS_R &= ~GPIO_PF4_0_M; + GPIO_PORTF_IBE_R &= ~GPIO_PF4_0_M; + GPIO_PORTF_IEV_R &= ~GPIO_PF4_0_M; + GPIO_PORTF_ICR_R |= GPIO_PF4_0_M; + GPIO_PORTF_IM_R |= GPIO_PF4_0_M; + NVIC_PRI7_R = (NVIC_PRI7_R & 0xFF00FFFF) | (GPIO_PF4_0_PRI << 21); // PRI7 bits 23:21 + NVIC_EN0_R |= (1 << 30); // EN0 bit 30 +} \ No newline at end of file diff --git a/Tivac2/push_buttons.c b/Tivac2/push_buttons.c deleted file mode 100644 index 3a1e1ed..0000000 --- a/Tivac2/push_buttons.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "lcd.h" -void pushButtons_Init (void) -{ - void Port_Init (PF); - void Port_SetPinDirection (PF, 0x11, PORT_PIN_IN); - void Port_AnalogOrDigital (PF,0x11, 1); - void Port_AlternateFunction (PF, 0x11, 0, 0x00); - void Port_SetPinPullUp (PF, 0x11, 1); - - -} -#endif \ No newline at end of file diff --git a/Tivac2/push_buttons.h b/Tivac2/push_buttons.h index ffd656d..877a9ee 100644 --- a/Tivac2/push_buttons.h +++ b/Tivac2/push_buttons.h @@ -2,7 +2,11 @@ #define PushB_H_ #include "tm4c123gh6pm.h" -#include "std_types.h" +#include #include "lcd.h" - -void pushButtons_Init (void); \ No newline at end of file +#define PF_pins_mask 0x11 +#define PCTL_pins_mask 0x00 +#define GPIO_PF4_0_M 0x11 +#define GPIO_PF4_0_PRI 2 +void pushButtons_Init (void); +#endif