-
Notifications
You must be signed in to change notification settings - Fork 7
Add SoftwareSerial
library
#32
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
base: main
Are you sure you want to change the base?
Conversation
RX+TX in full-duplex work fully now
on SoftwareSerial timer speed change
re-initializes the instance to the new baud rate
for some reason, those variables weren't initialized correctly on hardware
to avoid spamming build logs
3740abd
to
55320b8
Compare
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.
Pull Request Overview
This PR adds a new SoftwareSerial library for the HC32F460, updates Timer0 functionality with a new frequency query method, and refines various build scripts, SPI driver warnings, and interrupt handling.
- Added a new SoftwareSerial library with full- and half-duplex modes, examples, and README documentation.
- Introduced get_actual_frequency() in Timer0 along with related clock divider conversion functions.
- Updated build configuration, SPI warning placement, and an assertion in the interrupts module to improve overall reliability.
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tools/platformio/platformio-build-arduino.py | Updated core requirement list to include "timer0". |
libraries/Timer0/src/Timer0.h | Added get_actual_frequency() method with documentation. |
libraries/Timer0/src/Timer0.cpp | Implemented get_actual_frequency(), including prescaler and compare value extraction. |
libraries/SoftwareSerial/src/SoftwareSerial.h | New implementation for SoftwareSerial library. |
libraries/SoftwareSerial/examples/SoftwareSerialExample/src/main.cpp | Added an example showcasing basic SoftwareSerial usage. |
libraries/SoftwareSerial/README.md | New README with configuration options and usage details for SoftwareSerial. |
libraries/SPI/src/SPI.h & SPI.cpp | Adjusted warning message placement regarding untested SPI functionality. |
cores/arduino/drivers/interrupts/interrupts.cpp | Modified assertion logic in auto-assigned IRQ resigning. |
Files not reviewed (2)
- libraries/SoftwareSerial/examples/SoftwareSerialExample/.gitignore: Language not supported
- libraries/SoftwareSerial/examples/SoftwareSerialExample/platformio.ini: Language not supported
Comments suppressed due to low confidence (2)
libraries/SPI/src/SPI.h:14
- [nitpick] The warning regarding untested SPI functionality was removed from the header and added in the source file; ensure that this change in warning placement is deliberate for consistent user notification.
#warning "SPI on the HC32F460 has not been tested yet. See https://github.com/shadow578/framework-arduino-hc32f46x/pull/29"
cores/arduino/drivers/interrupts/interrupts.cpp:272
- The assertion logic was inverted compared to the previous version. Please verify that checking for equality to no_handler is now correct and intended to ensure the IRQ was resigned.
CORE_ASSERT(ram_vector_table.irqs[irqn] == no_handler, "IRQ was not resigned before auto-assign resignment", return Error);
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
5867c9b
to
d637cd4
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Pull Request Overview
This PR adds a new SoftwareSerial library implementation with extended features and improvements over the STM32duino version while also including some ancillary code updates. Key changes include:
- Addition of the SoftwareSerial library with full and half-duplex modes and dynamic baud-rate switching.
- New API to retrieve the actual Timer0 frequency.
- Updates in configuration files and minor fixes in SPI, interrupts, and example workflows.
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tools/platformio/platformio-build-arduino.py | Updated core requirements list order |
libraries/Timer0/src/Timer0.h & Timer0.cpp | Added new function for reporting Timer0 frequency |
libraries/SoftwareSerial/src/*.h, examples, README.md | Introduced the new SoftwareSerial library and associated docs |
libraries/SPI/src/SPI.h & SPI.cpp | Moved SPI testing warning from header to source |
cores/arduino/drivers/interrupts/interrupts.cpp | Corrected assert condition for IRQ auto-assignment |
.github/workflows/build_examples.yaml | Expanded build matrix search paths |
Files not reviewed (2)
- libraries/SoftwareSerial/examples/SoftwareSerialExample/.gitignore: Language not supported
- libraries/SoftwareSerial/examples/SoftwareSerialExample/platformio.ini: Language not supported
Comments suppressed due to low confidence (2)
cores/arduino/drivers/interrupts/interrupts.cpp:272
- The assert condition has been corrected to check that the IRQ has been properly resigned before auto-assignment. Verify that using '==' for 'no_handler' correctly reflects the intended state.
CORE_ASSERT(ram_vector_table.irqs[irqn] == no_handler, "IRQ was not resigned before auto-assign resignment", return Error);
libraries/SPI/src/SPI.h:14
- [nitpick] The warning in SPI.h has been removed, while a similar warning is emitted in SPI.cpp. Ensure that shifting the warning solely to the source file is an intentional move to maintain consistency in documentation.
#warning "SPI on the HC32F460 has not been tested yet. See https://github.com/shadow578/framework-arduino-hc32f46x/pull/29"
Add the
SoftwareSerial
library.Based on the library found in STM32duino, tho fully re-written and (imo) improved.
To-Do:
Note:
this PR is a cleaned-up version of #30 (diff)