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

lora-phy: add get_rssi() to RadioKind trait #251

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

fe1es
Copy link
Contributor

@fe1es fe1es commented Apr 17, 2024

I need to do carrier sensing using the current RSSI value. The CAD isn't enough because I want to detect waves besides LoRa. So I added get_rssi() to the RadioKind trait and exposed it. I also added RadioMode::Listen in which the radio keeps listening to a given frequency so that the RegRssiValue register is updated continuously. I'm not sure if it's ok to add a new RadioMode though.

I don't own sx126x chips, so I implemented get_rssi() only for sx127x and tested on sx1276. I'd appreciate it if someone could implement it for sx126x.

@fe1es fe1es marked this pull request as ready for review April 17, 2024 09:48
@fe1es fe1es marked this pull request as draft April 17, 2024 09:49
@lucasgranberg
Copy link
Collaborator

Could you write an example on how you want to use this code?

@fe1es
Copy link
Contributor Author

fe1es commented Apr 18, 2024

What I want is basically the same as this function. With the function, you first check if the RSSI is below a given threshold for a certain duration, and if so, you perform tx(). Otherwise, you try again later.

lora-phy/src/lib.rs Show resolved Hide resolved
lora-phy/src/lib.rs Outdated Show resolved Hide resolved
plaes
plaes previously approved these changes Apr 29, 2024
@lucasgranberg
Copy link
Collaborator

This makes sense to me. I would still like some example code at least for one target on how to use this. It helps us with maintaining the code and it works as documentation too. Also it makes it easier for anyone with the hw to test it.

@fe1es
Copy link
Contributor Author

fe1es commented Apr 30, 2024

I added a very simple example for stm32l0 which just keeps logging the current rssi.

@lthiery
Copy link
Collaborator

lthiery commented May 29, 2024

Is this PR still a draft or is it ready for final review?

@fe1es
Copy link
Contributor Author

fe1es commented May 31, 2024

I think this is ready for review.

@fe1es fe1es marked this pull request as ready for review May 31, 2024 16:19
@fe1es fe1es requested a review from plaes May 31, 2024 16:20
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

4 participants