HWA
Bare metal programming with style
Class _icb: 16-bit capture unit

A class _icb object is a 16-bit capture unit. It has the following relative objects:

It is used in:

Instructions that do not produce C code

The HW_BITS() instruction returns the number of bits of the capture register:

#if HW_BITS( capture0 ) != 16
# error A 16-bit capture unit is required!
#endif
Interrupts

The capture unit can trigger an anonymous IRQ when a capture event occurs.

HW_ISR( capture0 )
{
// Process capture event
}

Actions


configure:

Note Currently, only edge configuration is implemented for the synchronous method.

hw( configure, capture0,
input, pin_icp, // NOT IMPLEMENTED YET
[ edge, falling
| rising, ]
[ filter, on // NOT IMPLEMENTED YET
| off ]
);
hwa( configure, capture0,
input, pin_icp, // FIXME: (pin,icp)
[ edge, falling
| rising, ]
[ filter, on
| off ] );


read:

uint16_t capture = hw( read, capture0 );


write:

hw( write, capture0, value );
hwa( write, capture0, value );

Status

The capture event flag can be accessed through interrupt-related instructions:

if ( hw( read,(counter0,capture0,irq) ) ) { // Read capture IRQ flag
hw( clear,(counter0,capture0,irq) ); // Clear capture IRQ flag
hw( disable,(counter0,capture0,irq) ); // Disable capture IRQs
}
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
HW_ISR
#define HW_ISR(...)
Definition: hwa_interrupts.h:80