A class _ioa
object is a single or a group of consecutive pins inside the same I/O port.
- Instructions that do not produce C code:
The hw_bn()
instruction returns the number of bits of an I/O definition:
#if (HW_ADDRESS((porta,3)) != -1) && (HW_BITS((porta,3)) != 1)
# HWA is damaged!
#endif
For a group of consecutive pins, the hw_bp()
instruction gives the position of the least significant bit:
#if (HW_ADDRESS((porta,3)) != -1) && (HW_POSITION((porta,3)) != 3)
# HWA is damaged!
#endif
Configuration
Actions
configure
:
hw |
hwa( configure, gpio0,
[ function, gpio, ]
[ mode, digital_input | digital_input_floating
| digital_input_pullup
| digital_input_pullup_when_awake
| digital_input_pullup_when_sleeping
| digital_output | digital_output_pushpull
| digital_output_when_awake | digital_output_pushpull_when_awake
| digital_output_when_sleeping | digital_output_pushpull_when_sleeping
| analog_input,
[ pullup, off
| when_awake
| when_sleeping
| on, ] );
hw |
hwa( configure, (porta,0),
function, ALTERNATE_FUNCTION );
State
The instruction read
returns the state of the I/O object:
uint8_t value =
hw( read, gpio0 );
write
:
hw( write, gpio0, value );
hwa( write, gpio0, value );
toggle
: