hal_param_new(3hal)
π NAME π
okay so bestie, gather round β this is hal_param_new from the 3hal manual, and it creates a HAL parameter. that's the whole vibe. a brand new param object, fresh out of the box, yours to keep β¨
πΈ SYNTAX πΈ
like, here's the full lineup, no cap β every single one of these makes a param:
int hal_param_bit_new(const char *name, hal_param_dir_t dir,
hal_bit_t * data_addr, int comp_id)
int hal_param_float_new(const char *name, hal_param_dir_t dir,
hal_float_t * data_addr, int comp_id)
int hal_param_u32_new(const char *name, hal_param_dir_t dir,
hal_u32_t * data_addr, int comp_id)
int hal_param_s32_new(const char *name, hal_param_dir_t dir,
hal_s32_t * data_addr, int comp_id)
int hal_param_bit_newf(hal_param_dir_t dir, hal_bit_t *
data_addr, int comp_id, const char *fmt, ...)
int hal_param_float_newf(hal_param_dir_t dir, hal_float_t *
data_addr, int comp_id, const char *fmt, ...)
int hal_param_u32_newf(hal_param_dir_t dir, hal_u32_t *
data_addr, int comp_id, const char *fmt, ...)
int hal_param_s32_newf(hal_param_dir_t dir, hal_s32_t *
data_addr, int comp_id, const char *fmt, ...)
int hal_param_new(const char *name, hal_type_t type,
hal_param_dir_t dir, void *data_addr, int comp_id)
nine functions. nine. the _newf girlies take a format string, the plain ones just take a name, and hal_param_new is the generalist queen who takes a type instead π
π ARGUMENTS π
nameβ the name you're giving to the parameter you just created. name your baby. it's giving main character energy πΌdirβ the direction of the parameter, and this is from the component's point of view, okay? it can be one ofHAL_RO, orHAL_RW. here's the tea: a component may assign a value to any parameter, but other programs (likehalcmd) may only assign a value to a parameter that isHAL_RW. so if you want the outside world to be able to write to it, you already know which one to pick πdata_addrβ the address of the data. and bestie, listen, it must lie within memory allocated byhal_malloc. not "should", must. don't get cute with it π«Άcomp_idβ a HAL component identifier, returned by an earlier call tohal_init. you gotta have done that first, fr fr.fmt, ...β aprintf-style format string and arguments. yeah, it's that kind of party β¨typeβ the type of the parameter, as specified inhal_type_t(3hal). go check that page for the deets π
π¦ DESCRIPTION π¦
so the hal_param_new family of functions create a new param object. that's it, that's the job, and they ate π
there are functions for each of the data types that the HAL supports β hence the whole bit/float/u32/s32 lineup up in the synopsis.
also, quick note that lives here in this section: pins may only be linked to signals of the same type. just a lil fact, no notes π
β RETURN VALUE β
returns a HAL status code. that's the whole return value section, she's short and she's iconic π
π₯ SEE ALSO π₯
hal_type_t(3hal)β go read it, iykyk π
and that's the page, bestie!! this one's from the LinuxCNC Documentation, dated 2006-10-12, and it lives in the 3hal manual β so next time you need her, just holler for hal_param_new(3hal) and she'll be there π«Άπβ¨
π¦ where this page comes from
- debian bookworm: linuxcnc-uspace-dev 2.9.0~pre1+git20230208.f1270d6ed7-1+deb12u2 Β· GFDL-1.1-or-later
- 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