-
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.
⭐ ferat(GPIO_EXTI) extract int callbacks to a separate module
- Loading branch information
1 parent
5ed54dc
commit 2795200
Showing
9 changed files
with
124 additions
and
75 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
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
40 changes: 40 additions & 0 deletions
40
firmware/iot-risk-logger-stm32l4/app/core/gpio_ext_interrupts/gpio_ext_interrupts.c
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,40 @@ | ||
/*! | ||
* @file gpio_ext_interrupts.c | ||
* @brief implementation of gpio_ext_interrupts | ||
* | ||
* Detailed description of the implementation file. | ||
* | ||
* @date 07/10/2024 | ||
* @author artempolisskyi | ||
*/ | ||
|
||
#include "gpio_ext_interrupts.h" | ||
|
||
extern actor_t* ACTORS_LIST_SystemRegistry[MAX_ACTORS]; | ||
|
||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { | ||
if (GPIO_Pin == USB_VBUS_SENSE_Pin) { | ||
GPIO_PinState usbVBusPin = HAL_GPIO_ReadPin(USB_VBUS_SENSE_GPIO_Port, USB_VBUS_SENSE_Pin); | ||
osMessageQueueId_t evManagerQueue = ACTORS_LIST_SystemRegistry[EV_MANAGER_ACTOR_ID]->osMessageQueueId; | ||
|
||
if (usbVBusPin == GPIO_PIN_SET) { | ||
osMessageQueuePut(evManagerQueue, &(message_t) {USB_CONNECTED}, 0, 0); | ||
#if DEBUG | ||
fprintf(stdout, "USB connected\n"); | ||
#endif | ||
} else { | ||
osMessageQueuePut(evManagerQueue, &(message_t) {USB_DISCONNECTED}, 0, 0); | ||
#if DEBUG | ||
fprintf(stdout, "USB disconnected\n"); | ||
#endif | ||
} | ||
} | ||
|
||
// TODO maybe check only falling edge (configure in CubeMX) | ||
if (GPIO_Pin == _NFC_INT_Pin) { | ||
#ifdef DEBUG | ||
fprintf(stdout, "NFC GPO Interrupt\n"); | ||
#endif | ||
osMessageQueuePut(NFC_Actor.super.osMessageQueueId, &(message_t){NFC_GPO_INTERRUPT}, 0, 0); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
firmware/iot-risk-logger-stm32l4/app/core/gpio_ext_interrupts/gpio_ext_interrupts.h
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,27 @@ | ||
/*! | ||
* @file gpio_ext_interrupts.h | ||
* @brief Brief description of the file. | ||
* | ||
* Detailed description of the file. | ||
* | ||
* @date 07/10/2024 | ||
* @author artempolisskyi | ||
*/ | ||
|
||
#ifndef GPIO_EXT_INTERRUPTS_H | ||
#define GPIO_EXT_INTERRUPTS_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stdio.h> | ||
|
||
#include "main.h" | ||
|
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif //GPIO_EXT_INTERRUPTS_H |
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
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