Skip to content

Commit 1b62c77

Browse files
committed
Add definition constants for adafruit boards
1 parent cbf63b9 commit 1b62c77

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

adafruit_avrprog.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,32 @@
5555
_FAST_CLOCK = 1000000
5656

5757
class AVRprog:
58+
class Boards:
59+
"""
60+
Some well known board definitions
61+
"""
62+
ATtiny85 = {
63+
'name': "ATtiny85",
64+
'sig': [0x1E, 0x93, 0x0B],
65+
'flash_size': 8192,
66+
'page_size': 64,
67+
'fuse_mask': (0xFF, 0xFF, 0x07, 0x3F)
68+
}
69+
ATmega328p = {
70+
'name': "ATmega328p",
71+
'sig': [0x1E, 0x95, 0x0F],
72+
'flash_size': 32768,
73+
'page_size': 128,
74+
'fuse_mask': (0xFF, 0xFF, 0x07, 0x3F),
75+
}
76+
ATmega2560 = {
77+
'name': "ATmega2560",
78+
'sig': [0x1E, 0x98, 0x01],
79+
'flash_size': 262144,
80+
'page_size': 256,
81+
'fuse_mask': (0xFF, 0xFF, 0x07, 0x3F)
82+
}
83+
5884
"""
5985
Helper class used to program AVR chips from CircuitPython.
6086
"""

examples/avrprog_program_mega2560.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
avrprog.init(spi, board.D5)
1919

2020
# Each chip has to have a definition so the script knows how to find it
21-
atmega2560 = {'name': "ATmega2560"}
22-
atmega2560['sig'] = [0x1E, 0x98, 0x01]
23-
atmega2560['flash_size'] = 262144
24-
atmega2560['page_size'] = 256
25-
atmega2560['fuse_mask'] = (0xFF, 0xFF, 0x07, 0x3F)
21+
atmega2560 = avrprog.Boards.ATmega2560
2622

2723
def error(err):
2824
""" Helper to print out errors for us and then halt """

examples/avrprog_program_trinket85.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
avrprog.init(spi, board.D5)
1919

2020
# Each chip has to have a definition so the script knows how to find it
21-
attiny85 = {'name': "ATtiny85"}
22-
attiny85['sig'] = [0x1E, 0x93, 0x0B]
23-
attiny85['flash_size'] = 8192
24-
attiny85['page_size'] = 64
25-
attiny85['fuse_mask'] = (0xFF, 0xFF, 0x07, 0x3F)
21+
attiny85 = avrprog.Boards.ATtiny85
2622

2723
def error(err):
2824
""" Helper to print out errors for us and then halt """

examples/avrprog_program_uno328.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@
2424
#pylint: enable-msg=no-member
2525

2626
# Each chip has to have a definition so the script knows how to find it
27-
atmega328p = {'name': "ATmega328P"}
28-
atmega328p['sig'] = [0x1E, 0x95, 0x0F]
29-
atmega328p['flash_size'] = 32768
30-
atmega328p['page_size'] = 128
31-
atmega328p['fuse_mask'] = (0xFF, 0xFF, 0x07, 0x3F)
27+
atmega328p = avrprog.Boards.ATmega328p
3228

3329
def error(err):
3430
""" Helper to print out errors for us and then halt """

0 commit comments

Comments
 (0)