Code Monkey home page Code Monkey logo

Comments (7)

cjhdev avatar cjhdev commented on June 9, 2024 1

Yes that will work. LDL_MAC_ticksUntilNextEvent exists for this very purpose, to let you know how long you can sleep for.

It goes without saying that your time source needs to keep working in sleep. On my STM32L port I use LPTIM.

from lora_device_lib.

cjhdev avatar cjhdev commented on June 9, 2024 1

A limitation of LDL at the moment is that it expects to always be running. If you stop and re-start the time source, you have to update the result of LDL_System_time() (i.e. move it forward) but you can only do that so much before the internal timers wrap around.

A future feature might be some kind of suspend and resume feature to safely take care of all of this.

from lora_device_lib.

cjhdev avatar cjhdev commented on June 9, 2024

There is no fixed rate, instead LDL_MAC_process must be called when LDL_MAC_ticksUntilNextEvent returns 0.

In practice if you have a mainloop and you aren't sleeping, it is sufficient to poll LDL_MAC_process once per loop iteration without ever checking LDL_MAC_ticksUntilNextEvent.

from lora_device_lib.

C47D avatar C47D commented on June 9, 2024

Thanks for the reply, in case of my MCU being in low power mode (sleeping), I guess I can do something like below?

while (1) {
    sleep_ticks = LDL_MAC_ticksUntilNextEvent();
    sleep_mcu(sleep_ticks) // sleeps the MCU for x ticks

    LDL_MAC_process();
}

from lora_device_lib.

C47D avatar C47D commented on June 9, 2024

You're right, I totally forgot about the low power peripherals on the STM32L chips, I am using a STM32L476 and was thinking on use a not very low power sleep mode to keep the systick running.

from lora_device_lib.

C47D avatar C47D commented on June 9, 2024

Does loramac-node implement something along this lines? I haven't seen anything like this on their examples, maybe I should check the issues and see if somebody have asked about low power modes.

from lora_device_lib.

cjhdev avatar cjhdev commented on June 9, 2024

I don't think so, suspending/resuming as described is a bit niche. They have a start and stop interface but it doesn't seem so useful.

from lora_device_lib.

Related Issues (20)

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.