add atmega328 support
This commit is contained in:
parent
eedf674bfa
commit
e59b4996b2
4 changed files with 1269 additions and 2262 deletions
26
atmega328pins.csv
Normal file
26
atmega328pins.csv
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
GPIO,ADC,Other,PWM
|
||||
PD0,,RX,
|
||||
PD1,,TX,
|
||||
PD2,,INT0,
|
||||
PD3,,INT1,OC2B
|
||||
PD4,,,
|
||||
PD5,,,OC0B
|
||||
PD6,,,OC0A
|
||||
PD7,,,
|
||||
PB0,,,
|
||||
PB1,,,OC1A
|
||||
PB2,,SS,OC1B
|
||||
PB3,,MOSI,OC2A
|
||||
PB4,,MISO,
|
||||
PB5,,SCK,
|
||||
PC0,A0,,
|
||||
PC1,A1,,
|
||||
PC2,A2,,
|
||||
PC3,A3,,
|
||||
PC4,A4,SDA,
|
||||
PC5,A5,SCL,
|
||||
A6,A6,,
|
||||
A7,A7,,
|
||||
,,,
|
||||
,,,
|
||||
DESCRIPTION,,,
|
||||
|
3463
output.svg
3463
output.svg
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 92 KiB |
40
parser.py
40
parser.py
|
|
@ -192,6 +192,33 @@ def get_arduino_mapping(connections, variantfolder):
|
|||
if not variantfolder:
|
||||
return connections
|
||||
|
||||
# special case of very early chips
|
||||
if "atmega328" in variantfolder:
|
||||
pinmap = ["PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7",
|
||||
"PB0", "PB1", "PB2", "PB3", "PB4", "PB5",
|
||||
"PC0", "PC1", "PC2", "PC3", "PC4", "PC5"]
|
||||
|
||||
for conn in connections:
|
||||
print(conn['name'])
|
||||
# digital pins
|
||||
matches = re.match(r'(IO|D)([0-9]+)', conn['name'])
|
||||
if matches:
|
||||
digitalname = matches.group(2)
|
||||
conn['pinname'] = pinmap[int(digitalname)]
|
||||
conn['arduinopin'] = digitalname
|
||||
longest_arduinopin = max(longest_arduinopin, len(digitalname))
|
||||
# analog pins
|
||||
matches = re.match(r'(AD)([0-9]+)', conn['name'])
|
||||
if matches:
|
||||
analogname = matches.group(2)
|
||||
digitalname = str(14 + int(analogname))
|
||||
conn['pinname'] = pinmap[int(digitalname)]
|
||||
conn['arduinopin'] = digitalname
|
||||
longest_arduinopin = max(longest_arduinopin, len(digitalname))
|
||||
|
||||
#print(connections)
|
||||
return connections
|
||||
|
||||
# NRF52 board variant handler
|
||||
if "nrf52" in variantfolder.lower():
|
||||
# copy over the variant.cpp minus any includes
|
||||
|
|
@ -365,7 +392,7 @@ int main(void) {
|
|||
runit = subprocess.Popen("./arduinopins", shell=True, stdout=subprocess.PIPE)
|
||||
time.sleep(1)
|
||||
arduinopins = runit.stdout.read().decode("utf-8")
|
||||
print(arduinopins)
|
||||
#print(arduinopins)
|
||||
#exit()
|
||||
for pinpair in arduinopins.split("\n"):
|
||||
if not pinpair:
|
||||
|
|
@ -879,11 +906,16 @@ def parse(fzpz, circuitpydef, pinoutcsv, arduinovariantfolder, substitute):
|
|||
|
||||
# find the 'true' GPIO pin names via the circuitpython file
|
||||
# e.g. "MISO" and "D2" map to "GPIO03" or "P0.04"
|
||||
connections = get_circuitpy_aliases(connections, circuitpydef)
|
||||
if circuitpydef != "None":
|
||||
connections = get_circuitpy_aliases(connections, circuitpydef)
|
||||
|
||||
# find the mapping between gpio pins and arduino pins
|
||||
# atmega 328's dont have a mapping
|
||||
if not arduinovariantfolder and pinoutcsv == "atmega328pins.csv":
|
||||
arduinovariantfolder = "atmega328"
|
||||
connections = get_arduino_mapping(connections, arduinovariantfolder)
|
||||
|
||||
#print(connections)
|
||||
|
||||
# open and parse the pinout mapper CSV
|
||||
pinarray = get_chip_pinout(connections, pinoutcsv)
|
||||
#print(pinarray)
|
||||
|
|
@ -942,7 +974,9 @@ def parse(fzpz, circuitpydef, pinoutcsv, arduinovariantfolder, substitute):
|
|||
if not 'pinname' in conn:
|
||||
continue
|
||||
# find muxes next
|
||||
|
||||
muxes = next((pin for pin in pinarray if pin['GPIO'] == conn['pinname']), None)
|
||||
#print("***", muxes)
|
||||
conn['mux'] = muxes
|
||||
draw_pinlabels_svg(connections)
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 28 KiB |
Loading…
Reference in a new issue