Use IRAM_ATTR in place of ICACHE_RAM_ATTR

This commit is contained in:
Theo Arends 2021-04-02 17:14:08 +02:00
parent e3c1aa8836
commit 2350697815
16 changed files with 26 additions and 26 deletions

View File

@ -29,7 +29,7 @@ extern "C" {
#ifdef ESP8266
void ICACHE_RAM_ATTR callRxRead(void *self) { ((TasmotaSerial*)self)->rxRead(); };
void IRAM_ATTR callRxRead(void *self) { ((TasmotaSerial*)self)->rxRead(); };
// As the Arduino attachInterrupt has no parameter, lists of objects
// and callbacks corresponding to each possible GPIO pins have to be defined
@ -260,7 +260,7 @@ int TasmotaSerial::available(void) {
#define TM_SERIAL_WAIT_RCV { while (ESP.getCycleCount() < (wait + start)); wait += m_bit_time; }
#define TM_SERIAL_WAIT_RCV_LOOP { while (ESP.getCycleCount() < (wait + start)); }
void ICACHE_RAM_ATTR TasmotaSerial::_fast_write(uint8_t b) {
void IRAM_ATTR TasmotaSerial::_fast_write(uint8_t b) {
uint32_t wait = m_bit_time;
uint32_t start = ESP.getCycleCount();
// Start bit;
@ -316,7 +316,7 @@ size_t TasmotaSerial::write(uint8_t b) {
}
}
void ICACHE_RAM_ATTR TasmotaSerial::rxRead(void) {
void IRAM_ATTR TasmotaSerial::rxRead(void) {
if (!m_nwmode) {
int32_t loop_read = m_very_high_speed ? serial_buffer_size : 1;
// Advance the starting point for the samples but compensate for the

View File

@ -35,7 +35,7 @@ static unsigned long oswatch_last_loop_time;
uint8_t oswatch_blocked_loop = 0;
#ifndef USE_WS2812_DMA // Collides with Neopixelbus but solves exception
//void OsWatchTicker() ICACHE_RAM_ATTR;
//void OsWatchTicker() IRAM_ATTR;
#endif // USE_WS2812_DMA
#ifdef USE_KNX
@ -1320,8 +1320,8 @@ void DumpConvertTable(void) {
*/
#endif // ESP8266
int ICACHE_RAM_ATTR Pin(uint32_t gpio, uint32_t index = 0);
int ICACHE_RAM_ATTR Pin(uint32_t gpio, uint32_t index) {
int IRAM_ATTR Pin(uint32_t gpio, uint32_t index = 0);
int IRAM_ATTR Pin(uint32_t gpio, uint32_t index) {
uint16_t real_gpio = gpio << 5;
uint16_t mask = 0xFFE0;
if (index < GPIO_ANY) {

View File

@ -104,7 +104,7 @@ bool RotaryButtonPressed(uint32_t button_index) {
return false;
}
void ICACHE_RAM_ATTR RotaryIsrArgMiDesk(void *arg) {
void IRAM_ATTR RotaryIsrArgMiDesk(void *arg) {
tEncoder* encoder = static_cast<tEncoder*>(arg);
// https://github.com/PaulStoffregen/Encoder/blob/master/Encoder.h
@ -115,7 +115,7 @@ void ICACHE_RAM_ATTR RotaryIsrArgMiDesk(void *arg) {
encoder->state = (state >> 2);
}
void ICACHE_RAM_ATTR RotaryIsrArg(void *arg) {
void IRAM_ATTR RotaryIsrArg(void *arg) {
tEncoder* encoder = static_cast<tEncoder*>(arg);
// Theo Arends

View File

@ -194,7 +194,7 @@ void ZeroCrossMomentEnd(void) {
#endif
}
void ICACHE_RAM_ATTR ZeroCrossIsr(void) {
void IRAM_ATTR ZeroCrossIsr(void) {
uint32_t time = micros();
TasmotaGlobal.zc_interval = ((int32_t) (time - TasmotaGlobal.zc_time));
TasmotaGlobal.zc_time = time;

View File

@ -1345,7 +1345,7 @@ uint8_t pt_pin;
#define MPT_DEBOUNCE 10
void ICACHE_RAM_ATTR MP_Timer(void) {
void IRAM_ATTR MP_Timer(void) {
uint32_t level = digitalRead(pt_pin&0x3f);
uint32_t ms = millis();
uint32_t time;

View File

@ -46,7 +46,7 @@ struct ARILUX {
} Arilux;
#ifndef USE_WS2812_DMA // Collides with Neopixelbus but solves RF misses
void AriluxRfInterrupt(void) ICACHE_RAM_ATTR; // As iram is tight and it works this way too
void AriluxRfInterrupt(void) IRAM_ATTR; // As iram is tight and it works this way too
#endif // USE_WS2812_DMA
void AriluxRfInterrupt(void)

View File

@ -119,7 +119,7 @@ struct FTC532 {
const char ftc532_json[] PROGMEM = "\"FTC532\":{\"KEYS\":\"";
void ICACHE_RAM_ATTR ftc532_ISR(void) { // Hardware interrupt routine, triggers on rising edge
void IRAM_ATTR ftc532_ISR(void) { // Hardware interrupt routine, triggers on rising edge
uint32_t time = micros();
uint32_t time_diff = time - Ftc532.rxtime;
Ftc532.rxtime = time;

View File

@ -73,8 +73,8 @@ struct HLW {
// Fix core 2.5.x ISR not in IRAM Exception
#ifndef USE_WS2812_DMA // Collides with Neopixelbus but solves exception
void HlwCfInterrupt(void) ICACHE_RAM_ATTR;
void HlwCf1Interrupt(void) ICACHE_RAM_ATTR;
void HlwCfInterrupt(void) IRAM_ATTR;
void HlwCf1Interrupt(void) IRAM_ATTR;
#endif // USE_WS2812_DMA
void HlwCfInterrupt(void) // Service Power

View File

@ -61,7 +61,7 @@ struct AC_ZERO_CROSS_DIMMER {
} ac_zero_cross_dimmer;
#endif
void ICACHE_RAM_ATTR CounterIsrArg(void *arg) {
void IRAM_ATTR CounterIsrArg(void *arg) {
uint32_t index = *static_cast<uint8_t*>(arg);
uint32_t time = micros();

View File

@ -150,7 +150,7 @@ uint32_t tx2x_last_available = 0;
uint32_t tx23_stage = 0;
#endif // USE_TX23_WIND_SENSOR
void ICACHE_RAM_ATTR TX2xStartRead(void)
void IRAM_ATTR TX2xStartRead(void)
{
/**
* La Crosse TX20 Anemometer datagram every 2 seconds

View File

@ -2114,7 +2114,7 @@ struct SML_COUNTER {
uint8_t sml_counter_pinstate;
uint8_t sml_cnt_index[MAX_COUNTERS] = { 0, 1, 2, 3 };
void ICACHE_RAM_ATTR SML_CounterIsr(void *arg) {
void IRAM_ATTR SML_CounterIsr(void *arg) {
uint32_t index = *static_cast<uint8_t*>(arg);
uint32_t time = micros();

View File

@ -150,7 +150,7 @@ struct {
volatile uint32_t pulse = 0;
} as3935_sensor;
void ICACHE_RAM_ATTR AS3935Isr(void) {
void IRAM_ATTR AS3935Isr(void) {
as3935_sensor.detected = true;
as3935_sensor.icount++;
}
@ -176,7 +176,7 @@ void AS3935WriteRegister(uint8_t reg, uint8_t mask, uint8_t shift, uint8_t data)
/********************************************************************************************/
// Autotune Caps
void ICACHE_RAM_ATTR AS3935CountFreq(void) {
void IRAM_ATTR AS3935CountFreq(void) {
if (as3935_sensor.dispLCO)
as3935_sensor.pulse++;
}

View File

@ -72,7 +72,7 @@ struct WINDMETER {
#endif // USE_WINDMETER_NOSTATISTICS
} WindMeter;
void ICACHE_RAM_ATTR WindMeterUpdateSpeed(void)
void IRAM_ATTR WindMeterUpdateSpeed(void)
{
uint32_t time = micros();
uint32_t time_diff = time - WindMeter.counter_time;

View File

@ -157,7 +157,7 @@ void sns_opentherm_init_boiler_status()
sns_ot_boiler_status.m_boiler_temperature_read = 0;
}
void ICACHE_RAM_ATTR sns_opentherm_handleInterrupt()
void IRAM_ATTR sns_opentherm_handleInterrupt()
{
sns_ot_master->handleInterrupt();
}

View File

@ -42,7 +42,7 @@ void LMT01_Init(void) {
volatile int lmt01_pulseCount = 0;
void ICACHE_RAM_ATTR LMT01_countPulse(void) {
void IRAM_ATTR LMT01_countPulse(void) {
lmt01_pulseCount++;
}

View File

@ -147,22 +147,22 @@ volatile int Wiegand::currentFoundRFIDcount;
void ICACHE_RAM_ATTR Wiegand::ClearRFIDBuffer(int endIndex = WIEGAND_RFID_ARRAY_SIZE) {
void IRAM_ATTR Wiegand::ClearRFIDBuffer(int endIndex = WIEGAND_RFID_ARRAY_SIZE) {
currentFoundRFIDcount=WIEGAND_RFID_ARRAY_SIZE-endIndex; // clear all buffers
for (int i= 0; i < endIndex; i++) {
rfid_found[i].RFID=0;
rfid_found[i].bitCount=0;
}
}
void ICACHE_RAM_ATTR Wiegand::handleD1Interrupt() { // Receive a 1 bit. (D0=high & D1=low)
void IRAM_ATTR Wiegand::handleD1Interrupt() { // Receive a 1 bit. (D0=high & D1=low)
handleDxInterrupt(1);
}
void ICACHE_RAM_ATTR Wiegand::handleD0Interrupt() { // Receive a 0 bit. (D0=low & D1=high)
void IRAM_ATTR Wiegand::handleD0Interrupt() { // Receive a 0 bit. (D0=low & D1=high)
handleDxInterrupt(0);
}
void ICACHE_RAM_ATTR Wiegand::handleDxInterrupt(int in) {
void IRAM_ATTR Wiegand::handleDxInterrupt(int in) {
unsigned long curTime = micros(); // to be sure I will use micros() instead of millis() overflow is handle by using the minus operator to compare
unsigned long diffTime= curTime - lastFoundTime;
if ( (diffTime > CodeGapTime) && (bitCount > 0)) {