/      日本語

TWENETmwf - Peripheral C++ Library

A library for handling microcontroller peripherals
This is a simplified C++ class for handling microcontroller peripheral procedures.

TWENETmwf - Peripheral C++ Library

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.

About Peripheral Objects

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();
   }

Pre-defined Peripheral Class Objects

Object NameDescription
the_adcUse the Analog-to-Digital Converter (ADC)
the_gpioUse General Purpose IO (GPIO) interrupts. (The class object is not used if you don’t need interrupts)
the_i2c0Use the I2C bus. (I2C0 only)
the_ntagUse the EEPROM for NTAG
the_pwm[0..9]Use PWM0..9
the_rngRandom number generation library
the_spi1Use the SPI bus (SPI1 only)
the_wtimerUse the wake-up timer
the_wwdtUse the watchdog timer

About the Libraries

Object NameDescription
mwf_commonCommon definitions, base class definitions for peripheral objects
mwf_periph_commonCommon definitions, procedures for pin operations
mwf_periph_adcProcedures for using the ADC
mwf_periph_gintGeneral Purpose IO (GPIO) interrupts
mwf_periph_i2cUse the I2C bus. (I2C0 only)
mwf_periph_ntagUse the EEPROM for NTAG
mwf_periph_pwmUse PWM0..9
mwf_periph_rngRandom number generation library
mwf_periph_spiUse the SPI bus (SPI1 only)
mwf_periph_wtimerUse the wake-up timer
mwf_periph_wwdtUse the watchdog timer

About Namespaces

In principle, classes and functions are defined within the following namespaces:

  • mwf::
  • mwf::periph::

mwf_common

mwf common definitions

mwf_periph_common - Peripheral common

mwf_periph_common - Peripheral common

mwf_periph_adc - ADC

mwf_periph_adc - ADC

mwf_periph_gint - GINT(GPIO)

mwf_periph_gint - GINT(GPIO)

mwf_periph_i2c - I2C

mwf_periph_i2c - I2C

mwf_periph_ntag - NTAG

mwf_periph_ntag - NTAG

mwf_periph_pwm - PWM, Timer

mwf_periph_pwm - PWM, Timer

mwf_periph_rng - TRNG

mwf_periph_rng - TRNG

mwf_periph_spi - SPI

mwf_periph_spi - SPI

mwf_periph_wtimer - WTIMER, FRWT

mwf_periph_wtimer - WTIMER, FRWT

mwf_periph_wwdt - WWDT

mwf_periph_wwdt - WWDT

class tick_counter - Stop Watch

class tick_counter - Stop Watch

mwf-utils - utils

mwf-utils - utils