-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated button press interrupts to buttons driver
Migrated interrupts from main to drivers
- Loading branch information
Showing
8 changed files
with
74 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
Debug | ||
Startup | ||
*.launch | ||
*.launch | ||
.vscode/settings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "buttons.h" | ||
|
||
#include "board/timer.h" | ||
#include "board/rcc.h" | ||
#include "board/gpio.h" | ||
#include "board/iser.h" | ||
#include "board/exti.h" | ||
|
||
#include "pins.h" | ||
|
||
void init_buttons() { | ||
SET(RCC_AHB2ENR, GPIOAEN); | ||
SET(RCC_AHB2ENR, GPIOCEN); | ||
|
||
SET_BITS(GPIOA->MODER, JOY_BTN * 2, INPUT_MODE, 2); | ||
SET_BITS(GPIOA->PUPDR, JOY_BTN * 2, PULLUP, 2); | ||
|
||
SET_BITS(GPIOC->MODER, BLUE_BTN * 2, INPUT_MODE, 2); | ||
SET_BITS(GPIOC->PUPDR, BLUE_BTN * 2, PULLDOWN, 2); | ||
|
||
EXTI->EXTISR[JOY_BTN] = 0; | ||
SET(EXTI->IMR1, JOY_BTN); | ||
SET(EXTI->FTSR1, JOY_BTN); | ||
SET(ISER0, 11 + JOY_BTN); | ||
|
||
EXTI->EXTISR[BLUE_BTN] = 2; | ||
SET(EXTI->IMR1, BLUE_BTN); | ||
SET(EXTI->RTSR1, BLUE_BTN); | ||
SET(ISER0, 11 + BLUE_BTN); | ||
} | ||
|
||
//Depends on the value of JOY_BTN | ||
void EXTI6_IRQHandler() { | ||
joystick_button_handler(); | ||
SET(EXTI->FPR1, JOY_BTN); | ||
} | ||
|
||
//Depends on the value of BLUE_BTN | ||
void EXTI13_IRQHandler() { | ||
blue_button_handler(); | ||
SET(EXTI->RPR1, BLUE_BTN); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
void init_buttons(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters