adxl345_set_inact_time(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ adxl345_set_inact_time ✨

okay so bestie, welcome to the kernel API manual for adxl345_set_inact_time β€” yes that's the section 9 one, the kernel-api girlies know πŸ’… this is the function that sorts out your accelerometer's inactivity time situation.


🌸 NAME 🌸

adxl345_set_inact_time β€” configure the inactivity time explicitly, or just let the ODR handle it for you. no cap, it does both 🫢


πŸŽ€ SYNOPSIS πŸŽ€

int adxl345_set_inact_time (struct adxl345_state *st , u32 val_int , u32
val_fract );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • st β€” the sensor state instance. your main character struct, literally πŸ’œ
  • val_int β€” the inactivity time, integer part. the whole seconds energy ✨
  • val_fract β€” the inactivity time, fractional part β€” but only when val_int is 0. iykyk πŸ“

πŸ’– DESCRIPTION πŸ’–

so here's the tea β˜• β€” inactivity time can be configured anywhere between 1 and 255 seconds. that's the range, periodt.

but like… if a user sets val_s to 0, a default inactivity time gets calculated automatically, because 0 is also invalid and undefined by the sensor. so yeah, the sensor said "not me" to zero πŸ™ˆ

in those cases, power consumption should be considered, fr fr: the inactivity period should be shorter at higher sampling frequencies and longer at lower ones. it's giving "match the vibe of your clock" πŸ’€

specifically, bestie:

  • for frequencies above 255 Hz, the default is set to 10 seconds
  • for frequencies below 10 Hz, it defaults to 255 seconds

the calculation method is honestly iconic: it subtracts the integer part of the configured sample frequency from 255 to estimate the inactivity time in seconds. sub-Hertz values are ignored in this approximation β€” they just don't get an invite to the party πŸŽ‰

and since the recommended output data rates (ODRs) for features like activity/inactivity detection, sleep modes, and free fall range between 12.5 Hz and 400 Hz, frequencies outside this range will either use the defined boundary defaults or require explicit configuration via val_s. so if you're out here in the wild frequencies, know that 🌈


⭐ RETURN ⭐

0 or error value. that's it, that's the whole mood πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘


aaaand that's the whole page 🧚 this one lives in ./drivers/iio/accel and the version is dated October 2026 β€” so like, future girlie energy β³πŸ’« go off and configure those inactivity times responsibly, bestie, and remember: every detail above is load-bearing, no skipping πŸ”₯🫢

πŸ“¦ where this page comes from