rtapi_init(3rtapi)

πŸ“¦
version 2.9.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

rtapi_init β€” the lil glow-up ritual that sets up RTAPI πŸ’–

Okay bestie, this is rtapi_init(3rtapi) from the RTAPI crew, and she's literally the first thing you call. Main character energy only.


🌸 SYNTAX 🌸

int rtapi_init(const char *modname)

πŸŽ€ ARGUMENTS πŸŽ€

  • modname β€” the name of this rtapi module, aka the government name you're giving your lil creation 🫢

πŸ’… DESCRIPTION πŸ’…

So rtapi_init sets up the RTAPI. That's it, that's the job. ✨

And here's the non-negotiable part, no cap: any module that intends to use the API has to call this before any other RTAPI calls. Like, before. Not after. Not "eh I'll do it later". First. Periodt. πŸ‘‘

modname can optionally point to a string that identifies the module. Cute! But heads up: the string gets truncated at RTAPI_NAME_LEN characters, so don't come in here with a novel thinking it's all gonna fit. It won't. πŸ’€

And if modname is NULL? No stress, the system will just assign a name for you. Iconic of it, honestly. 🌈


πŸ”₯ REALTIME CONSIDERATIONS πŸ”₯

Call this only from within non-realtime or realtime init/cleanup code. Do not call it from realtime tasks. That's the vibe check and you gotta pass it. ⭐

Fr fr, respect the realtime boundaries. This is not the function to get adventurous with. 😭

πŸ‘‘ RETURN VALUE πŸ‘‘

  • On success: returns a positive integer module ID, which is used for subsequent calls to rtapi_xxx_new, rtapi_xxx_delete, and rtapi_exit. Keep that ID close, you'll need her later πŸ’œ
  • On failure: returns an RTAPI error code. (Not the vibe, but at least you'll know.)

That's the whole page, bestie. Slay, go init your module, and remember who told you to call it first. πŸ¦‹

LinuxCNC Documentation Β· 2006-10-12 Β· rtapi_init(3rtapi) β€” mwah, kisses from the manual, see you in the next one πŸ“πŸ§šπŸ’–