HWA
Bare metal programming with style
|
A class _corea
object is a core of the device.
It is used in:
core0
core0
idle
: the SLEEP instruction makes the MCU enter Idle mode, stopping the CPU but allowing Analog Comparator, ADC, USI, Timer/Counter, Watchdog, and the interrupt system to continue oper- ating. This sleep mode basically halts clk CPU and clk FLASH , while allowing the other clocks to run. Idle mode enables the MCU to wake up from external triggered interrupts as well as internal ones like the Timer Overflow. If wake-up from the Analog Comparator interrupt is not required, the Analog Comparator can be powered down by setting the ACD bit in “ACSR – Analog Comparator Control and Status Register” on page 120. This will reduce power consumption in Idle mode. If the ADC is enabled, a conversion starts automatically when this mode is entered.adc_noise_reduction
: the SLEEP instruction makes the MCU enter ADC Noise Reduction mode, stopping the CPU but allowing the ADC, the external interrupts, and the Watchdog to continue operating (if enabled). This sleep mode halts clk I/O , clk CPU , and clk FLASH , while allowing the other clocks to run. This improves the noise environment for the ADC, enabling higher resolution measurements. If the ADC is enabled, a conversion starts automatically when this mode is entered. Apart form the ADC Conversion Complete interrupt, only an External Reset, a Watchdog Reset, a Brown-out Reset, an SPM/EEPROM ready interrupt, an external level interrupt on INT0 or a pin change interrupt can wake up the MCU from ADC Noise Reduction mode.power_down
: the oscillator is stopped, while the external interrupts, the USI start condition detection and the Watchdog continue operating (if enabled). Only an External Reset, a Watchdog Reset, a Brown-out Reset, USI start condition interupt, an external level interrupt on INT0 or a pin change interrupt can wake up the MCU. This sleep mode halts all generated clocks, allowing operation of asynchronous modules only.
hw( wait, irq ) puts the core into sleeping mode
stat
: returns the status flags of the core in a structure whose typename is given by the hw_stat_t()
instruction. Available flags are
porf
or reset_by_power_on
1 if reset was caused by power-onextrf
or reset_by_reset_pin
1 if reset was caused by external pin RESETborf
or reset_by_brown_out
1 if reset was caused by brown-out detectionwdrf
or reset_by_watchdog
1 if reset was caused by watchdog
clear
: