semf
LedBlinking

General

With the help of this class a led can easily pulse in a user specific time. It does this by using two semf modules, namely the semf::SoftwareTimer and the semf::Gpio module. The semf::SoftwareTimer module controls the pulse’s timing.

Initialization

To initialize it you only need an output Gpio and a semf::app::TimeBase object. Usually the Systick is used for this purpose.

#include "main.h"
semf::Stm32F4Gpio gpioLed(GPIOA, GPIO_PIN_1);
// Configure a timebase on basis of 1ms systick timer and enable it
semf::TimeBase timebase1ms(semf::Stm32F4Systick::instance(), true);
semf::LedBlinking led(gpioLed, timebase1ms, false);
Interface for a blinking led class.
Definition: ledblinking.h:22
A TimeBase is the bridge between e.g. a hardware timer (interrupt service routine) and TickReceiver o...
Definition: timebase.h:24

Usage

Plain text
// Generates a square-wave, with 100ms on time, and the same for off time.
led.setBlinking(100);
// or
// Generates a rectangular-wave, with 100ms on time, and the 200ms off time
led.setBlinking(100, 200);
// or
// Sets the led constant on
led.setOn();
// or
// Sets the led constant off
led.setOff();