code sanitization

This commit is contained in:
Klaus K Wilting 2018-10-04 22:59:02 +02:00
parent 30d22aa896
commit ae92bf377d
7 changed files with 22 additions and 11 deletions

View File

@ -3,7 +3,6 @@
#include "senddata.h" #include "senddata.h"
void IRAM_ATTR ButtonIRQ();
void readButton(); void readButton();
#endif #endif

View File

@ -5,7 +5,6 @@
#include "senddata.h" #include "senddata.h"
void doHousekeeping(void); void doHousekeeping(void);
void IRAM_ATTR homeCycleIRQ(void);
uint64_t uptime(void); uint64_t uptime(void);
void reset_counters(void); void reset_counters(void);
int redirect_log(const char *fmt, va_list args); int redirect_log(const char *fmt, va_list args);

View File

@ -9,6 +9,5 @@ extern HAS_DISPLAY u8x8;
void init_display(const char *Productname, const char *Version); void init_display(const char *Productname, const char *Version);
void refreshtheDisplay(void); void refreshtheDisplay(void);
void DisplayKey(const uint8_t *key, uint8_t len, bool lsb); void DisplayKey(const uint8_t *key, uint8_t len, bool lsb);
void IRAM_ATTR DisplayIRQ(void);
#endif #endif

View File

@ -1,10 +1,10 @@
#ifndef _IRQHANDLER_H #ifndef _IRQHANDLER_H
#define _IRQHANDLER_H #define _IRQHANDLER_H
#define DISPLAY_IRQ 0x01 #define DISPLAY_IRQ 0x01
#define BUTTON_IRQ 0x02 #define BUTTON_IRQ 0x02
#define SENDPAYLOAD_IRQ 0x04 #define SENDPAYLOAD_IRQ 0x04
#define CYCLIC_IRQ 0x08 #define CYCLIC_IRQ 0x08
#include "globals.h" #include "globals.h"
#include "cyclic.h" #include "cyclic.h"
@ -14,5 +14,14 @@
#include "senddata.h" #include "senddata.h"
void irqHandler(void *pvParameters); void irqHandler(void *pvParameters);
void IRAM_ATTR ChannelSwitchIRQ();
void IRAM_ATTR homeCycleIRQ();
void IRAM_ATTR SendCycleIRQ();
#ifdef HAS_DISPLAY
void IRAM_ATTR DisplayIRQ();
#endif
#ifdef HAS_BUTTON
void IRAM_ATTR ButtonIRQ();
#endif
#endif #endif

View File

@ -140,12 +140,10 @@ void setup() {
strcat_P(features, "PU"); strcat_P(features, "PU");
// install button interrupt (pullup mode) // install button interrupt (pullup mode)
pinMode(HAS_BUTTON, INPUT_PULLUP); pinMode(HAS_BUTTON, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), ButtonIRQ, RISING);
#else #else
strcat_P(features, "PD"); strcat_P(features, "PD");
// install button interrupt (pulldown mode) // install button interrupt (pulldown mode)
pinMode(HAS_BUTTON, INPUT_PULLDOWN); pinMode(HAS_BUTTON, INPUT_PULLDOWN);
attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), ButtonIRQ, FALLING);
#endif // BUTTON_PULLUP #endif // BUTTON_PULLUP
#endif // HAS_BUTTON #endif // HAS_BUTTON
@ -346,6 +344,15 @@ void setup() {
timerAlarmEnable(homeCycle); timerAlarmEnable(homeCycle);
timerAlarmEnable(channelSwitch); timerAlarmEnable(channelSwitch);
// start button interrupt
#ifdef HAS_BUTTON
#ifdef BUTTON_PULLUP
attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), ButtonIRQ, RISING);
#else
attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), ButtonIRQ, FALLING);
#endif
#endif // HAS_BUTTON
} // setup() } // setup()
void loop() { void loop() {

View File

@ -3,7 +3,6 @@
void SendData(uint8_t port); void SendData(uint8_t port);
void sendPayload(void); void sendPayload(void);
void IRAM_ATTR SendCycleIRQ(void);
void checkSendQueues(void); void checkSendQueues(void);
void flushQueues(); void flushQueues();

View File

@ -27,7 +27,6 @@ typedef struct {
void wifi_sniffer_init(void); void wifi_sniffer_init(void);
void IRAM_ATTR wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type); void IRAM_ATTR wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type);
void IRAM_ATTR ChannelSwitchIRQ(void);
void switchWifiChannel(void * parameter); void switchWifiChannel(void * parameter);
#endif #endif