STRUCT SHT21(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

struct sht21 β€” the SHT21 device specific data πŸŽ€ like, this is the little bundle of everything the driver remembers about your SHT21 sensor, iykyk

(this one lives in the Kernel API Manual, bestie β€” you're in the right place πŸ’–)


🌸 SYNOPSIS 🌸

struct sht21 {
    struct i2c_client *client;
    struct mutex lock;
    unsigned long last_update;
    int temperature;
    int humidity;
    bool valid;
    char eic[18];
 };

Ok so that's the whole struct, character for character, no cap πŸ“‹ β€” the fields are explained down below, keep scrolling bestie πŸ‘‡


πŸ’… Members πŸ’…

  • client β€” the I2C client device. that's the whole reason this thing exists fr fr πŸ¦‹
  • lock β€” a mutex whose entire job is protecting the measurement values. do not skip the lock, it's giving bodyguard energy πŸ”₯
  • last_update β€” the time of the last update, measured in jiffies ⏰ (yes, jiffies, that's the unit, don't come for me)
  • temperature β€” the cached temperature measurement value. cached!! as in, it's a stored value, not a fresh reading every time 🌑️
  • humidity β€” the cached humidity measurement value, same deal πŸ’§
  • valid β€” only 0 before the first measurement is taken. so like, 0 = we have literally nothing yet, anything else = we've measured at least once βœ…
  • eic β€” the cached electronic identification code text, sitting in a char[18] 🏷️
lowkey important: temperature, humidity and eic are all cached β€” the struct is holding onto the last known stuff, bestie 🫢

🧚 SEE ALSO 🧚

go read all of those, they're the supporting cast and honestly they ate πŸ‘‘


that's the whole page!! mwah πŸ’‹ this little struct drop comes courtesy of the ./drivers/hwmon corner of the kernel, dated October 2026 β€” iconic of it, honestly. periodt. πŸ’œβœ¨

πŸ“¦ where this page comes from