mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-27 21:16:50 +03:00
true interrupt enable and disable
plus expose cycle count for bit bang timing
This commit is contained in:
parent
7defe70d55
commit
c328452651
@ -124,8 +124,11 @@ void timer1_write(uint32_t ticks); //maximum ticks 8388607
|
|||||||
void ets_intr_lock();
|
void ets_intr_lock();
|
||||||
void ets_intr_unlock();
|
void ets_intr_unlock();
|
||||||
|
|
||||||
#define interrupts() ets_intr_unlock();
|
void xt_enable_interrupts();
|
||||||
#define noInterrupts() ets_intr_lock();
|
void xt_disable_interrupts();
|
||||||
|
|
||||||
|
#define interrupts() xt_enable_interrupts();
|
||||||
|
#define noInterrupts() xt_disable_interrupts();
|
||||||
|
|
||||||
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
|
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
|
||||||
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
|
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
|
||||||
|
@ -95,8 +95,16 @@ class EspClass {
|
|||||||
FlashMode_t getFlashChipMode(void);
|
FlashMode_t getFlashChipMode(void);
|
||||||
uint32_t getFlashChipSizeByChipId(void);
|
uint32_t getFlashChipSizeByChipId(void);
|
||||||
|
|
||||||
|
inline uint32_t getCycleCount(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint32_t EspClass::getCycleCount(void)
|
||||||
|
{
|
||||||
|
uint32_t ccount;
|
||||||
|
__asm__ __volatile__("rsr %0,ccount":"=a" (ccount));
|
||||||
|
return ccount;
|
||||||
|
}
|
||||||
|
|
||||||
extern EspClass ESP;
|
extern EspClass ESP;
|
||||||
|
|
||||||
#endif //ESP_H
|
#endif //ESP_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user