-
-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from cyberman54/development
v1.6.0
- Loading branch information
Showing
26 changed files
with
361 additions
and
334 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
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,7 +1,8 @@ | ||
#ifndef _BUTTON_H | ||
#define _BUTTON_H | ||
|
||
void IRAM_ATTR ButtonIRQ(void); | ||
void readButton(void); | ||
#include "senddata.h" | ||
|
||
void readButton(); | ||
|
||
#endif |
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
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,74 @@ | ||
#include "irqhandler.h" | ||
|
||
// Local logging tag | ||
static const char TAG[] = "main"; | ||
|
||
// irq handler task, handles all our application level interrupts | ||
void irqHandler(void *pvParameters) { | ||
|
||
configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check | ||
|
||
uint32_t InterruptStatus; | ||
|
||
// task remains in blocked state until it is notified by an irq | ||
for (;;) { | ||
xTaskNotifyWait( | ||
0x00, // Don't clear any bits on entry | ||
ULONG_MAX, // Clear all bits on exit | ||
&InterruptStatus, // Receives the notification value | ||
portMAX_DELAY); // wait forever (missing error handling here...) | ||
|
||
// button pressed? | ||
#ifdef HAS_BUTTON | ||
if (InterruptStatus & BUTTON_IRQ) | ||
readButton(); | ||
#endif | ||
|
||
// display needs refresh? | ||
#ifdef HAS_DISPLAY | ||
if (InterruptStatus & DISPLAY_IRQ) | ||
refreshtheDisplay(); | ||
#endif | ||
|
||
// are cyclic tasks due? | ||
if (InterruptStatus & CYCLIC_IRQ) | ||
doHousekeeping(); | ||
|
||
// is time to send the payload? | ||
if (InterruptStatus & SENDPAYLOAD_IRQ) | ||
sendPayload(); | ||
} | ||
vTaskDelete(NULL); // shoud never be reached | ||
} | ||
|
||
// esp32 hardware timer triggered interrupt service routines | ||
// they notify the irq handler task | ||
|
||
void IRAM_ATTR ChannelSwitchIRQ() { | ||
xTaskNotifyGive(wifiSwitchTask); | ||
portYIELD_FROM_ISR(); | ||
} | ||
|
||
void IRAM_ATTR homeCycleIRQ() { | ||
xTaskNotifyFromISR(irqHandlerTask, CYCLIC_IRQ, eSetBits, NULL); | ||
portYIELD_FROM_ISR(); | ||
} | ||
|
||
void IRAM_ATTR SendCycleIRQ() { | ||
xTaskNotifyFromISR(irqHandlerTask, SENDPAYLOAD_IRQ, eSetBits, NULL); | ||
portYIELD_FROM_ISR(); | ||
} | ||
|
||
#ifdef HAS_DISPLAY | ||
void IRAM_ATTR DisplayIRQ() { | ||
xTaskNotifyFromISR(irqHandlerTask, DISPLAY_IRQ, eSetBits, NULL); | ||
portYIELD_FROM_ISR(); | ||
} | ||
#endif | ||
|
||
#ifdef HAS_BUTTON | ||
void IRAM_ATTR ButtonIRQ() { | ||
xTaskNotifyFromISR(irqHandlerTask, BUTTON_IRQ, eSetBits, NULL); | ||
portYIELD_FROM_ISR(); | ||
} | ||
#endif |
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,28 @@ | ||
#ifndef _IRQHANDLER_H | ||
#define _IRQHANDLER_H | ||
|
||
#define DISPLAY_IRQ 0x01 | ||
#define BUTTON_IRQ 0x02 | ||
#define SENDPAYLOAD_IRQ 0x04 | ||
#define CYCLIC_IRQ 0x08 | ||
|
||
#include "globals.h" | ||
#include "cyclic.h" | ||
#include "senddata.h" | ||
|
||
void irqHandler(void *pvParameters); | ||
void IRAM_ATTR ChannelSwitchIRQ(); | ||
void IRAM_ATTR homeCycleIRQ(); | ||
void IRAM_ATTR SendCycleIRQ(); | ||
|
||
#ifdef HAS_DISPLAY | ||
#include "display.h" | ||
void IRAM_ATTR DisplayIRQ(); | ||
#endif | ||
|
||
#ifdef HAS_BUTTON | ||
#include "button.h" | ||
void IRAM_ATTR ButtonIRQ(); | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.