Skip to content
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

Arduino MBED RTOS Support #1581

Merged
merged 15 commits into from
Feb 24, 2023
Merged

Arduino MBED RTOS Support #1581

merged 15 commits into from
Feb 24, 2023

Conversation

arengarajan99
Copy link
Contributor

MBED RTOS requires the use of threading as a means of supporting physical actions on Arduino. This pull request adds full support for MBED boards using C-Style APIs to interface our reactor-c library to MBED RTOS's C++ infrastructure (Threads, ConditionVariables, and Mutexes)

@@ -52,7 +52,7 @@ private String generateMainFunction() {
"// Arduino setup() and loop() functions",
"void setup() {",
"\tSerial.begin(" + targetConfig.platformOptions.baudRate + ");",
"\tlf_register_print_function(&_lf_arduino_print_message_function, LOG_LEVEL);",
"\tlf_register_print_function(&_lf_arduino_print_message_function, 0);",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments/questions.

@@ -394,20 +394,22 @@ private static boolean copyDirectoryFromJar(JarURLConnection connection, final P
* @param dir The folder to search for folders and files to delete.
* @throws IOException If the given folder and unneeded files cannot be deleted.
*/
public static void arduinoDeleteHelper(Path dir) throws IOException {
public static void arduinoDeleteHelper(Path dir, Boolean isThreading) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static void arduinoDeleteHelper(Path dir, Boolean isThreading) throws IOException {
public static void arduinoDeleteHelper(Path dir, boolean isThreading) throws IOException {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better name of the variable would be threadingOn?

@@ -611,7 +611,7 @@ private String generateCodeToInitializeFederate(FederateInstance federate, Linke
code.pr(String.join("\n",
"// Initialize the socket mutex",
"lf_mutex_init(&outbound_socket_mutex);",
"lf_cond_init(&port_status_changed);"
"lf_cond_init(&port_status_changed, &outbound_socket_mutex);"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what's going on here, but that's probably because I haven't yet checked out your reactor-c PR...

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@lhstrh lhstrh merged commit c04d8d3 into master Feb 24, 2023
@arengarajan99 arengarajan99 deleted the arduino-mbed-support branch February 25, 2023 02:18
@lhstrh lhstrh added the feature New feature label Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants