• @aksdb
    link
    2610 months ago

    On microcontrollers that might be a valid approach.

    • @[email protected]
      link
      fedilink
      1110 months ago

      I’ve written these cycle-perfect sleep loops before.

      It gets really complicated if you want to account for time spent in interrupt handlers.

      • @aksdb
        link
        210 months ago

        Thankfully I didn’t need high precision realtime. I just needed to wait a few seconds for serial comm.

        • @[email protected]
          link
          fedilink
          410 months ago

          Nah, some MCUs have low power modes.
          ESP32 has 5 of them, from disabling fancy features, throttling the clock, even delegating to an ultra low power coprocessor, or just going to sleep until a pin wakes it up again. It can go from 240mA to 150uA and still process things, or sleep for only 5uA.