HWA
Bare metal programming with style
Class _tm23a: 23-bit timer

A class _tm23a object is a 23-bit timer.

It is used in:

Configuration

hwa( configure, timer0,
// Clock source
//
[ clock, apb // APB clock
| apb / 1 // APB clock
| 16 // APB clock divided by 16
| 256, ] // APB clock divided by 256
// Counting mode
//
[ direction, stop // Stop
| down // Count down to 0 and stop
| down_loop, ] // Count down to 0 and reload
// Class _tm23a timers all count from top down to 0
//
[ bottom, 0, ]
// The value the counter loads after 0 is reached
//
[ top, VALUE, ] // VALUE: 0 .. 0x7FFFFF
// Action triggered after 0 is reached
//
[ action, none
| irq
| nmi ] );

Count

The read instruction returns the content of the counting register:

uint32_t count = hw( read, timer0 );

The hw_write() instruction sets the content of the counting register:

hw( write, timer0, VALUE );
hwa
#define hwa(...)
hwa( action, object [,...] ) stores an action for an object into a HWA context.
Definition: hwa_macros.h:552
hw
#define hw(...)
hw( action, object [,...] ) executes an action immediately on an object.
Definition: hwa_macros.h:523