Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
bmptk::hardware::invert< pin_or_port > Class Template Reference

invert the polarity of a pin or port More...

#include <pins.h>

Inheritance diagram for bmptk::hardware::invert< pin_or_port >:

Detailed Description

template<typename pin_or_port>
class bmptk::hardware::invert< pin_or_port >

invert the polarity of a pin or port

This class template is used to create a pin or port class based on an underlying pin or port class. The created pin or port behaves the same as the underlying pin or port, except that any value written (set()) to the created pin or port is inverted (true becomes false, false becomes true) before it is written to the underlying pin or port, and any value that is read (get()) is likewise inverted before it is returned.

The typename template argument must be a pin or port class. The created pin or port is of the same flavour.

Example (examples/db103/wiggle/main.cpp):

// show a 'wiggle' pattern (= alternating 0xAAA and 0x555) on 12 LEDs
#include "bmptk.h"
bmptk::target::gpio_0_4,
bmptk::target::gpio_0_6,
bmptk::target::gpio_1_0,
bmptk::target::gpio_1_2,
bmptk::target::gpio_1_4,
bmptk::target::gpio_1_8,
> leds;
int main( void ){
bmptk::hardware::blink< leds >();
}

This examples creates a display that alternatively lights the even and then the odd numbered LEDs. This is achieved by feeding the odd numbered LEDs the inverted signal.

Definition at line 540 of file pins.h.


The documentation for this class was generated from the following file: