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

Add option to allow reset pin numbers on different chip sets #15

Closed
riplatt opened this issue Jan 28, 2021 · 1 comment
Closed

Add option to allow reset pin numbers on different chip sets #15

riplatt opened this issue Jan 28, 2021 · 1 comment

Comments

@riplatt
Copy link

riplatt commented Jan 28, 2021

Summary

Request to add a configuration option to allow reset pin numbers outside gpio chipset 0 ("/dev/gpiochip0")

What is the use-case?

Some custom boards have set the LoRa reset pin to different chipset, a current example is the SeeedStudio LoRaWAN Gateway this has the reset pin set to gpiochip1 pin 17 (pin 49)

Implementation description

add a optional parameter to the setup_pins function in rest.rs and default it to 0

Can you implement this by yourself and make a pull request?

I'm not a rust programmer but I can google just as well as the next programmer, maybe a option would be to check for the existence of chipset_number in the configuration file and set to that value else set to None.

i.e. in main change

// configure concentrator reset pin
if config.gateway.model_config.reset_pin.is_some() {
    reset::setup_pins(config.gateway.model_config.reset_pin.unwrap(), None)
        .expect("setup reset pin error");
}

to some thing like

// configure concentrator pins
let reset_pin = if config.gateway.model_config.reset_pin.is_some() {config.gateway.model_config.reset_pin.unwrap()} else {None};
let chipset_number = if config.gateway.model_config.chipset_number.is_some() {config.gateway.model_config.chipset_number.unwrap()} else {0};
let power_pin = if config.gateway.model_config.power_pin.is_some() {config.gateway.model_config.power_pin.unwrap()} else {None};

reset::setup_pins(reset_pin, chipset_number, power_pin)
    .expect("setup reset pin error");
@brocaar
Copy link
Collaborator

brocaar commented Sep 14, 2021

Hi @riplatt, the above commit implement this. For now, I'm not planning to expose this through the TOML config, as the use-case is more for Raspberry Pi gateways (e.g. where the end-user will wire the shield to the Pi or when different bridge shields exist for the same shield, but with different pin mappings).

If you would be able to create a pull-request to add the vendor config for https://www.seeedstudio.com/LoRaWAN-Gateway-US915-p-4306.html board, that would be great :)

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

No branches or pull requests

2 participants