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, (LED1,port), on );
hw( configure, LED1,
mode, digital_output,
frequency, lowest );
for(;;) {
hw( toggle, LED1 );
}
}
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
LED1
#define LED1
X.
Definition: bluepill.h:56
hw_waste_cycles
#define hw_waste_cycles(n)
Definition: hwa_2.h:98