Skip to content

drivers: Standardize continuous/one-shot mode method naming. #81

Description

@nedseb

Problem

Continuous and one-shot mode methods use inconsistent names across drivers.

Driver Set continuous Set one-shot Trigger Read one-shot
wsen-hids set_continuous_mode(odr) set_one_shot_mode() trigger_one_shot() read_one_shot()
wsen-pads set_continuous(odr) (implicit via power_down()) trigger_one_shot() read_one_shot()
hts221 setODR(odr) (none) (none, PR #68 adds trigger_one_shot()) (none)
lis2mdl set_mode("continuous") set_mode("single") (none) (none)

Proposed convention

  • set_continuous(odr=...): start continuous measurements at given rate
  • trigger_one_shot(): trigger a single conversion (sensor must be in power-down/one-shot mode)
  • read_one_shot(): trigger + wait + return data
  • No separate set_one_shot_mode() needed if trigger_one_shot() handles it internally

wsen-hids and wsen-pads are already close to this convention.

Drivers to update

  • hts221: add set_continuous(odr) wrapper, keep setODR() as legacy alias
  • lis2mdl: add set_continuous(odr) and trigger_single() / trigger_one_shot()
  • wsen-pads: set_continuous() already compliant
  • wsen-hids: set_continuous_mode()set_continuous() for consistency with wsen-pads

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrefactorNettoyage/harmonisation sans changement fonctionnelreleased

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions