HWA
Bare metal programming with style
hwa/st/stm32/examples/01-1-blink/main.c
Blink a LED using a software loop

This program enables the LED port, configures the LED pin as a digital output, then in an infinite loop it toggles the LED state and waits for half the period to be elapsed.

make run to try the program. The LED should blink.

Symbols:

main.c
/* This file is part of the HWA project.
* Copyright (c) 2017 Christophe Duparquet.
* All rights reserved. Read LICENSE.TXT for details.
*/
#include BOARD_H
#define PERIOD 0.5
int main ( )
{
hw( power, (LED,port), on );
hw( configure, LED,
mode, digital_output,
frequency, lowest );
for(;;) {
hw( toggle, LED );
}
}
HW_DEVICE_HSIHZ
#define HW_DEVICE_HSIHZ
Definition: stm32f103.h:82
hw
#define hw(...)
hw( action, object [,...] ) executes an action immediately on an object.
Definition: hwa_macros.h:523
LED
#define LED
X.
Definition: bluepill.h:55
hw_waste_cycles
#define hw_waste_cycles(n)
Definition: hwa_2.h:98