-
-
Notifications
You must be signed in to change notification settings - Fork 1k
machine/esp32xx: add WASM simulator support for ESP32-C3/ESP32-S3 targets #5253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+136
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| //go:build !baremetal && (xiao_esp32c3 || xiao_esp32s3) | ||
|
|
||
| // Simulator support for ESP32-C3 and ESP32-S3 based boards. | ||
|
|
||
| package machine | ||
|
|
||
| // Hardware pin numbers | ||
| const ( | ||
| GPIO0 Pin = 0 | ||
| GPIO1 Pin = 1 | ||
| GPIO2 Pin = 2 | ||
| GPIO3 Pin = 3 | ||
| GPIO4 Pin = 4 | ||
| GPIO5 Pin = 5 | ||
| GPIO6 Pin = 6 | ||
| GPIO7 Pin = 7 | ||
| GPIO8 Pin = 8 | ||
| GPIO9 Pin = 9 | ||
| GPIO10 Pin = 10 | ||
| GPIO11 Pin = 11 | ||
| GPIO12 Pin = 12 | ||
| GPIO13 Pin = 13 | ||
| GPIO14 Pin = 14 | ||
| GPIO15 Pin = 15 | ||
| GPIO16 Pin = 16 | ||
| GPIO17 Pin = 17 | ||
| GPIO18 Pin = 18 | ||
| GPIO19 Pin = 19 | ||
| GPIO20 Pin = 20 | ||
| GPIO21 Pin = 21 | ||
| GPIO26 Pin = 26 | ||
| GPIO27 Pin = 27 | ||
| GPIO28 Pin = 28 | ||
| GPIO29 Pin = 29 | ||
| GPIO30 Pin = 30 | ||
| GPIO31 Pin = 31 | ||
| GPIO32 Pin = 32 | ||
| GPIO33 Pin = 33 | ||
| GPIO34 Pin = 34 | ||
| GPIO35 Pin = 35 | ||
| GPIO36 Pin = 36 | ||
| GPIO37 Pin = 37 | ||
| GPIO38 Pin = 38 | ||
| GPIO39 Pin = 39 | ||
| GPIO40 Pin = 40 | ||
| GPIO41 Pin = 41 | ||
| GPIO42 Pin = 42 | ||
| GPIO43 Pin = 43 | ||
| GPIO44 Pin = 44 | ||
| GPIO45 Pin = 45 | ||
| GPIO46 Pin = 46 | ||
| GPIO47 Pin = 47 | ||
| GPIO48 Pin = 48 | ||
| ) | ||
|
|
||
| const ( | ||
| ADC0 Pin = GPIO1 | ||
| ADC2 Pin = GPIO2 | ||
| ADC3 Pin = GPIO3 | ||
| ADC4 Pin = GPIO4 | ||
| ADC5 Pin = GPIO5 | ||
| ADC6 Pin = GPIO6 | ||
| ADC7 Pin = GPIO7 | ||
| ADC8 Pin = GPIO8 | ||
| ADC9 Pin = GPIO9 | ||
| ADC10 Pin = GPIO10 | ||
| ADC11 Pin = GPIO11 | ||
| ADC12 Pin = GPIO12 | ||
| ADC13 Pin = GPIO13 | ||
| ADC14 Pin = GPIO14 | ||
| ADC15 Pin = GPIO15 | ||
| ADC16 Pin = GPIO16 | ||
| ADC17 Pin = GPIO17 | ||
| ADC18 Pin = GPIO18 | ||
| ADC19 Pin = GPIO19 | ||
| ADC20 Pin = GPIO20 | ||
| ) | ||
|
|
||
| // Channel values below are nil, so that they get filled in on the first use. | ||
| // This is the same as what happens on baremetal. | ||
|
|
||
| var PWM0 = &timerType{ | ||
| instance: 0, | ||
| frequency: 16e6, | ||
| bits: 15, | ||
| prescalers: []int{1, 2, 4, 8, 16, 32, 64, 128}, | ||
| channelPins: [][]Pin{ | ||
| nil, // channel 0 | ||
| nil, // channel 1 | ||
| nil, // channel 2 | ||
| nil, // channel 3 | ||
| }, | ||
| } | ||
|
|
||
| var PWM1 = &timerType{ | ||
| instance: 1, | ||
| frequency: 16e6, | ||
| bits: 15, | ||
| prescalers: []int{1, 2, 4, 8, 16, 32, 64, 128}, | ||
| channelPins: [][]Pin{ | ||
| nil, // channel 0 | ||
| nil, // channel 1 | ||
| nil, // channel 2 | ||
| nil, // channel 3 | ||
| }, | ||
| } | ||
|
|
||
| var PWM2 = &timerType{ | ||
| instance: 2, | ||
| frequency: 16e6, | ||
| bits: 15, | ||
| prescalers: []int{1, 2, 4, 8, 16, 32, 64, 128}, | ||
| channelPins: [][]Pin{ | ||
| nil, // channel 0 | ||
| nil, // channel 1 | ||
| nil, // channel 2 | ||
| nil, // channel 3 | ||
| }, | ||
| } | ||
|
|
||
| var PWM3 = &timerType{ | ||
| instance: 3, | ||
| frequency: 16e6, | ||
| bits: 15, | ||
| prescalers: []int{1, 2, 4, 8, 16, 32, 64, 128}, | ||
| channelPins: [][]Pin{ | ||
| nil, // channel 0 | ||
| nil, // channel 1 | ||
| nil, // channel 2 | ||
| nil, // channel 3 | ||
| }, | ||
| } | ||
|
|
||
| var I2C0 = &I2C{Bus: 0} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we'd deduplicate this pin number list with the ones in machine_esp32.go and machine_esp32s3.go so that there won't be any unexpected differences between the simulator and the real target (but it's okay - it's just a list of pin number nothing complex).