embello

Embedded software from JeeLabs

Embello Home Page
Hardware Documentation
Forth Library Documentation

HAL for STM32F4

The Hardware Abstraction Layer for STM32F4 microcontrollers defines utilities to make code more portable across several architecture variations.

API

: 168MHz ( -- )  \ set the main clock to 168 MHz, keep baud rate at 115200
: systick-hz ( u -- )  \ enable systick counter at given frequency
: micros ( -- n )  \ return elapsed microseconds, this wraps after some 2000s
: millis ( -- u )  \ return elapsed milliseconds, this wraps after 49 days
: us ( n -- )  \ microsecond delay using a busy loop, this won't switch tasks
: ms ( n -- )  \ millisecond delay, multi-tasker aware (may switch tasks!)
: list ( -- )  \ list all words in dictionary, short form
: chipid ( -- u1 u2 u3 3 )  \ unique chip ID as N values on the stack
: hwid ( -- u )  \ a "fairly unique" hardware ID as single 32-bit int
: flash-kb ( -- u )  \ return size of flash memory in KB

Variables

16000000 variable clock-hz  \ HSI is 16 MHz