add esp32
This commit is contained in:
parent
fe752fc5a0
commit
c6a173d764
5 changed files with 1001 additions and 775 deletions
|
|
@ -79,6 +79,12 @@ RP2040 does not have official Arduino support (yet).
|
|||
|
||||
```python3 parser.py "Adafruit FunHouse.fzpz" path/to/circuitpython/ports/espressif/boards/adafruit_funhouse/pins.c esp32s2pins.csv -s "^D([0-9])" "IO\1"```
|
||||
|
||||
|
||||
#### ESP32:
|
||||
|
||||
```python3 parser.py "Adafruit QT Py ESP32 Pico.fzpz" None -a ../../ArduinoSketches/hardware/espressif/esp32/variants/adafruit_qtpy_esp32 esp32pins.csv```
|
||||
|
||||
|
||||
#### nRF52:
|
||||
|
||||
```python3 parser.py "Adafruit Feather nRF52840.fzpz" path/to/circuitpython/ports/nrf/boards/feather_nrf52840_express/pins.c nrf52840pins.csv -a ~/Library/Arduino15/packages/adafruit/hardware/nrf52/0.20.5/variants/feather_nrf52840_express```
|
||||
|
|
|
|||
57
esp32pins.csv
Normal file
57
esp32pins.csv
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
GPIO,ADC,HS/QSPI,SDMMC,Touch,RTC,UART,Other,Input Only?
|
||||
0,ADC2_CH1,,,T1,RTC11,,CLK_OUT1,
|
||||
1,,,,,,U0TXD,CLK_OUT3,
|
||||
2,ADC2_CH2,HSPIWP,HS2_DATA0,T2,RTC12,,,
|
||||
3,,,,,,U0RXD,CLK_OUT2,
|
||||
4,ADC2_CH0,HSPIHD,HS2_DATA1,T0,RTC10,,,
|
||||
5,,VSPICS0,HS1_DATA6,,,,,
|
||||
6,,SPICLK,HS1_CLK,,,U1CTS,,
|
||||
7,,SPIQ,HS1_DATA0,,,U2RTS,,
|
||||
8,,SPID,HS1_DATA1,,,U2CTS,,
|
||||
9,,SPIHD,HS1_DATA2,,,U1RXD,,
|
||||
10,,SPIWP,HS1_DATA3,,,U1TXD,,
|
||||
11,,SPI_CS0,HS1_CMD,,,U1RTS,,
|
||||
12,ADC2_CH5,HSPIQ,HS2_DATA2,T5,RTC15,,MTDI,
|
||||
13,ADC2_CH4,HSPID,HS2_DATA3,T4,RTC14,,MTCK,
|
||||
14,ADC2_CH6,HSPICLK,HS2_CLK,T6,RTC16,,MTMS,
|
||||
15,ADC2_CH3,HSPICS0,HS2_CMD,T3,RTC13,,MTDO,
|
||||
16,,,HS1_DATA4,,,U2RXD,,
|
||||
17,,,HS1_DATA5,,,U2TXD,,
|
||||
18,,VSPICLK,HS1_DATA7,,,,,
|
||||
19,,VSPIQ,,,,U0CTS,,
|
||||
20,,,,,,,,
|
||||
21,,VSPIHD,,,,,,
|
||||
22,,VSPIWP,,,,U0RTS,,
|
||||
23,,VSPID,HS1_STROBE,,,,,
|
||||
25,ADC2_CH8,,,,RTC6,,DAC1,
|
||||
26,ADC2_CH9,,,,RTC7,,DAC2,
|
||||
27,ADC2_CH7,,,T7,RTC17,,,
|
||||
32,ADC1_CH4,,,T9,RTC9,,32K_XP,
|
||||
33,ADC1_CH5,,,T8,RTC8,,32K_XN,
|
||||
34,ADC1_CH6,,,,RTC4,,VDET1,Yes
|
||||
35,ADC1_CH7,,,,RTC5,,VDET2,Yes
|
||||
36,ADC1_CH0,,,,RTC0,,SENSE_V+-,Yes
|
||||
37,ADC1_CH1,,,,RTC1,,SENSE_CAP+-,Yes
|
||||
38,ADC1_CH2,,,,RTC2,,SENSE_CAP+AC0-,Yes
|
||||
39,ADC1_CH3,,,,RTC3,,SENSE_V+AC0-,Yes
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
,,,,,,,,
|
||||
DESCRIPTION,,,,,,,,
|
||||
|
1636
output.svg
1636
output.svg
File diff suppressed because it is too large
Load diff
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 87 KiB |
75
parser.py
75
parser.py
|
|
@ -191,8 +191,7 @@ def get_arduino_mapping(connections, variantfolder):
|
|||
global longest_arduinopin
|
||||
if not variantfolder:
|
||||
return connections
|
||||
|
||||
# special case of very early chips
|
||||
###################################################### special case of very early chips
|
||||
if ("atmega328" in variantfolder) or ("atmega32u4" in variantfolder) or ("attiny8x" in variantfolder):
|
||||
pinmap8x = ["PB0", "PB1", "PB2", "PB3", "PB4"]
|
||||
pinmap328 = ["PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7",
|
||||
|
|
@ -237,8 +236,8 @@ def get_arduino_mapping(connections, variantfolder):
|
|||
#print(connections)
|
||||
return connections
|
||||
|
||||
# NRF52 board variant handler
|
||||
if "nrf52" in variantfolder.lower():
|
||||
###################################################### NRF52 board variant handler
|
||||
elif "nrf52" in variantfolder.lower():
|
||||
# copy over the variant.cpp minus any includes
|
||||
|
||||
variantcpp = open(variantfolder+"/"+"variant.cpp").readlines()
|
||||
|
|
@ -292,8 +291,8 @@ int main(void) {
|
|||
outfileh.write(line)
|
||||
outfileh.close()
|
||||
|
||||
# SAMDxx board variant handler
|
||||
if "samd" in variantfolder.lower():
|
||||
###################################################### SAMDxx board variant handler
|
||||
elif "samd" in variantfolder.lower():
|
||||
# copy over the variant.cpp minus any includes
|
||||
|
||||
variantcpp = open(variantfolder+"/"+"variant.cpp").readlines()
|
||||
|
|
@ -403,15 +402,55 @@ int main(void) {
|
|||
|
||||
outfileh.close()
|
||||
|
||||
time.sleep(1)
|
||||
# now compile it!
|
||||
compileit = subprocess.Popen("g++ -w variant.cpp -o arduinopins", shell=True, stdout=subprocess.PIPE)
|
||||
#print(compileit.stdout.read())
|
||||
runit = subprocess.Popen("./arduinopins", shell=True, stdout=subprocess.PIPE)
|
||||
time.sleep(1)
|
||||
arduinopins = runit.stdout.read().decode("utf-8")
|
||||
#print(arduinopins)
|
||||
#exit()
|
||||
###################################################### SAMDxx board variant handler
|
||||
elif "esp32" in variantfolder.lower():
|
||||
for conn in connections:
|
||||
#print(conn['name'])
|
||||
# digital pins
|
||||
matches1 = re.match(r'(GPIO|IO|D|#)([0-9]+)', conn['name'])
|
||||
if matches1:
|
||||
#print(matches)
|
||||
digitalname = matches1.group(2)
|
||||
conn['pinname'] = pinmap[int(digitalname)]
|
||||
conn['arduinopin'] = digitalname
|
||||
longest_arduinopin = max(longest_arduinopin, len(digitalname))
|
||||
else:
|
||||
conn['pinname'] = conn['name']
|
||||
|
||||
# open the file
|
||||
varianth = open(variantfolder+"/"+"pins_arduino.h").readlines()
|
||||
arduinopins = ""
|
||||
for line in varianth:
|
||||
#print(line)
|
||||
# find the const defines
|
||||
matches2 = re.match(r'\s*static\s*const\s*uint8_t\s*([A-Z0-9_]+)\s*=\s*([0-9]+)\s*;.*', line)
|
||||
if matches2:
|
||||
prettyname = matches2[1]
|
||||
pinnumber = matches2[2]
|
||||
print(prettyname, pinnumber)
|
||||
for conn in connections:
|
||||
if conn['pinname'] == prettyname:
|
||||
conn['pinname'] = pinnumber
|
||||
#conn['arduinopin'] = pinnumber
|
||||
print(conn)
|
||||
arduinopins += matches2[2] + ", " + matches2[1] + "\n"
|
||||
#exit()
|
||||
#print(arduinopins)
|
||||
|
||||
|
||||
else:
|
||||
raise UnimplementedError("Unknown arduino variant type!", variantfolder.lower())
|
||||
|
||||
if not arduinopins: # some variants can auto-extract the pins for us, if not we do it the hard way
|
||||
time.sleep(1)
|
||||
# now compile it!
|
||||
compileit = subprocess.Popen("g++ -w variant.cpp -o arduinopins", shell=True, stdout=subprocess.PIPE)
|
||||
#print(compileit.stdout.read())
|
||||
runit = subprocess.Popen("./arduinopins", shell=True, stdout=subprocess.PIPE)
|
||||
time.sleep(1)
|
||||
arduinopins = runit.stdout.read().decode("utf-8")
|
||||
#print(arduinopins)
|
||||
#exit()
|
||||
for pinpair in arduinopins.split("\n"):
|
||||
if not pinpair:
|
||||
continue
|
||||
|
|
@ -420,8 +459,8 @@ int main(void) {
|
|||
if 'arduinopin' in conn:
|
||||
continue
|
||||
conn['arduinopin'] = arduinopin
|
||||
#print(arduinopin, pinname, conn)
|
||||
longest_arduinopin = max(longest_arduinopin, len(arduinopin))
|
||||
#print(arduinopin, pinname, connection)
|
||||
|
||||
return connections
|
||||
|
||||
|
|
@ -765,6 +804,8 @@ def draw_pinlabels_svg(connections):
|
|||
label_type = 'High Speed'
|
||||
elif mux == 'Low Speed':
|
||||
label_type = 'Low Speed'
|
||||
elif mux == 'RTC':
|
||||
label_type = 'Low Speed'
|
||||
elif mux == 'Speed':
|
||||
label_type = 'Speed'
|
||||
elif mux in('Special', 'SPECIAL'):
|
||||
|
|
@ -781,6 +822,8 @@ def draw_pinlabels_svg(connections):
|
|||
label_type = 'Timer'
|
||||
elif mux == 'Timer Alt':
|
||||
label_type = 'Timer Alt'
|
||||
elif mux == 'SDMMC':
|
||||
label_type = 'SERCOM'
|
||||
else:
|
||||
continue
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 26 KiB |
Loading…
Reference in a new issue