Generated Header Contents

Bit-fiddling Field Macros

Each field is accompanied by several -define macros. These allow register fields to be manipulated using bitwise boolean operations.

The macro names are prefixed such that their definitions will not collide with other fields of the same name.

FIELD_NAME_bm

Field bit-mask.

All bits of a register that belong to this field are set to 1. Useful for bitwise setting/clearing or masking a field’s value.

FIELD_NAME_bp

Field bit position.

Offset of the low-bit of the field. Useful for bit-shifting values into and out of the field.

FIELD_NAME_bw

Field bit width.

Width of the field in bits.

FIELD_NAME_reset

Field reset value.

Only emitted if a field definition provides a constant reset value.

Register bit-field records

Each register is represented by a record definition. This allows a register value to be accessed in aggregate, or by its individual bit-fields.

Important

The packing order of bit-fields is implementation-defined and may not be the same depending on the compiler or target architecture you use. In order to enable bit-field generation, you need to explicitly specify which bit packing order of your compiler: Low-to-high (LTOH) or High-to-low (HTOL)

LTOH is generally more common, but always be sure to verify. Running the generated testcase on your target is an easy way to confirm.

The register record contains all register members.