HWA
Bare metal programming with style
Class _oca: 8-bit compare unit with waveform generator

This class is used by:

Relatives

Interrupts

Actions



hw( configure, ... ) only permits to change the behavior of the output pin and does not perform any verification against the counter configuration:

hw( configure, (counter0,compare0),
// Behavior of the ouput pin
//
output, disconnected
| toggle_after_match
| clear_after_match
| set_after_match
| set_at_bottom_clear_after_match
| clear_at_bottom_set_after_match
| clear_after_match_up_set_after_match_down
| set_after_match_up_clear_after_match_down
);



hwa( configure, ... ) allows the update parameter to be set. It tells when the compare value is transferred from the latch register to the compare register. This is used to complete and check the configuration of the related counter when the hwa(commit) instruction is encountered:

hwa( configure, (counter0,compare0),
// When the content of the compare register is latched
//
[ update, after_bottom
| after_top
| after_max, ]
// Behavior of the ouput pin
//
[ output, disconnected
| toggle_after_match
| clear_after_match
| set_after_match
| set_at_bottom_clear_after_match
| clear_at_bottom_set_after_match
| clear_after_match_up_set_after_match_down
| set_after_match_up_clear_after_match_down ]
);



hw( read, ... ): get the compare value

uint8_t ocr = hw( read, (counter0,compare0) );



hw( write, ... ), hwa( write, ... ): set the compare value

hw( write, (counter0,compare0), value );
hwa( write, (counter0,compare0), value );



hw( trigger, ... ), hwa( trigger, ... ): force a compare-match

hw( trigger, (counter0,compare0) );
hwa( trigger, (counter0,compare0) );

Registers

Registers are hold by the parent counter.

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