@@ -103,23 +103,23 @@ class Twi
103
103
ETSTimer timer;
104
104
105
105
// Event/IRQ callbacks, so they can't use "this" and need to be static
106
- static void ICACHE_RAM_ATTR onSclChange (void );
107
- static void ICACHE_RAM_ATTR onSdaChange (void );
106
+ static void IRAM_ATTR onSclChange (void );
107
+ static void IRAM_ATTR onSdaChange (void );
108
108
static void eventTask (ETSEvent *e);
109
- static void ICACHE_RAM_ATTR onTimer (void *unused);
109
+ static void IRAM_ATTR onTimer (void *unused);
110
110
111
111
// Allow not linking in the slave code if there is no call to setAddress
112
112
bool _slaveEnabled = false ;
113
113
114
114
// Internal use functions
115
- void ICACHE_RAM_ATTR busywait (unsigned int v);
115
+ void IRAM_ATTR busywait (unsigned int v);
116
116
bool write_start (void );
117
117
bool write_stop (void );
118
118
bool write_bit (bool bit);
119
119
bool read_bit (void );
120
120
bool write_byte (unsigned char byte);
121
121
unsigned char read_byte (bool nack);
122
- void ICACHE_RAM_ATTR onTwipEvent (uint8_t status);
122
+ void IRAM_ATTR onTwipEvent (uint8_t status);
123
123
124
124
// Handle the case where a slave needs to stretch the clock with a time-limited busy wait
125
125
inline void WAIT_CLOCK_STRETCH ()
@@ -149,8 +149,8 @@ class Twi
149
149
uint8_t transmit (const uint8_t * data, uint8_t length);
150
150
void attachSlaveRxEvent (void (*function)(uint8_t *, size_t ));
151
151
void attachSlaveTxEvent (void (*function)(void ));
152
- void ICACHE_RAM_ATTR reply (uint8_t ack);
153
- void ICACHE_RAM_ATTR releaseBus (void );
152
+ void IRAM_ATTR reply (uint8_t ack);
153
+ void IRAM_ATTR releaseBus (void );
154
154
void enableSlave ();
155
155
};
156
156
@@ -229,7 +229,7 @@ void Twi::enableSlave()
229
229
}
230
230
}
231
231
232
- void ICACHE_RAM_ATTR Twi::busywait (unsigned int v)
232
+ void IRAM_ATTR Twi::busywait (unsigned int v)
233
233
{
234
234
unsigned int i;
235
235
for (i = 0 ; i < v; i++) // loop time is 5 machine cycles: 31.25ns @ 160MHz, 62.5ns @ 80MHz
@@ -472,9 +472,9 @@ void Twi::attachSlaveTxEvent(void (*function)(void))
472
472
}
473
473
474
474
// DO NOT INLINE, inlining reply() in combination with compiler optimizations causes function breakup into
475
- // parts and the ICACHE_RAM_ATTR isn't propagated correctly to all parts, which of course causes crashes.
475
+ // parts and the IRAM_ATTR isn't propagated correctly to all parts, which of course causes crashes.
476
476
// TODO: test with gcc 9.x and if it still fails, disable optimization with -fdisable-ipa-fnsplit
477
- void ICACHE_RAM_ATTR Twi::reply (uint8_t ack)
477
+ void IRAM_ATTR Twi::reply (uint8_t ack)
478
478
{
479
479
// transmit master read ready signal, with or without ack
480
480
if (ack)
@@ -492,7 +492,7 @@ void ICACHE_RAM_ATTR Twi::reply(uint8_t ack)
492
492
}
493
493
494
494
495
- void ICACHE_RAM_ATTR Twi::releaseBus (void )
495
+ void IRAM_ATTR Twi::releaseBus (void )
496
496
{
497
497
// release bus
498
498
// TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT);
@@ -505,7 +505,7 @@ void ICACHE_RAM_ATTR Twi::releaseBus(void)
505
505
}
506
506
507
507
508
- void ICACHE_RAM_ATTR Twi::onTwipEvent (uint8_t status)
508
+ void IRAM_ATTR Twi::onTwipEvent (uint8_t status)
509
509
{
510
510
twip_status = status;
511
511
switch (status)
@@ -612,7 +612,7 @@ void ICACHE_RAM_ATTR Twi::onTwipEvent(uint8_t status)
612
612
}
613
613
}
614
614
615
- void ICACHE_RAM_ATTR Twi::onTimer (void *unused)
615
+ void IRAM_ATTR Twi::onTimer (void *unused)
616
616
{
617
617
(void )unused;
618
618
twi.releaseBus ();
@@ -662,7 +662,7 @@ void Twi::eventTask(ETSEvent *e)
662
662
// Shorthand for if the state is any of the or'd bitmask x
663
663
#define IFSTATE (x ) if (twip_state_mask & (x))
664
664
665
- void ICACHE_RAM_ATTR Twi::onSclChange (void )
665
+ void IRAM_ATTR Twi::onSclChange (void )
666
666
{
667
667
unsigned int sda;
668
668
unsigned int scl;
@@ -860,7 +860,7 @@ void ICACHE_RAM_ATTR Twi::onSclChange(void)
860
860
}
861
861
}
862
862
863
- void ICACHE_RAM_ATTR Twi::onSdaChange (void )
863
+ void IRAM_ATTR Twi::onSdaChange (void )
864
864
{
865
865
unsigned int sda;
866
866
unsigned int scl;
0 commit comments