mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
avr: initial implementation for PWM
Signed-off-by: Ron Evans <ron@hybridgroup.com> Edited slightly by Ayke van Laethem
This commit is contained in:
committed by
Ayke van Laethem
parent
94358959f5
commit
fc0ff3a987
+16
-4
@@ -183,10 +183,22 @@ const (
|
||||
out.write(': {description}'.format(**register))
|
||||
out.write('\n')
|
||||
for bitfield in register['bitfields']:
|
||||
out.write('\t{name} = 0x{value:x}'.format(**bitfield))
|
||||
if bitfield['description']:
|
||||
out.write(' // {description}'.format(**bitfield))
|
||||
out.write('\n')
|
||||
name = bitfield['name']
|
||||
value = bitfield['value']
|
||||
if '{:08b}'.format(value).count('1') == 1:
|
||||
out.write('\t{name} = 0x{value:x}'.format(**bitfield))
|
||||
if bitfield['description']:
|
||||
out.write(' // {description}'.format(**bitfield))
|
||||
out.write('\n')
|
||||
else:
|
||||
n = 0
|
||||
for i in range(8):
|
||||
if (value >> i) & 1 == 0: continue
|
||||
out.write('\t{}{} = 0x{:x}'.format(name, n, 1 << i))
|
||||
if bitfield['description']:
|
||||
out.write(' // {description}'.format(**bitfield))
|
||||
n += 1
|
||||
out.write('\n')
|
||||
out.write(')\n')
|
||||
|
||||
def writeLD(outdir, device):
|
||||
|
||||
Reference in New Issue
Block a user