hal_type_t(3hal)
π hal_type_t β the typedefs for HAL datatypes, bestie π
okay so this is the hal_type_t page from section 3hal of the HAL manual, and it's basically the whole cast list of HAL datatypes. like, the friend group. every type gets its moment, no cap. β¨
πΈ NAME πΈ
hal_type_t β typedefs for HAL datatypes. that's it, that's the vibe. π
β¨ DESCRIPTION β¨
here's the roster, in order, with zero skips. π
hal_boolβ a type which may have a value of0or nonzero.hal_bit_tβ a volatile type which may have a value of0or nonzero.hal_s32_tβ a volatile type which may have a value from-2147483648to2147483647.hal_u32_tβ a volatile type which may have a value from0to4294967295.hal_port_tβ a volatile handle to a port object. used with thehal_port*functions. iykyk π«Άhal_float_tβ a volatile floating-point type, which typically has the same precision and range as the C typedouble.real_tβ a nonvolatile floating-point type with at least as much precision ashal_float_t.ireal_tβ a nonvolatile unsigned integral type the same size ashal_float_t.
and then there's the enum itself:
typedef enum hal_type_t;
and its members, each one a lil legend: π
HAL_BITβ corresponds to the typehal_bit_t.HAL_FLOATβ corresponds to the typehal_float_t.HAL_S32β corresponds to the typehal_s32_t.HAL_U32β corresponds to the typehal_u32_t.
π NOTES π
okay this is the part where i hold your hand, because there's a trap here and it will humble you. π
hal_bit_t is typically a typedef to an integer type whose range is larger than just 0 and 1. so when you're testing the value of a hal_bit_t, never compare it to 1. just don't. instead, prefer one of these:
if(b)if(b != 0)
periodt. π
it's often useful to refer to a type that can represent all the values as a HAL type, but without the volatile qualifier. the following types correspond with the HAL types:
hal_bit_tβinthal_s32_tβ__s32hal_u32_tβ__u32hal_float_tβhal_real_thal_port_tβint
β οΈ take care not to use the typess32andu32. these will compile in kernel modules but not in userspace, and not for realtime components when using uspace realtime. it's giving "works on my machine" and then it does NOT. π
π SEE ALSO π
and that's the whole page, bestie!! π¦ go forth and typedef responsibly. this one's brought to you by LinuxCNC Documentation, dated 2006-10-12 β yeah she's an elder but she ate and left no crumbs. πβ¨π
π¦ where this page comes from
- debian trixie: linuxcnc-uspace-dev 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace-dev 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms