Tjoms99 / xiao_sense_nrf52840_battery_lib

A battery management library for the XIAO BLE and XIAO BLE Sense board using Zephyr.
Apache License 2.0
21 stars 3 forks source link

API upgrade: Request sample and period sampling support #8

Open Tjoms99 opened 1 week ago

Tjoms99 commented 1 week ago

Summary

Enhance the API to support periodic sampling of battery voltage. This feature will enable users to start and stop periodic sampling, set time intervals, and register callbacks for sample readiness. Additionally, provide a one-shot function to request a sample on demand.

Features to Implement

  1. Periodic Sampling

    • Start/Stop Periodic Sampling: Allow users to initiate and terminate periodic sampling of the battery voltage.
    • Set Sampling Interval: Enable users to configure the time interval between each sample.
    • Register Callbacks: Users can register callback functions to be invoked when samples are ready.
  2. One-Shot Sampling

    • Request Sample: Provide a function to request a single sample of the battery voltage.
    • Callback Integration: Both periodic and one-shot sampling should utilize the same registered callback functions.