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

New Interrupt Driven Serial Echo Example #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AdinAck
Copy link
Contributor

@AdinAck AdinAck commented Aug 19, 2023

Motivation

  • The provided serial_echo example seemed lacking imho
  • Would be really nice if it used interrupts

Change(s)

  • Added serial_echo_irq.rs to /examples

@AdinAck
Copy link
Contributor Author

AdinAck commented Aug 19, 2023

This compiles and runs on my end... looking into it.

@AdinAck
Copy link
Contributor Author

AdinAck commented Aug 19, 2023

that first error makes no sense, still compiles in my deployment repo but not in this repo... 🤷‍♂️

@therealprof
Copy link
Member

Adding an example seems fine to me, though this is unnecessarily complex and convoluted:

  • The macros (just to deal with the global variables) seem a bit over the top and make it even harder to follow for the uninitiated.
  • Since you're toggling the LED in the main loop, there's no need for all that extra global complexity, a local variable will do.

PS: If you want to use a resource only in a single place (like an interrupt handler), you can also move it into a variable in the interrupt handler once and then safely use it without a critical section.

@AdinAck
Copy link
Contributor Author

AdinAck commented Aug 20, 2023

  • The macros (just to deal with the global variables) seem a bit over the top and make it even harder to follow for the uninitiated.

Yes those were left over from my main project where I have many global variables and want it to be easy to use them later, I will remove this.

  • Since you're toggling the LED in the main loop, there's no need for all that extra global complexity, a local variable will do.

Haha another remnant from my main project, I will fix this as well.

PS: If you want to use a resource only in a single place (like an interrupt handler), you can also move it into a variable in the interrupt handler once and then safely use it without a critical section.

I have no idea what this means, and if you are able to explain to me further at your convenience, I would greatly appreciate it.

@AdinAck
Copy link
Contributor Author

AdinAck commented Oct 1, 2023

I believe I have correctly converted the example over to the proper way of using the global serial port. I have also rebased this PR.

@AdinAck
Copy link
Contributor Author

AdinAck commented Nov 25, 2023

#170 will fix this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants