mwf_common
mwf common definitions
This is a simplified C++ class for handling microcontroller peripheral procedures.
Pre-defined objects are available (e.g., mwf::the_i2c0
for I2C0), and you access their functions through these objects. The pre-defined objects are smart pointers using std::unique_ptr<>
, and their actual instances are created upon first initialization.
This library’s pre-defined objects include procedures for before and after sleep, allowing you to perform pre-sleep and wake-up processing in a single step.
Many peripherals have integrated initialization and other procedures. This library manages them as class objects, from their creation to their destruction.
All class objects are smart pointers using std::unique_ptr<>
. Before an object is created, it’s a nullptr
, so no access is possible (it will likely cause a hang-up from a null pointer access). Always check for nullptr
before using an object.
if (the_adc) { // Check for nullptr first
the_adc->enable((1UL << 0) | (1UL << 1));
the_adc->start();
}
Object Name | Description |
---|---|
the_adc | Use the Analog-to-Digital Converter (ADC) |
the_gpio | Use General Purpose IO (GPIO) interrupts. (The class object is not used if you don’t need interrupts) |
the_i2c0 | Use the I2C bus. (I2C0 only) |
the_ntag | Use the EEPROM for NTAG |
the_pwm[0..9] | Use PWM0..9 |
the_rng | Random number generation library |
the_spi1 | Use the SPI bus (SPI1 only) |
the_wtimer | Use the wake-up timer |
the_wwdt | Use the watchdog timer |
Object Name | Description |
---|---|
mwf_common | Common definitions, base class definitions for peripheral objects |
mwf_periph_common | Common definitions, procedures for pin operations |
mwf_periph_adc | Procedures for using the ADC |
mwf_periph_gint | General Purpose IO (GPIO) interrupts |
mwf_periph_i2c | Use the I2C bus. (I2C0 only) |
mwf_periph_ntag | Use the EEPROM for NTAG |
mwf_periph_pwm | Use PWM0..9 |
mwf_periph_rng | Random number generation library |
mwf_periph_spi | Use the SPI bus (SPI1 only) |
mwf_periph_wtimer | Use the wake-up timer |
mwf_periph_wwdt | Use the watchdog timer |
In principle, classes and functions are defined within the following namespaces:
mwf::
mwf::periph::
mwf common definitions
mwf_periph_common - Peripheral common
mwf_periph_adc - ADC
mwf_periph_gint - GINT(GPIO)
mwf_periph_i2c - I2C
mwf_periph_ntag - NTAG
mwf_periph_pwm - PWM, Timer
mwf_periph_rng - TRNG
mwf_periph_spi - SPI
mwf_periph_wtimer - WTIMER, FRWT
mwf_periph_wwdt - WWDT
class tick_counter - Stop Watch
mwf-utils - utils