Teste semf
Kontakt

LedBlinking

General

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

Initialization

For initializing you only need a output Gpio and a TimeBase object. Normally the Systick is used for this purpose.

#include "HardwareAbstraction/Stm32/stm32f4gpio.h"  
#include "HardwareAbstraction/Stm32/stm32f4systick.h"
#include "Components/System/timebase.h"
#include "Components/Output/ledblinking.h"
#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);

Usage

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

zurück zur Dokumentation