-
Notifications
You must be signed in to change notification settings - Fork 64
Added basic blink example for Esp32-C6 #21
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
Conversation
Added pictures and added more specific instructions
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.
Thanks for the PR there are some hopefully simple changes we need to make before merging this addition :)
Lastly could you also update the README at the repo root to list this example
esp32-led-blink-sdk/CMakeLists.txt
Outdated
@@ -0,0 +1,3 @@ | |||
cmake_minimum_required(VERSION 3.16) |
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.
Could you increase this to 3.29 and ensure everything still works?
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.
done, everything works
esp32-led-blink-sdk/README.md
Outdated
@@ -0,0 +1,39 @@ | |||
# esp32-led-strip-sdk |
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.
I think this name is copy-pasted, could you update it?
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.
sure, done
esp32-led-blink-sdk/README.md
Outdated
|
||
This example demonstrates how to integrate with the ESP-IDF SDK via CMake and how to use the standard GPIO library to control LED from Swift. This example is specifically made for the RISC-V MCUs from ESP32 (the Xtensa MCUs are not currently supported by Swift). | ||
|
||
 |
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.
These links appear to point out of tree, could you fix them?
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.
I created the pics directory in the project folder and uploaded the pictures there, is it fine?
esp32-led-blink-sdk/README.md
Outdated
- If needed, run export.sh to get access to the idf.py script from ESP-IDF. | ||
- Specify the nightly toolchain to be used via the `TOOLCHAINS` environment variable and the target board type by using `idf.py set-target`. | ||
``` console | ||
$ cd esp32-led-strip-sdk |
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.
copied folder name
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.
fixed
esp32-led-blink-sdk/README.md
Outdated
|
||
## Running | ||
|
||
- Connect the Esp32-C6-Bug board(Or any other board with integrated LED on GPIO pin 8) over a USB cable to your Mac. Alternatively you can just connect external LED to GPIO pin 8 on any other board. |
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.
could you adjust the formatting here slightly: "...board (or any..."
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.
done
esp32-led-blink-sdk/main/Main.swift
Outdated
// | ||
// This source file is part of the Swift open source project | ||
// | ||
// Modified by Karavaev Aleksei |
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.
same here
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.
sure, fixed
// | ||
// This source file is part of the Swift open source project | ||
// | ||
// Copyright (c) 2023 Apple Inc. and the Swift project authors. |
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.
Could you make sure to use 2024 as the copyright date on these new additions
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.
changed in all files of the project
esp32-led-blink-sdk/main/Led.swift
Outdated
fatalError("cannot reset led") | ||
} | ||
|
||
guard gpio_set_direction(ledPin,GPIO_MODE_OUTPUT) == ESP_OK else { |
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.
nit: add a space after the comma
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.
fixed
esp32-led-blink-sdk/main/Main.swift
Outdated
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// The code will blink a led attached to GPIO8, to change the led pin change the Led(gpioPin: 8) to something else |
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.
nit: wrap to 80 characters
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.
fixed
esp32-led-blink-sdk/README.md
Outdated
## Running | ||
|
||
- Connect the Esp32-C6-Bug board(Or any other board with integrated LED on GPIO pin 8) over a USB cable to your Mac. Alternatively you can just connect external LED to GPIO pin 8 on any other board. | ||
- Connect RX pin of USB-UART converter to TX0 pin of your board if you need serial ouput.(You may also need to connect GND converter pin to the GND pin of the board) |
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.
same here could you add a space after output and remove the parens "...output. You may..."
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.
done
…anged copyright date and removed my name, changed copy-pasted names, changed pics location, added example description to root README.
Hi @rauhul, thanks for the review! :) I think I fixed everything. I was not sure which table to add the example to (Catalog of Examples or Community Examples). The 'Community Examples' table points to external repositories, so I decided to go with 'Catalog of Examples'. Let me know if any other changes are required. :) |
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.
@allexoK one last change and were good to go!
esp32-led-blink-sdk/README.md
Outdated
|
||
This example demonstrates how to integrate with the ESP-IDF SDK via CMake and how to use the standard GPIO library to control LED from Swift. This example is specifically made for the RISC-V MCUs from ESP32 (the Xtensa MCUs are not currently supported by Swift). | ||
|
||
 |
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.
last nit: could you change this path to assets/images/...
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.
Sure, changed it :)
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.
fantastic, thank you for the contribution!
Hello,
When learning about embedded-Swift, I was surprised that there was no basic blink example (only the LED strip one). So, I decided to create one.
I used the ESP32-C6-Bug board, but it doesn’t really matter as long as there is a normal LED on-board. Alternatively, an external LED can be connected.