# ${obj.name} Device

- Generated with MrT Device Utility
- Bus: ${obj.bus}
- RegMap: Register Map %if not obj.datasheet == '':
- Datasheet: ${obj.datasheet[:24] + (obj.datasheet[24:] and '...')}
%endif %if not obj.digikey_pn == '':
- DigiKey: ${obj.digikey_pn}
%endif %if "I2C" in obj.bus.upper():
- I2C Address: ${ obj.formatHex(obj.i2c_addr, 1)}
%endif

## Description:

${obj.desc}

## Register Map

Name | Address | Type | Access | Default | Description
--- | --- | --- | --- | --- | ---
%for key,reg in obj.regs.items():
${reg.name} | ${reg.printAddr()} | ${reg.type} | ${reg.perm.upper()} | ${reg.formatHex(reg.default)} | ${reg.desc}
%endfor

## Registers

%for key,reg in obj.regs.items():

## ${reg.name}

- Address: [${reg.printAddr()}]
%if reg.hasDefault:
- Default: [${reg.formatHex(reg.default)}]
%endif

${reg.desc}

bit %for i in range(reg.size * 8): | ${(reg.size*8) -(i+1)} %endfor
--- | ---
Field ${reg.printFieldMap()}
%if reg.hasDefault:
Default %for i in range(reg.size * 8): %if reg.default & (1 << ((reg.size * 8) -(i+1))): | 1 %else: | 0 %endif %endfor
%endif

%if reg.hasFlags:

## Flags:

%for field in reg.fields: %if field.isFlag: ${field.name}: ${field.desc}
%endif %endfor %endif %if reg.hasFields:

## Fields:

%for field in reg.fields: %if not field.isFlag: ${field.name}: ${field.desc} %if len(field.vals) > 0:

%for val in field.vals:
${val.name} | ${val.formatVal()} | ${val.desc}
%endfor

%endif %endif %endfor %endif %endfor