GithubHelp home page GithubHelp logo

Comments (4)

ceekdee avatar ceekdee commented on May 29, 2024

Your query is timely. I will be making updates this weekend to focus on board type (Stm32wlSx1262, Stm32l0Sx1276, and Rak4631Sx1262 are the initial ones) rather than chip type (Sx1261, Sx1262, Sx1276, etc.) within a radio kind (Sx1261/2, Sx1276/7/8/9). This will allow us to better account for differences in LoRa boards even with the same LoRa chip. As we add more LoRa boards to the mix, we will discover variations on a theme that can be captured in a better manner than adding a bunch of board type checks.

from lora-phy.

ceekdee avatar ceekdee commented on May 29, 2024

There is a LoRa/LoRaWAN group chat using Element:

https://app.element.io/#/home

It is currently not public, but I would be glad to invite you if you have (or create) an Element account and let me know the name of the account.

from lora-phy.

ceekdee avatar ceekdee commented on May 29, 2024

The latest update supports board type (and within board type, chip type).

pub enum BoardType {
    GenericSx1261, // placeholder for Sx1261-specific features
    Rak4631Sx1262,
    Stm32l0Sx1276,
    Stm32wlSx1262,
}

pub enum ChipType {
    Sx1261,
    Sx1262,
    Sx1276,
    Sx1277,
    Sx1278,
    Sx1279,
}

impl From<BoardType> for ChipType {
    fn from(board_type: BoardType) -> Self {
        match board_type {
            BoardType::GenericSx1261 => ChipType::Sx1261,
            BoardType::Rak4631Sx1262 => ChipType::Sx1262,
            BoardType::Stm32l0Sx1276 => ChipType::Sx1276,
            BoardType::Stm32wlSx1262 => ChipType::Sx1262,
        }
    }
}

which prevents generic chip type checks from having to be modified each time a new board is added:

       match self.radio_kind.get_board_type().into() {
            ChipType::Sx1261 | ChipType::Sx1262 => {
                ModulationParams::new_for_sx1261_2(spreading_factor, bandwidth, coding_rate, frequency_in_hz)
            }
            ChipType::Sx1276 | ChipType::Sx1277 | ChipType::Sx1278 | ChipType::Sx1279 => {
                ModulationParams::new_for_sx1276_7_8_9(spreading_factor, bandwidth, coding_rate, frequency_in_hz)
            }
        }

while making true board type checks evident:

    async fn init_rf_switch(&mut self) -> Result<(), RadioError> {
        if self.board_type != BoardType::Stm32wlSx1262 {
            let op_code_and_indicator = [OpCode::SetRFSwitchMode.value(), true as u8];
            self.intf.write(&[&op_code_and_indicator], false).await?;
        }
        Ok(())
    }

The chip type name is included in the board type name in case the same board type may include different chip types.

Therefore:

  • in mod_params.rs, add your board type and update the From specification for the board's chip type;
  • update the pertinent radio kind function as in the init_rf_switch() sample above.

from lora-phy.

dberlin avatar dberlin commented on May 29, 2024

Awesome.
I'll take a whack at it, and making the Tcxo control part of the board type this weekend

from lora-phy.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.