rgpio(3)

πŸ“¦
version 0.2.0.0 Β· 3 versions
, in ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ¦‹ rgpio πŸ’–

okay bestie, welcome to the rgpio(3) page from the lg archive ✨ manual section 3 β€” she's long, she's iconic, and we're doing her in SEVEN parts so buckle up πŸŽ€


🌸 NAME 🌸

rgpio β€” a C library to manipulate a remote SBC's GPIO. no cap, that's the whole job description πŸ’…


✨ SYNOPSIS ✨

#include <rgpio.h>

gcc -Wall -o prog prog.c -lrgpio

./prog

πŸ’œ DESCRIPTION πŸ’œ

rgpio is a C library which allows remote control of the GPIO and other functions of Linux SBCs running the rgpiod daemon.

bestie listen πŸ‘‘ β€” the rgpiod daemon must be running on the SBCs you wish to control. no daemon, no vibes.

πŸ“ Features πŸ“

  • reading and writing GPIO singly and in groups
  • software timed PWM and waves
  • GPIO callbacks
  • pipe notification of GPIO alerts
  • I2C wrapper
  • SPI wrapper
  • serial link wrapper
  • simple file handling
  • creating and running scripts on the rgpiod daemon
  • a simple interface to start and stop new threads

🌈 Usage 🌈

Include <rgpio.h> in your source files.

Assuming your source is in prog.c use the following command to build

gcc -Wall -o prog prog.c -lrgpio

to run make sure the rgpiod daemon is running

rgpiod&

./prog

For examples see the lg archive file.

🧚 Notes 🧚

All the functions which return an int return < 0 on error


πŸ‘‘ OVERVIEW πŸ‘‘

πŸ’« ESSENTIAL πŸ’«

  • rgpiod_start β€” Connects to a rgpiod daemon
  • rgpiod_stop β€” Disconnects from a rgpiod daemon

πŸ“ FILES πŸ“

  • file_open β€” Opens a file
  • file_close β€” Closes a file
  • file_read β€” Reads bytes from a file
  • file_write β€” Writes bytes to a file
  • file_seek β€” Seeks to a position within a file
  • file_list β€” List files which match a pattern

πŸŽ€ GPIO πŸŽ€

  • gpiochip_open β€” Opens a gpiochip device
  • gpiochip_close β€” Closes a gpiochip device
  • gpio_get_chip_info β€” Gets gpiochip information
  • gpio_get_line_info β€” Gets gpiochip line information
  • gpio_get_mode β€” Gets the mode of a GPIO
  • gpio_claim_input β€” Claims a GPIO for input
  • gpio_claim_output β€” Claims a GPIO for output
  • gpio_claim_alert β€” Claims a GPIO for alerts
  • gpio_free β€” Frees a GPIO
  • group_claim_input β€” Claims a group of GPIO for inputs
  • group_claim_output β€” Claims a group of GPIO for outputs
  • group_free β€” Frees a group of GPIO
  • gpio_read β€” Reads a GPIO
  • gpio_write β€” Writes a GPIO
  • group_read β€” Reads a group of GPIO
  • group_write β€” Writes a group of GPIO
  • tx_pulse β€” Starts pulses on a GPIO
  • tx_pwm β€” Starts PWM on a GPIO
  • tx_servo β€” Starts servo pulses on a GPIO.
  • tx_wave β€” Starts a wave on a group of GPIO
  • tx_busy β€” See if tx is active on a GPIO or group
  • tx_room β€” See if more room for tx on a GPIO or group
  • gpio_set_debounce_time β€” Sets the debounce time for a GPIO
  • gpio_set_watchdog_time β€” Sets the watchdog time for a GPIO
  • callback β€” Starts a GPIO callback
  • callback_cancel β€” Stops a GPIO callback

πŸ¦‹ I2C πŸ¦‹

  • i2c_open β€” Opens an I2C device
  • i2c_close β€” Closes an I2C device
  • i2c_write_quick β€” smbus write quick
  • i2c_read_byte β€” smbus read byte
  • i2c_write_byte β€” smbus write byte
  • i2c_read_byte_data β€” smbus read byte data
  • i2c_write_byte_data β€” smbus write byte data
  • i2c_read_word_data β€” smbus read word data
  • i2c_write_word_data β€” smbus write word data
  • i2c_read_block_data β€” smbus read block data
  • i2c_write_block_data β€” smbus write block data
  • i2c_read_i2c_block_data β€” smbus read I2C block data
  • i2c_write_i2c_block_data β€” smbus write I2C block data
  • i2c_read_device β€” Reads the raw I2C device
  • i2c_write_device β€” Writes the raw I2C device
  • i2c_process_call β€” smbus process call
  • i2c_block_process_call β€” smbus block process call
  • i2c_zip β€” Performs multiple I2C transactions

πŸ”” NOTIFICATIONS πŸ””

  • notify_open β€” Request a notification handle
  • notify_close β€” Close a notification
  • notify_pause β€” Pause notifications
  • notify_resume β€” Start notifications for selected GPIO

πŸ“œ SCRIPTS πŸ“œ

  • script_store β€” Store a script
  • script_run β€” Run a stored script
  • script_update β€” Set a scripts parameters
  • script_status β€” Get script status and parameters
  • script_stop β€” Stop a running script
  • script_delete β€” Delete a stored script

🌸 SERIAL 🌸

  • serial_open β€” Opens a serial device
  • serial_close β€” Closes a serial device
  • serial_read_byte β€” Reads a byte from a serial device
  • serial_write_byte β€” Writes a byte to a serial device
  • serial_read β€” Reads bytes from a serial device
  • serial_write β€” Writes bytes to a serial device
  • serial_data_available β€” Returns number of bytes ready to be read

πŸ’» SHELL πŸ’»

  • shell β€” Executes a shell command

⭐ SPI ⭐

  • spi_open β€” Opens a SPI device
  • spi_close β€” Closes a SPI device
  • spi_read β€” Reads bytes from a SPI device
  • spi_write β€” Writes bytes to a SPI device
  • spi_xfer β€” Transfers bytes with a SPI device

🧡 THREADS 🧡

  • thread_start β€” Start a new thread
  • thread_stop β€” Stop a previously started thread

πŸ› οΈ UTILITIES πŸ› οΈ

  • lgu_get_sbc_name β€” Get the SBC name
  • lgu_get_internal β€” Get a SBC configuration value
  • lgu_set_internal β€” Set a SBC configuration value
  • lgu_time β€” Returns the number of seconds since the epoch
  • lgu_timestamp β€” Returns the number of nanoseconds since the epoch
  • lgu_sleep β€” Sleeps for a number of seconds
  • lgu_set_user β€” Set the user (and associated permissions)
  • lgu_set_share_id β€” Set the share id for a resource
  • lgu_use_share_id β€” Use this share id when asking for a resource
  • lgu_rgpio_version β€” Get the rgpio library version
  • lgu_error_text β€” Get the error text for an error code

πŸ’… FUNCTIONS πŸ’…

🫢 rgpiod_start 🫢

int rgpiod_start(const char *addrStr, const char *portStr)

Connect to the rgpiod daemon. Reserving command and notification streams.

  • addrStr: specifies the host or IP address of the SBC running the rgpiod daemon. It may be NULL in which case localhost is used unless overridden by the LG_ADDR environment variable.
  • portStr: specifies the port address used by the SBC running the rgpiod daemon. It may be NULL in which case "8889" is used unless overridden by the LG_PORT environment variable.

If OK returns a sbc (>= 0).

On failure returns a negative error code.

This sbc value is passed to the other functions to specify the SBC to be used.

If the LG_USER environment variable exists that user will be "logged in" using lgu_set_user. This only has an effect if the rgpiod daemon is running with access control enabled.


🫢 rgpiod_stop 🫢

void rgpiod_stop(int sbc)

Terminates the connection to a rgpiod daemon and frees resources used by the library.

  • sbc: >= 0 (as returned by rgpiod_start).

πŸ“‚ file_open πŸ“‚

int file_open(int sbc, const char *file, int mode)

This function returns a handle to a file opened in a specified mode.

heads up bestie πŸ™ˆ β€” this is a privileged command. See permits.
  • sbc: >= 0 (as returned by rgpiod_start).
  • file: the file to open.
  • mode: the file open mode.

If OK returns a handle (>= 0).

On failure returns a negative error code.

πŸ—‚οΈ File

A file may only be opened if permission is granted by an entry in the [files] section of the permits file. This is intended to allow remote access to files in a controlled manner.

πŸ”“ Mode

The mode may have the following values.

  • LG_FILE_READ β€” value 1 β€” open file for reading
  • LG_FILE_WRITE β€” value 2 β€” open file for writing
  • LG_FILE_RW β€” value 3 β€” open file for reading and writing

The following values may be or'd into the mode.

  • LG_FILE_APPEND β€” value 4 β€” Writes append data to the end of the file
  • LG_FILE_CREATE β€” value 8 β€” The file is created if it doesn't exist
  • LG_FILE_TRUNC β€” value 16 β€” The file is truncated

Newly created files are owned by the user who launched the daemon with permissions owner read and write.

🌟 Example 🌟

#include <stdio.h>
#include <rgpio.h>

int main(int argc, char *argv[])
{
   int sbc, handle, c;
   char buf[60000];

   sbc = rgpiod_start(NULL, NULL);

   if (sbc < 0) return 1;

   handle = file_open(sbc, "/ram/lg.c", LG_FILE_READ);

   if (handle >= 0)
   {
      while ((c=file_read(sbc, handle, buf, sizeof(buf)-1)))
      {
         buf[c] = 0;
         printf("%s", buf);
      }

      file_close(sbc, handle);
   }

   rgpiod_stop(sbc);
}

πŸ“‚ file_close πŸ“‚

int file_close(int sbc, int handle)

This function closes the file.

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by file_open).

If OK returns 0.

On failure returns a negative error code.

🌟 Example 🌟

file_close(sbc, handle);

✍️ file_write ✍️

int file_write(int sbc, int handle, const char *buf, int count)

This function writes count bytes from buf to the the file.

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by file_open).
  • buf: the array of bytes to write.
  • count: the number of bytes to write.

If OK returns 0.

On failure returns a negative error code.

🌟 Example 🌟

if (file_write(sbc, handle, buf, 100) == 0)
{
   // file written okay
}
else
{
   // error
}

πŸ“– file_read πŸ“–

int file_read(int sbc, int handle, char *buf, int count)

This function reads up to count bytes from the the file.

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by file_open).
  • buf: an array to receive the read data.
  • count: the maximum number of bytes to read.

If OK returns the count of bytes read and updates buf.

On failure returns a negative error code.

🌟 Example 🌟

   bytes = file_read(sbc, handle, buf, sizeof(buf));

   if (bytes >= 0)
   {
      // process read data
   }

πŸ” file_seek πŸ”

int file_seek(int sbc, int handle, int32_t seekOffset, int seekFrom)

This function seeks to a position within the file.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by file_open).
  • seekOffset β€” the number of bytes to move. Positive offsets move forward, negative offsets backwards.
  • seekFrom β€” one of LG_FROM_START (0), LG_FROM_CURRENT (1), or LG_FROM_END (2).

If OK returns the new file position. Slay. πŸ’…

On failure returns a negative error code. Not slay. 😭

Example

file_seek(sbc, handle, 123, LG_FROM_START); // Start plus 123

size = file_seek(sbc, handle, 0, LG_FROM_END); // End, return size

pos = file_seek(sbc, handle, 0, LG_FROM_CURRENT); // Current position

✨ file_list ✨

int file_list(int sbc, const char *fpat, char *buf, int count)

This function returns a list of files which match a pattern. Bestie, it’s giving directory energy. πŸ¦‹

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • fpat β€” file pattern to match.
  • buf β€” an array to receive the matching file names.
  • count β€” the maximum number of bytes to read.

If OK returns the count of bytes read and updates buf with the matching filenames (the filenames are separated by newline characters). Newline-separated, no cap. ✨

On failure returns a negative error code.

Example

#include <stdio.h>
#include <rgpio.h>

int main(int argc, char *argv[])
{
   int sbc, handle, c;
   char buf[60000];

   sbc = rgpiod_start(NULL, NULL);

   if (sbc < 0) return 1;

   c = file_list(sbc, "/ram/p*.c", buf, sizeof(buf));

   if (c >= 0)
   {
      buf[c] = 0;
      printf("%s", buf);
   }

   rgpiod_stop(sbc);
}

πŸ”₯ gpiochip_open πŸ”₯

int gpiochip_open(int sbc, int gpioDev)

This returns a handle to a gpiochip device. Main character energy for your GPIO chip. πŸ‘‘

This is a privileged command. See permits. Yes, permits. The bouncer at the club. πŸŽ€

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • gpioDev β€” >= 0

If OK returns a handle (>= 0).

On failure returns a negative error code.

Example

h = gpiochip_open(sbc, 0); // open gpiochip0

if (h >= 0)
{
   // open ok
}
else
{
   // open error
}

πŸ’– gpiochip_close πŸ’–

int gpiochip_close(int sbc, int handle)

This closes a gpiochip device. Say bye bestie, respectfully. 🌸

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).

If OK returns 0.

On failure returns a negative error code.

Example

status = gpiochip_close(sbc, h); // close gpiochip

if (status < 0)
{
   // close failed
}

🌈 gpio_get_chip_info 🌈

int gpio_get_chip_info(int sbc, int handle, lgChipInfo_p chipInfo)

This returns summary information of an opened gpiochip. Tea time, but for chip facts. πŸ“

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • chipInfo β€” address to store returned chip info.

If OK returns a list of okay status, number of lines, name, and label. Okay status, lines, name, label β€” the whole vibe check. ✨

On failure returns a negative error code.


πŸ¦‹ gpio_get_line_info πŸ¦‹

int gpio_get_line_info(int sbc, int handle, int gpio, lgLineInfo_p lineInfo)

This returns detailed information of a GPIO of an opened gpiochip. It’s giving receipts for one specific pin. πŸ’œ

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO.
  • lineInfo β€” address to store returned line info.

If OK returns a list of okay status, offset, line flags, name, and user. Okay status, offset, flags, name, user. Iconic. πŸ’…

The meaning of the line flags bits are as given for the mode by gpio_get_mode. Go read that one next, bestie. 🌸

On failure returns a negative error code.


⭐ gpio_get_mode ⭐

int gpio_get_mode(int sbc, int handle, int gpio)

This returns the mode of a GPIO. What is that pin going through? Let’s find out. 🫢

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO to be read.

If OK returns the mode of the GPIO.

On failure returns a negative error code.

  • Bit 0 β€” Value 1 β€” Meaning: Kernel: In use by the kernel
  • Bit 1 β€” Value 2 β€” Meaning: Kernel: Output
  • Bit 2 β€” Value 4 β€” Meaning: Kernel: Active low
  • Bit 3 β€” Value 8 β€” Meaning: Kernel: Open drain
  • Bit 4 β€” Value 16 β€” Meaning: Kernel: Open source
  • Bit 5 β€” Value 32 β€” Meaning: Kernel: Pull up set
  • Bit 6 β€” Value 64 β€” Meaning: Kernel: Pull down set
  • Bit 7 β€” Value 128 β€” Meaning: Kernel: Pulls off set
  • Bit 8 β€” Value 256 β€” Meaning: LG: Input
  • Bit 9 β€” Value 512 β€” Meaning: LG: Output
  • Bit 10 β€” Value 1024 β€” Meaning: LG: Alert
  • Bit 11 β€” Value 2048 β€” Meaning: LG: Group
  • Bit 12 β€” Value 4096 β€” Meaning: LG: ---
  • Bit 13 β€” Value 8192 β€” Meaning: LG: ---
  • Bit 14 β€” Value 16384 β€” Meaning: LG: ---
  • Bit 15 β€” Value 32768 β€” Meaning: LG: ---
  • Bit 16 β€” Value 65536 β€” Meaning: Kernel: Input
  • Bit 17 β€” Value 1<<17 β€” Meaning: Kernel: Rising edge alert
  • Bit 18 β€” Value 1<<18 β€” Meaning: Kernel: Falling edge alert
  • Bit 19 β€” Value 1<<19 β€” Meaning: Kernel: Realtime clock alert

The LG bits are only set if the query was made by the process that owns the GPIO. Owner privileges, periodt. πŸ‘‘


πŸŽ€ gpio_claim_input πŸŽ€

int gpio_claim_input(int sbc, int handle, int lFlags, int gpio)

This claims a GPIO for input. Mine now. No takebacks. πŸ’–

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • lFlags β€” line flags for the GPIO.
  • gpio β€” the GPIO to be claimed.

If OK returns 0.

On failure returns a negative error code.

The line flags may be used to set the GPIO as active low, open drain, open source, pull up, pull down, pull off. So many little settings, so little time. ✨

Example

status = gpio_claim_input(sbc, h, 0, 23); // open GPIO 23 for input

🌸 gpio_claim_output 🌸

int gpio_claim_output(int sbc, int handle, int lFlags, int gpio, int value)

This claims a GPIO for output. It’s giving β€œI will send signals, actually.” πŸ”₯

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • lFlags β€” line flags for the GPIO.
  • gpio β€” the GPIO to be claimed.
  • value β€” the initial value for the GPIO.

If OK returns 0.

On failure returns a negative error code.

The line flags may be used to set the GPIO as active low, open drain, open source, pull up, pull down, pull off. Same glow-up options as input. πŸ’œ

If value is zero the GPIO will be initialised low (0). If any other value is used the GPIO will be initialised high (1). Zero = low, anything else = high. That’s the rule, bestie. πŸ’…

Example

status = gpio_claim_output(sbc, h, 0, 35, 1); // open GPIO 35 for high output

πŸ’œ gpio_free πŸ’œ

int gpio_free(int sbc, int handle, int gpio)

This frees a GPIO. Release it back into the wild. πŸ¦‹

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO to be freed.

If OK returns 0.

On failure returns a negative error code.

The GPIO may now be claimed by another user or for a different purpose. Sharing is caring, I guess. 🫢


🌈 group_claim_input 🌈

int group_claim_input(int sbc, int handle, int lFlags, int count, const int *gpios)

This claims a group of GPIO for inputs. Squad goals but for pins. ✨

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • lFlags β€” line flags for each GPIO.
  • count β€” the number of GPIO to claim.
  • gpios β€” the group GPIO.

If OK returns 0.

On failure returns a negative error code.

The line flags may be used to set the group as active low, open drain, open source, pull up, pull down, pull off. Group settings, but make it fashion. πŸ’…

gpios is an array of one or more GPIO. The first GPIO in the array is called the group leader and is used to reference the group as a whole. Group leader = the main character of the group. πŸ‘‘


πŸ¦‹ group_claim_output πŸ¦‹

int group_claim_output(int sbc, int handle, int lFlags, int count, const int *gpios, const int *values)

This claims a group of GPIO to be used as outputs. They’re all getting claimed, bestie. πŸ’–

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • lFlags β€” line flags for each GPIO.
  • count β€” the number of GPIO to claim.
  • gpios β€” the group GPIO.
  • values β€” the initial value for each GPIO.

If OK returns 0.

On failure returns a negative error code.

The line flags may be used to set the group as active low, open drain, open source, pull up, pull down, pull off. Same flag energy as before. ✨

gpios is an array of one or more GPIO. The first GPIO in the array is called the group leader and is used to reference the group as a whole. Group leader again. They run this group chat. πŸ’œ

values is a list of initialisation values for the GPIO. If a value is zero the corresponding GPIO will be initialised low (0). If any other value is used the corresponding GPIO will be initialised high (1). Zero = low, not-zero = high. Every single time. πŸ’…


⭐ group_free ⭐

int group_free(int sbc, int handle, int gpio)

This frees all the group GPIO. The whole group is being dismissed. 😭

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the group leader.

If OK returns 0.

On failure returns a negative error code.

The GPIO may now be claimed by another user or for a different purpose. They’re free agents now. πŸ¦‹


πŸ’– gpio_read πŸ’–

int gpio_read(int sbc, int handle, int gpio)

This returns the level of a GPIO. High or low? Let’s find out. ✨

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO to be read.

If OK returns 0 (low) or 1 (high).

On failure returns a negative error code.

This command will work for any claimed GPIO (even if a member of a group). For an output GPIO the value returned will be that last written to the GPIO. Last written, not necessarily actual physical level. Important detail, bestie. πŸ‘‘


πŸŽ€ gpio_write πŸŽ€

int gpio_write(int sbc, int handle, int gpio, int value)

This sets the level of an output GPIO. Time to send a signal, periodt. πŸ”₯

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO to be written.
  • value β€” the value to write.

If OK returns 0.

On failure returns a negative error code.

This command will work for any GPIO claimed as an output (even if a member of a group). Group member? Still works. No drama. πŸ’œ

If level is zero the GPIO will be set low (0). If any other value is used the GPIO will be set high (1). Zero low, anything else high. Same rule as always. πŸ’…


🌸 group_read 🌸

int group_read(int sbc, int handle, int gpio, uint64_t *groupBits)

This returns the levels read from a group. Whole group, one read. Efficient queen. πŸ‘‘

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the offset of a member of the GPIO group to be read.
  • groupBits β€” a pointer to a 64-bit memory area for the returned value.

If OK returns the group size and updates groupBits.

On failure returns a negative error code.

This command will work for an output group as well as an input group. For an output group the value returned will be that last written to the group GPIO. Output group? Still works. Last written tea. ✨

Note that this command will also work on an individual GPIO claimed as an input or output as that is treated as a group with one member. Solo pin = group of one. Main character energy. ⭐

After a successful read groupBits is set as follows.

Bit 0 is the level of the group leader. Bit 1 is the level of the second GPIO in the group. Bit x is the level of GPIO x+1 of the group. Bit 0 = leader, bit 1 = second, and so on. Math but cute. πŸŽ€


πŸ’œ group_write πŸ’œ

int group_write(int sbc, int handle, int gpio, uint64_t groupBits, uint64_t groupMask)

This sets the levels of an output output group. Yes, β€œoutput output.” We said what we said. πŸ’€

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the offset of a member of the GPIO group to be written.
  • groupBits β€” the level to set if the corresponding bit in groupMask is set.
  • groupMask β€” a mask indicating the group GPIO to be updated.

If it goes well it returns 0. πŸ’–

If it does not, you get a negative error code back. 😭

So the tea on how the levels actually get set: each GPIO in the group takes its value from the bits of group_bits.

Bit 0 sets the level of the group leader. Bit 1 sets the level of the second GPIO in the group. Bit x sets the level of GPIO x+1 in the group. It's giving very orderly, very demure. ✨

But β€” plot twist β€” group_mask can override all of that. A GPIO is only updated if the corresponding bit in the mask is 1. That's it, that's the whole vibe check. πŸ‘‘


tx_pulse πŸ’…

int tx_pulse(int sbc, int handle, int gpio, int pulse_on, int pulse_off,
int pulse_offset, int pulse_cycles)

This starts software timed pulses on an output GPIO. Pulsing, bestie. 🫢

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” GPIO to be written.
  • pulse_on β€” pulse high time in microseconds.
  • pulse_off β€” pulse low time in microseconds.
  • pulse_offset β€” offset from nominal pulse start position.
  • pulse_cycles β€” the number of pulses to be sent, 0 for infinite.

If OK it returns the number of entries left in the PWM queue for the GPIO. ✨

On failure it returns a negative error code.

If both pulse_on and pulse_off are zero, pulses will be switched off for that GPIO. The active pulse, if any, will be stopped and any queued pulses will be deleted. Full stop, no leftovers. πŸ’€

Each successful call to this function consumes one PWM queue entry.

pulse_cycles cycles are transmitted (0 means infinite). Each cycle consists of pulse_on microseconds of GPIO high followed by pulse_off microseconds of GPIO low. That's the whole loop, she's simple and she's iconic. πŸŽ€

PWM is characterised by two values β€” its frequency (number of cycles per second) and its duty cycle (percentage of high time per cycle).

The set frequency will be 1000000 / (pulse_on + pulse_off) Hz.

The set duty cycle will be pulse_on / (pulse_on + pulse_off) * 100 %.

E.g. if pulse_on is 50 and pulse_off is 100 the frequency will be 6666.67 Hz and the duty cycle will be 33.33 %. Math girlies rise up. πŸ”₯

pulse_offset is a microsecond offset from the natural start of the pulse cycle.

For instance if the PWM frequency is 10 Hz the natural start of each cycle is at seconds 0, then 0.1, 0.2, 0.3 etc. In this case if the offset is 20000 microseconds the cycle will start at seconds 0.02, 0.12, 0.22, 0.32 etc. See how she shifts? Effortless. πŸ¦‹

Another pulse command may be issued to the GPIO before the last has finished.

If the last pulse had infinite cycles then it will be replaced by the new settings at the end of the current cycle. Otherwise it will be replaced by the new settings when all its cycles are complete.

Multiple pulse settings may be queued in this way. Queueing is self care, fr fr. 🌸


tx_pwm ⭐

int tx_pwm(int sbc, int handle, int gpio, float pwmFrequency, float
pwmDutyCycle, int pwmOffset, int pwmCycles)

This starts software timed PWM on an output GPIO.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open)
  • gpio β€” the GPIO to be pulsed
  • pwmFrequency β€” PWM frequency in Hz (0=off, 0.1-10000)
  • pwmDutyCycle β€” PWM duty cycle in % (0-100)
  • pwmOffset β€” offset from nominal pulse start position
  • pwmCycles β€” the number of pulses to be sent, 0 for infinite

If OK it returns the number of entries left in the PWM queue for the GPIO.

On failure it returns a negative error code.

Each successful call to this function consumes one PWM queue entry. One entry per call, that's the toll. πŸ™ˆ

PWM is characterised by two values β€” its frequency (number of cycles per second) and its duty cycle (percentage of high time per cycle).

Another PWM command may be issued to the GPIO before the last has finished.

If the last pulse had infinite cycles then it will be replaced by the new settings at the end of the current cycle. Otherwise it will be replaced by the new settings when all its cycles are complete.

Multiple PWM settings may be queued in this way. πŸ’œ


tx_servo 🧚

int tx_servo(int sbc, int handle, int gpio, int pulseWidth, int
servoFrequency, int servoOffset, int servoCycles)

This starts software timed servo pulses on an output GPIO.

Lowkey important: I would only use software timed servo pulses for testing purposes. The timing jitter will cause the servo to fidget. This may cause it to overheat and wear out prematurely. Girl is gonna burn out, and not in the cute way. 😭
  • handle β€” >= 0 (as returned by gpiochip_open)
  • gpio β€” the GPIO to be pulsed
  • pulseWidth β€” pulse high time in microseconds (0=0ff, 500-2500)
  • servoFrequency β€” the number of pulses per second (40-500)
  • servoOffset β€” offset from nominal pulse start position
  • servoCycles β€” the number of pulses to be sent, 0 for infinite

If OK it returns the number of entries left in the PWM queue for the GPIO. ✨

On failure it returns a negative error code.

Each successful call to this function consumes one PWM queue entry.

Another servo command may be issued to the GPIO before the last has finished.

If the last pulse had infinite cycles then it will be replaced by the new settings at the end of the current cycle. Otherwise it will be replaced by the new settings when all its cycles are complete.

Multiple servo settings may be queued in this way. Stack 'em up, bestie. πŸŽ€


tx_wave 🌈

int tx_wave(int sbc, int handle, int gpio, int count, lgPulse_p pulses)

This starts a software timed wave on an output group. Wave, like the emoji. πŸ‘‹βœ¨

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” group leader.
  • count β€” the number of pulses in the wave.
  • pulses β€” the pulses.

If OK it returns the number of entries left in the wave queue for the group.

On failure it returns a negative error code.

Each successful call to this function consumes one wave queue entry.

This command starts a wave of pulses.

pulses is an array of pulses to be transmitted on the group.

Each pulse is defined by the following triplet:

  • bits β€” the levels to set for the selected GPIO
  • mask β€” the GPIO to select
  • delay β€” the delay in microseconds before the next pulse

Another wave command may be issued to the group before the last has finished transmission. The new wave will start when the previous wave has completed. No cutting the line, she waits her turn. πŸ’…

Multiple waves may be queued in this way.


tx_busy πŸ‘‘

int tx_busy(int sbc, int handle, int gpio, int kind)

This returns true if transmissions of the specified kind are active on the GPIO or group. Is she busy or is she free? Let's find out. πŸ”₯

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO or group to be tested.
  • kind β€” LG_TX_PWM or LG_TX_WAVE.

If OK it returns 1 for busy and 0 for not busy.

On failure it returns a negative error code.


tx_room πŸ“

int tx_room(int sbc, int handle, int gpio, int kind)

This returns the number of entries there are to queue further transmissions of the specified kind on a GPIO or GPIO group. Basically: how much room is left in the queue, bestie? 🫢

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO or group to be tested.
  • kind β€” LG_TX_PWM or LG_TX_WAVE.

If OK it returns the number of free entries (0 for none). Zero room means no room, periodt.

On failure it returns a negative error code.


gpio_set_debounce_time 🌸

int gpio_set_debounce_time(int sbc, int handle, int gpio, int
debounce_us)

This sets the debounce time for a GPIO.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO to be configured.
  • debounce_us β€” the debounce time in microseconds.

If OK it returns 0.

On failure it returns a negative error code.

This only affects alerts.

An alert will only be issued if the edge has been stable for at least debounce microseconds.

Generally this is used to debounce mechanical switches (e.g. contact bounce). Shaky switches, we're calming you down. 🧘

Suppose that a square wave at 5 Hz is being generated on a GPIO. Each edge will last 100000 microseconds. If a debounce time of 100001 is set no alerts will be generated, If a debounce time of 99999 is set 10 alerts will be generated per second.

Note that level changes will be timestamped debounce microseconds after the actual level change. The timestamps are late to the party, and that's on purpose. πŸ’€

gpio_set_watchdog_time 🐢

int gpio_set_watchdog_time(int sbc, int handle, int gpio, int
watchdog_us)

This sets the watchdog time for a GPIO.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” the GPIO to be configured.
  • watchdog_us β€” the watchdog time in microseconds.

If OK it returns 0.

On failure it returns a negative error code.

This only affects alerts.

A watchdog alert will be sent if no edge alert has been issued for that GPIO in the previous watchdog microseconds. It's giving "bestie has been quiet for too long, someone check on her". πŸ‘€

Note that only one watchdog alert will be sent per stream of edge alerts. The watchdog is reset by the sending of a new edge alert.

The level is set to LG_TIMEOUT (2) for a watchdog alert. ⏰


gpio_claim_alert 🚨

int gpio_claim_alert(int sbc, int handle, int lFlags, int eFlags, int
gpio, int nfyHandle)

This claims a GPIO to be used as a source of alerts on level changes. Claiming her, she's taken, back off. πŸ’…

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by gpiochip_open).
  • gpio β€” >= 0, as legal for the gpiochip.
  • lFlags β€” line flags for the GPIO.
  • eFlags β€” event flags for the GPIO.
  • nfyHandle β€” >=0, a notification handle (use -1 for callbacks).

If OK it returns 0.

On failure it returns a negative error code.

The line flags may be used to set the GPIO as active low, open drain, open source, pull up, pull down, pull off.

The event flags are used to generate alerts for a rising edge, falling edge, or both edges.

Use a notification handle of -1 unless you plan to read the alerts from a notification pipe you have opened. You have been warned, bestie. 😭


callback πŸ’–

int callback(int sbc, int handle, int gpio, int edge, CBFunc_t f, void
*userdata)

This function initialises a new callback. So every time the thing happens, your lil function gets called. Obsessed. ✨

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0,(as returned by gpiochip_open).
  • gpio β€” >= 0, as legal for the gpiochip.
  • edge β€” RISING_EDGE, FALLING_EDGE, or BOTH_EDGES.
  • f β€” the callback function.
  • userdata β€” a pointer to arbitrary user data.

If OK it returns a callback id.

On failure it returns a negative error code.

Okay so like, your user-supplied callback receives the chip, GPIO, edge, timestamp, and the userdata pointer whenever the GPIO has the identified edge. πŸ’–

The reported level will be one of (vibe check):

  • 0: change to low (a falling edge)
  • 1: change to high (a rising edge)
  • 2: no level change (a watchdog timeout)

The timestamp is when the change happened, reported as the number of nanoseconds since the epoch (start of 1970). ⏳

If you want to track the level of more than one GPIO, do so by maintaining the state in the callback. Do not use gpio_read. Remember the alert that triggered the callback may have happened several milliseconds before and the GPIO may have changed level many times since then. So like, don't trust it for current state, bestie. 😭 No cap.


int callback_cancel(int callback_id)

This function cancels a callback identified by its id. πŸ’… Periodt.

  • callback_id: >= 0 (as returned by callback).

If OK returns 0.

On failure returns a negative error code.


int i2c_open(int sbc, int i2c_bus, int i2c_addr, int i2c_flags)

This returns a handle for the device at address i2c_addr on bus i2c_bus. πŸŽ€ It's giving privileged.

This is a privileged command. See permits.
  • sbc: >= 0 (as returned by rgpiod_start).
  • i2c_bus: >= 0.
  • i2c_addr: 0-0x7F.
  • i2c_flags: 0.

If OK returns a handle (>= 0).

On failure returns a negative error code.

No flags are currently defined. This parameter should be set to zero.

For the SMBus commands the low level transactions are shown at the end of the function description. The following abbreviations are used.

S       (1 bit) : Start bit
P       (1 bit) : Stop bit
Rd/Wr   (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
A, NA   (1 bit) : Accept and not accept bit.
Addr    (7 bits): I2C 7 bit address.
i2c_reg (8 bits): A byte which often selects a register.
Data    (8 bits): A data byte.
Count   (8 bits): A byte defining the length of a block operation.

[..]: Data sent by the device.

int i2c_close(int sbc, int handle)

This closes the I2C device. πŸ‘‹

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).

If OK returns 0.

On failure returns a negative error code.


int i2c_write_quick(int sbc, int handle, int bitVal)

This sends a single bit (in the Rd/Wr bit) to the device. ⚑

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • bitVal: 0-1, the value to write.

If OK returns 0.

On failure returns a negative error code.

Quick command. SMBus 2.0 5.5.1

S Addr bit [A] P

int i2c_write_byte(int sbc, int handle, int byteVal)

This sends a single byte to the device. πŸ“¦

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • byteVal: 0-0xFF, the value to write.

If OK returns 0.

On failure returns a negative error code.

Send byte. SMBus 2.0 5.5.2

S Addr Wr [A] byteVal [A] P

int i2c_read_byte(int sbc, int handle)

This reads a single byte from the device. πŸ“–

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).

If OK returns the byte read (0-255).

On failure returns a negative error code.

Receive byte. SMBus 2.0 5.5.3

S Addr Rd [A] [Data] NA P

int i2c_write_byte_data(int sbc, int handle, int i2c_reg, int byteVal)

This writes a single byte to the specified register of the device. ✍️

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to write.
  • byteVal: 0-0xFF, the value to write.

If OK returns 0.

On failure returns a negative error code.

Write byte. SMBus 2.0 5.5.4

S Addr Wr [A] i2c_reg [A] byteVal [A] P

int i2c_write_word_data(int sbc, int handle, int i2c_reg, int wordVal)

This writes a single 16 bit word to the specified register of the device. πŸ’Ύ

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to write.
  • wordVal: 0-0xFFFF, the value to write.

If OK returns 0.

On failure returns a negative error code.

Write word. SMBus 2.0 5.5.4

S Addr Wr [A] i2c_reg [A] wval_Low [A] wVal_High [A] P

int i2c_read_byte_data(int sbc, int handle, int i2c_reg)

This reads a single byte from the specified register of the device. πŸ”

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to read.

If OK returns the read byte (0-255).

On failure returns a negative error code.

Read byte. SMBus 2.0 5.5.5

S Addr Wr [A] i2c_reg [A] S Addr Rd [A] [Data] NA P

int i2c_read_word_data(int sbc, int handle, int i2c_reg)

This reads a single 16 bit word from the specified register of the device. πŸ“–

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to read.

If OK returns the read word (0-65535).

On failure returns a negative error code.

Read word. SMBus 2.0 5.5.5

S Addr Wr [A] i2c_reg [A]
   S Addr Rd [A] [DataLow] A [DataHigh] NA P

int i2c_process_call(int sbc, int handle, int i2c_reg, int wordVal)

This writes 16 bits of data to the specified register of the device and reads 16 bits of data in return. πŸ”„

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to write/read.
  • wordVal: 0-0xFFFF, the value to write.

If OK returns the read word (0-65535).

On failure returns a negative error code.

Process call. SMBus 2.0 5.5.6

S Addr Wr [A] i2c_reg [A] wVal_Low [A] wVal_High [A]
   S Addr Rd [A] [DataLow] A [DataHigh] NA P

int i2c_write_block_data(int sbc, int handle, int i2c_reg, const char *buf, int count)

This writes up to 32 bytes to the specified register of the device. πŸ“¦

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to write.
  • buf: an array with the data to send.
  • count: 1-32, the number of bytes to write.

If OK returns 0.

On failure returns a negative error code.

Block write. SMBus 2.0 5.5.7

S Addr Wr [A] i2c_reg [A] count [A] buf0 [A] buf1 [A] ...
   [A] bufn [A] P

int i2c_read_block_data(int sbc, int handle, int i2c_reg, char *buf)

This reads a block of up to 32 bytes from the specified register of the device. πŸ“–

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to read.
  • buf: an array to receive the read data.

If OK returns the count of bytes read and updates buf.

On failure returns a negative error code.

The amount of returned data is set by the device.

Block read. SMBus 2.0 5.5.7

S Addr Wr [A] i2c_reg [A]
   S Addr Rd [A] [Count] A [buf0] A [buf1] A ... A [bufn] NA P

int i2c_block_process_call(int sbc, int handle, int i2c_reg, char *buf, int count)

This writes data bytes to the specified register of the device and reads a device specified number of bytes of data in return. πŸ”„

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to write/read.
  • buf: an array with the data to send and to receive the read data.
  • count: 1-32, the number of bytes to write.

If OK returns the count of bytes read and updates buf.

On failure returns a negative error code.

The smbus 2.0 documentation states that a minimum of 1 byte may be sent and a minimum of 1 byte may be received. The total number of bytes sent/received must be 32 or less.

Block write-block read. SMBus 2.0 5.5.8

S Addr Wr [A] i2c_reg [A] count [A] buf0 [A] ...
   S Addr Rd [A] [Count] A [Data] ... A P

int i2c_read_i2c_block_data(int sbc, int handle, int i2c_reg, char *buf, int count)

This reads count bytes from the specified register of the device. The count may be 1-32. πŸ“–

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to read.
  • buf: an array to receive the read data.
  • count: 1-32, the number of bytes to read.

If OK returns the count of bytes read and updates buf.

On failure returns a negative error code.

S Addr Wr [A] i2c_reg [A]
   S Addr Rd [A] [buf0] A [buf1] A ... A [bufn] NA P

int i2c_write_i2c_block_data(int sbc, int handle, int i2c_reg, const char *buf, int count)

This writes 1 to 32 bytes to the specified register of the device. ✍️

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • i2c_reg: 0-255, the register to write.
  • buf: the data to write.
  • count: 1-32, the number of bytes to write.

If OK returns 0.

On failure returns a negative error code.

S Addr Wr [A] i2c_reg [A] buf0 [A] buf1 [A] ... [A] bufn [A] P

int i2c_read_device(int sbc, int handle, char *buf, int count)

This reads count bytes from the raw device into buf. πŸ“–

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • buf: an array to receive the read data bytes.
  • count: >0, the number of bytes to read.

If OK returns the count of bytes read and updates buf.

On failure returns a negative error code.

S Addr Rd [A] [buf0] A [buf1] A ... A [bufn] NA P

int i2c_write_device(int sbc, int handle, const char *buf, int count)

This writes count bytes from buf to the raw device. ✍️

  • sbc: >= 0 (as returned by rgpiod_start).
  • handle: >= 0 (as returned by i2c_open).
  • buf: an array containing the data bytes to write.
  • count: >0, the number of bytes to write.

If OK returns 0.

On failure returns a negative error code.

S Addr Wr [A] buf0 [A] buf1 [A] ... [A] bufn [A] P

int i2c_zip(int sbc, int handle, const char *inBuf, int inCount, char *outBuf, int outCount)

This function executes a sequence of I2C operations. The operations to be performed are specified by the contents of inBuf which contains the concatenated command codes and associated data. 🀯

  • sbc β€” >= 0, and it's whatever rgpiod_start handed you back.
  • handle β€” >= 0, the one you got from calling lgI2cOpen.
  • inBuf β€” pointer to all your I2C commands smooshed together (deets below bestie, keep reading).
  • inCount β€” how big that command buffer is.
  • outBuf β€” pointer to the buffer where the returned data goes.
  • outCount β€” how big the output buffer is.

If everything's good, it returns the count of bytes read and updates outBuf for you. 🫢

If it fails, you get a negative error code back. No vibes.

Here's the command codes it speaks β€” literally the whole language:

  • End β€” cmd & data 0 β€” no more commands, we're done here periodt.
  • Escape β€” cmd & data 1 β€” the next P is two bytes.
  • On β€” cmd & data 2 β€” switch the combined flag on.
  • Off β€” cmd & data 3 β€” switch the combined flag off.
  • Address β€” cmd & data 4 P β€” set the I2C address to P.
  • Flags β€” cmd & data 5 lsb msb β€” set the I2C flags to lsb + (msb << 8).
  • Read β€” cmd & data 6 P β€” read P bytes of data.
  • Write β€” cmd & data 7 P ... β€” write P bytes of data.

The address, read, and write commands all take a parameter P. Normally P is one byte (0-255). But if the command gets preceded by the Escape command, then P is two bytes (0-65535, least significant byte first). πŸ‘‘

The address defaults to whatever's associated with the handle. The flags default to 0. Both the address and the flags just hold onto their previous value until something updates them β€” they're loyal like that.

The returned I2C data gets stored in consecutive locations of outBuf. ✨

Example

Set address 0x53, write 0x32, read 6 bytes Set address 0x1E, write 0x03, read 6 bytes Set address 0x68, write 0x1B, read 8 bytes End

0x04 0x53   0x07 0x01 0x32   0x06 0x06
0x04 0x1E   0x07 0x01 0x03   0x06 0x06
0x04 0x68   0x07 0x01 0x1B   0x06 0x08
0x00

int notify_open(int sbc)

Grab yourself a free notification handle. πŸŽ€

This is a privileged command. See permits.
  • sbc β€” >= 0 (as returned by rgpiod_start).

If it works you get a handle (>= 0).

If it fails you get a negative error code.

So like, a notification is the whole method for getting notified about GPIO state changes via a pipe. πŸ¦‹

Pipes are only accessible from the local machine, so this function is genuinely pointless if you're using the library from a remote machine. Use the in-built (socket) notifications that callback gives you instead, bestie. πŸ’…

The notification pipes get created in the library working directory.

Notifications for handle x will be available at the pipe named .lgd-nfyx (where x is the handle number). So if the function returns 15, you read the notifications from .lgd-nfy15.

Each notification occupies 16 bytes in the fifo and has this exact structure:

typedef struct
{
   uint64_t timestamp; // alert time in nanoseconds
   uint8_t chip;       // gpiochip device number
   uint8_t gpio;       // offset into gpio device
   uint8_t level;      // 0=low, 1=high, 2=timeout
   uint8_t flags;      // none currently defined
} lgGpioReport_t;
  • timestamp β€” the number of nanoseconds since the epoch (start of 1970).
  • chip β€” the gpiochip device number (NOT the handle, ok?).
  • gpio β€” the GPIO.
  • level β€” tells you the level of the GPIO.
  • flags β€” no flags are currently defined.

For future proofing, it's probably best to just ignore any notification with non-zero flags. πŸ™ˆ


int notify_resume(int sbc, int handle)

Resume notifications on a handle. We're back, babes. ✨

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by notify_open).

If OK it returns 0.

On failure it returns a negative error code.


int notify_pause(int sbc, int handle)

Pauses notifications on a handle. Shhh, it's napping. 😴

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by notify_open).

If OK it returns 0.

On failure it returns a negative error code.

Notifications for the handle are suspended until notify_resume gets called. So don't leave it hanging fr fr.


int notify_close(int sbc, int handle)

Stop notifications and release the handle. It's giving closure. πŸ’…

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by notify_open).

If OK it returns 0.

On failure it returns a negative error code.


int script_store(int sbc, const char *script)

This one stores a script so you can execute it later. Save it for your future self, iconic behaviour honestly. πŸŽ€

This is a privileged command. See permits.

See scripts.html for details. πŸ‘€

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • script β€” the text of the script.

If OK it returns a handle (>=0).

On failure it returns a negative error code.


int script_run(int sbc, int handle, int count, const uint32_t *param)

This function runs a stored script. Go bestie go. πŸ”₯

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by script_store).
  • count β€” 0-10, the number of parameters.
  • param β€” an array of parameters.

If OK it returns 0.

On failure it returns a negative error code.

param is an array of up to 10 parameters which may be referenced in the script as p0 to p9.


int script_update(int sbc, int handle, int count, const uint32_t *param)

This sets the parameters of a script. The script may or may not be running β€” no judgement either way, we support all states here. πŸ’œ The first numPar parameters of the script get overwritten with the new values.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by script_store).
  • count β€” 0-10, the number of parameters.
  • param β€” an array of parameters.

If OK it returns 0.

On failure it returns a negative error code.

param is an array of up to 10 parameters which may be referenced in the script as p0 to p9.


int script_status(int sbc, int handle, uint32_t *param)

This returns the run status of a stored script plus the current values of parameters 0 to 9. It's giving full transparency. πŸ¦‹

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by script_store).
  • param β€” an array to hold the returned 10 parameters.

If OK it returns the script status and updates param.

On failure it returns a negative error code.

The script status may be:

  • LG_SCRIPT_INITING
  • LG_SCRIPT_READY
  • LG_SCRIPT_RUNNING
  • LG_SCRIPT_WAITING
  • LG_SCRIPT_ENDED
  • LG_SCRIPT_HALTED
  • LG_SCRIPT_FAILED

The current value of script parameters 0 to 9 are returned in param.


int script_stop(int sbc, int handle)

This function stops a running script. Sit down. βœ‹

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by script_store).

If OK it returns 0.

On failure it returns a negative error code.


int script_delete(int sbc, int handle)

This function deletes a stored script. Gone, and honestly? Not missed. πŸ’€

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by script_store).

If OK it returns 0.

On failure it returns a negative error code.


int serial_open(int sbc, const char *ser_tty, int ser_baud, int ser_flags)

Opens a serial device at a specified baud rate with specified flags. The device has to be present in /dev, no cap. πŸ”Œ

This is a privileged command. See permits.
  • sbc β€” >= 0 (as returned by rgpiod_start).
  • ser_tty β€” the serial device to open.
  • ser_baud β€” the baud rate in bits per second, see below.
  • ser_flags β€” 0.

If OK it returns 0.

On failure it returns a negative error code.

The baud rate must be one of 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, or 230400. That's the whole list, bestie β€” don't get creative. 😭

No flags are currently defined. This parameter should be set to zero.


int serial_close(int sbc, int handle)

This function closes the serial device.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by serial_open).

If OK it returns 0.

On failure it returns a negative error code.


int serial_write_byte(int sbc, int handle, int byteVal)

This function writes byteVal to the serial port.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by serial_open).

If OK it returns 0.

On failure it returns a negative error code.


int serial_read_byte(int sbc, int handle)

This function reads a byte from the serial port.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by serial_open).

If OK it returns the read byte (0-255).

On failure it returns a negative error code.


int serial_write(int sbc, int handle, const char *buf, int count)

This function writes count bytes from buf to the the serial port.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by serial_open).
  • buf β€” the array of bytes to write.
  • count β€” the number of bytes to write.

If OK it returns 0.

On failure it returns a negative error code.


int serial_read(int sbc, int handle, char *buf, int count)

This function reads up to count bytes from the the serial port and writes them to buf.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by serial_open).
  • buf β€” an array to receive the read data.
  • count β€” the maximum number of bytes to read.

If OK it returns the count of bytes read and updates buf.

On failure it returns a negative error code.

If no data is ready, zero is returned. (Not an error, just quiet. 🀫)


int serial_data_available(int sbc, int handle)

Returns the number of bytes available to be read from the device.

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by serial_open).

If OK it returns the count of bytes available.

On failure it returns a negative error code.


int shell(int sbc, const char *scriptName, const char *scriptString)

This function uses the system call to execute a shell script, with the given string as its parameter. 🐚

This is a privileged command. See permits.
  • sbc β€” >= 0 (as returned by rgpiod_start).
  • scriptName β€” the name of the script; only alphanumeric characters, - and _ are allowed in the name.
  • scriptString β€” the string to pass to the script.

If OK it returns 0.

On failure it returns a negative error code.

scriptName must exist in a directory named cgi in the daemon's configuration directory, and it must be executable. No exceptions, the rules are the rules. πŸ‘‘

The returned exit status is normally 256 times that set by the shell script exit function. If the script can't be found, 32512 will be returned.

And here's a lil table of some example returned statuses πŸ‘‡

  • script exit status 1 β†’ returned system call status 256
  • script exit status 5 β†’ returned system call status 1280
  • script exit status 10 β†’ returned system call status 2560
  • script exit status 200 β†’ returned system call status 51200
  • script exit status script not found β†’ returned system call status 32512

Lowkey the numbers go up a lil aggressively, that's just how it is bestie, multiply-by-256 energy. πŸ’…

Example β€” look at how you pass args:

// pass two parameters, hello and world
status = shell_(sbc, "scr1", "hello world");

// pass three parameters, hello, string with spaces, and world
status = shell_(sbc, "scr1", "hello 'string with spaces' world");

// pass one parameter, hello string with spaces world
status = shell_(sbc, "scr1", "

🌈 int spi_open(int sbc, int spi_device, int spi_channel, int spi_baud, int spi_flags)

Okay so this one hands you back a handle for the SPI device on the channel. Data gets transferred at spi_baud bits per second. The flags? They're your little levers for tweaking the default behaviour. πŸŽ›οΈ

Not me reminding you: this is a privileged command. See permits. πŸ‘‘
  • sbc β€” >= 0 (as returned by rgpiod_start).
  • spi_device β€” >= 0
  • spi_channel β€” >= 0
  • spi_baud β€” SPI speed in bits per second.
  • spi_flags β€” see below.

If it's OK it returns a handle (>= 0). 🫢

On failure it returns a negative error code. 😭

So spi_flags is literally just the least significant 2 bits, bestie:

1  0
m  m

and mm is what defines the SPI mode. Iconic bitfield behaviour, honestly.

Mode POL PHA
 0    0   0
 1    0   1
 2    1   0
 3    1   1

The other bits in flags should be set to zero. Periodt. ✨


πŸ¦‹ int spi_close(int sbc, int handle)

This function closes the SPI device identified by the handle. Closing things is self-care fr fr. πŸŽ€

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by spi_open).

If OK it returns 0.

On failure it returns a negative error code.


⭐ int spi_read(int sbc, int handle, char *buf, int count)

This function reads count bytes of data from the SPI device. Nom nom bytes. πŸ“

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by spi_open).
  • buf β€” an array to receive the read data bytes.
  • count β€” the number of bytes to read.

If OK it returns the count of bytes read and updates buf. 🫢

On failure it returns a negative error code.


πŸ’œ int spi_write(int sbc, int handle, const char *buf, int count)

This function writes count bytes of data from buf to the SPI device. Sending it, slay. ✨

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by spi_open).
  • buf β€” the data bytes to write.
  • count β€” the number of bytes to write.

If OK it returns the count of bytes written.

On failure it returns a negative error code.


πŸ”₯ int spi_xfer(int sbc, int handle, const char *txBuf, char *rxBuf, int count)

This function transfers count bytes of data from txBuf to the SPI device. Simultaneously count bytes of data are read from the device and placed in rxBuf. It's giving full duplex main character energy. πŸ‘‘

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0 (as returned by spi_open).
  • txBuf β€” the data bytes to write.
  • rxBuf β€” the received data bytes.
  • count β€” the number of bytes to transfer.

If OK it returns the count of bytes transferred and updates rxBuf. 🌸

On failure it returns a negative error code.


🧚 pthread_t *thread_start(lgThreadFunc_t thread_func, void *userdata)

Starts a whole new thread of execution with thread_func as the main routine. Baby thread, go live your life. πŸ’–

  • thread_func β€” the main function for the new thread.
  • userdata β€” a pointer to an arbitrary argument.

If OK it returns a pointer to a pthread_t.

On failure it returns NULL. 😭

The function is passed the single argument userdata.

The thread can be cancelled by passing the pointer to pthread_t to thread_stop.


🌈 void thread_stop(pthread_t *pth)

Cancels the thread pointed at by pth. Rip bozo, respectfully. πŸ’€

  • pth β€” the thread to be stopped.

No value is returned.

The thread to be stopped should have been started with thread_start.


πŸŽ€ int lgu_get_internal(int sbc, int config_id, uint64_t *config_value)

Returns the value of a sbc configuration item. Peeking behind the curtain, iykyk. πŸ™ˆ

This is a privileged command. See permits. πŸ‘‘
  • sbc β€” >= 0 (as returned by rgpiod_start).
  • config_id β€” the configuration item.
  • config_value β€” pointer for returned value.

If OK it returns 0 and updates config_value.

On failure it returns a negative error code.


πŸ’… int lgu_set_internal(int sbc, int config_id, uint64_t config_value)

Sets the value of a sbc configuration item. Now you're the one moving the levers. πŸŽ›οΈ

This is a privileged command. See permits. πŸ‘‘
  • sbc β€” >= 0 (as returned by rgpiod_start).
  • config_id β€” the configuration item.
  • config_value β€” the value to set.

If OK it returns 0.

On failure it returns a negative error code.


πŸ¦‹ int lgu_get_sbc_name(int sbc, char *buf, int count)

Return the lgd server name. Identity check, who are you bestie. πŸ‘€

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • buf β€” the server name is copied to this buffer.
  • count β€” the maximum number of characters to copy.

If OK it returns the count of bytes copied and updates buf.

On failure it returns a negative error code.


⭐ int lgu_set_user(int sbc, const char *user, const char *secretsFile)

Sets the rgpiod daemon user. The user then has the associated permissions. Glow-up via permissions, honestly. ✨

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • user β€” the user to set ("" defaults to the default user).
  • secretsFile β€” the path to the shared secret file ("" defaults to "~/.lg_secret").

If OK it returns 1 if the user was set, 0 otherwise.

On failure it returns a negative error code.

Example:

if (lgu_set_user(sbc, "gpio", "")
{
   printf("using user gpio permissions");
}
else
{
   printf("using default permissions");
}

πŸ’œ int lgu_set_share_id(int sbc, int handle, int share_id)

Sets the share id of an owned object. Sharing is caring, fr fr. 🫢

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • handle β€” >= 0
  • share_id β€” >= 0, 0 stops sharing.

If OK it returns 0.

On failure it returns a negative error code.

Normally objects associated with a handle are only accessible to the program which created them (and are automatically deleted when the program ends).

If a non-zero share is set the object is accessible to any software which knows the share and the handle (and are not automatically deleted when the program ends).

Example:

lgu_set_share_id(sbc, handle, 23);

πŸ“ int lgu_use_share_id(int sbc, int share_id)

Sets the share id to be used when asking to use an object owned by another creator. Borrowing from a friend, we love to see it. πŸŽ€

  • sbc β€” >= 0 (as returned by rgpiod_start).
  • share_id β€” >= 0, 0 stops sharing.

If OK it returns 0.

On failure it returns a negative error code.

Normally objects associated with a handle are only accessible to the program which created them (and are automatically deleted when the program ends).

If a non-zero share is set the object is accessible to any software which knows the share and the handle.

Example:

lgu_use_share_id(sbc, 23);

πŸ‘‘ uint32_t lgu_rgpio_version(void)

Return the rgpio version. Version check, because knowing is half the battle. 🌟

If OK it returns the rgpio version.

On failure it returns a negative error code.


🌸 const char *lgu_error_text(int errnum)

Return a text description for an error code. Translating the drama into words. πŸ’¬

  • errnum β€” the error code.

πŸ’– void lgu_sleep(double sleepSecs)

Delay execution for a given number of seconds. Nap time, deserved. 😴

  • sleepSecs β€” the number of seconds to delay.

🧚 double lgu_time(void)

Return the current time in seconds since the Epoch.


⭐ uint64_t lgu_timestamp(void)

Return the current time in nanoseconds since the Epoch. Nanoseconds, because we're precise like that. πŸ’…

✨ PARAMETERS ✨

  • *addrStr β€” A string specifying the host or IP address of the SBC running the rgpiod daemon. It may be NULL in which case localhost is used unless overridden by the LG_ADDR environment variable.
  • bitVal β€” A value of 0 or 1.
  • *buf β€” A buffer to hold data being sent or being received.
  • byteVal: 0-255 β€” An 8-bit byte value.
  • callback_id β€” A value >= 0, as returned by a call to the callback. The id is passed to callback_cancel to cancel the callback.
  • CBFunc_t β€”
typedef void (*CBFunc_t)
   (int sbc, int chip, int gpio, int level, uint64_t timestamp, void * userdata);
  • char β€” A single character, an 8 bit quantity able to store 0-255.
  • chipInfo β€” A pointer to a lgChipInfo_t object.
  • config_id β€” A number identifying a configuration item. Values: LG_CFG_ID_DEBUG_LEVEL 0, LG_CFG_ID_MIN_DELAY 1.
  • config_value β€” The value of a configuration item.
  • *config_value β€” The value of a configuration item.
  • count β€” The number of bytes to be transferred in a file, I2C, SPI, or serial command.
  • debounce_us β€” The debounce time in microseconds.
  • double β€” A floating point number.
  • edge β€” Used to identify a GPIO level transition of interest. A rising edge is a level change from 0 to 1. A falling edge is a level change from 1 to 0. Values: RISING_EDGE 1, FALLING_EDGE 2, BOTH_EDGES 3.
  • eFlags β€” The type of GPIO edge to generate an alert. See gpio_claim_alert. Values: RISING_EDGE 1, FALLING_EDGE 2, BOTH_EDGES 3.
  • errnum β€” A negative number indicating a function call failed and the nature of the error.
  • f β€” A function.
  • *file β€” A full file path. To be accessible the path must match an entry in the [files] section of the permits file.
  • float β€” A floating point number.
  • *fpat β€” A file path which may contain wildcards. To be accessible the path must match an entry in the [files] section of the permits file.
  • gpio β€” A 0 based offset of a GPIO within a gpiochip.
  • gpioDev: >= 0 β€” The device number of a gpiochip.
  • *gpios β€” An array of GPIO numbers.
  • groupBits β€” A 64-bit value used to set the levels of a GPIO group. Set bit x to set GPIO x of the group high. Clear bit x to set GPIO x of the group low.
  • *groupBits β€” A 64-bit value denoting the levels of a GPIO group. If bit x is set then GPIO x of the group is high.
  • groupMask β€” A 64-bit value used to determine which members of a GPIO group should be updated. Set bit x to update GPIO x of the group. Clear bit x to leave GPIO x of the group unaltered.
  • handle: >= 0 β€” A number referencing an object opened by one of file_open, gpiochip_open, i2c_open, notify_open, serial_open script_store, spi_open.
  • i2c_addr: 0-0x7F β€” The address of a device on the I2C bus.
  • i2c_bus: >= 0 β€” An I2C bus number.
  • i2c_flags: 0 β€” Flags which modify an I2C open command. None are currently defined.
  • i2c_reg: 0-255 β€” A register of an I2C device.
  • *inBuf β€” A buffer used to pass data to a function.
  • inCount β€” The size of an input buffer.
  • int β€” A whole number, negative or positive.
  • int32_t β€” A 32-bit signed value.
  • kind: LG_TX_PWM or LG_TX_WAVE β€” A type of transmission: PWM or wave.
  • lFlags β€” Line flags for the GPIO. The following values may be or'd to form the value. LG_SET_ACTIVE_LOW, LG_SET_OPEN_DRAIN, LG_SET_OPEN_SOURCE, LG_SET_PULL_UP, LG_SET_PULL_DOWN, LG_SET_PULL_NONE.
  • lgChipInfo_p β€” A pointer to a lgChipInfo_t object.
typedef struct lgChipInfo_s
{
   uint32_t lines;                // number of GPIO
   char name[LG_GPIO_NAME_LEN];   // Linux name
   char label[LG_GPIO_LABEL_LEN]; // functional name
} lgChipInfo_t, *lgChipInfo_p;
  • lgLineInfo_p β€” A pointer to a lgLineInfo_t object.
typedef struct lgLine_s
{
   uint32_t offset;               // GPIO number
   uint32_t lFlags;
   char name[LG_GPIO_NAME_LEN];   // GPIO name
   char user[LG_GPIO_USER_LEN];   // user
} lgLineInfo_t, *lgLineInfo_p;
  • lgPulse_p β€” A pointer to a lgPulse_t object.
typedef struct lgPulse_s
{
   uint64_t bits;
   uint64_t mask;
   int64_t delay;
} lgPulse_t, *lgPulse_p;
  • lgThreadFunc_t β€”
typedef void *(lgThreadFunc_t) (void *);
  • lineInfo β€” A pointer to a lgLineInfo_t object.
  • mode β€” A file open mode. Values: LG_FILE_READ 1, LG_FILE_WRITE 2, LG_FILE_RW 3. The following values can be or'd into the mode: LG_FILE_APPEND 4, LG_FILE_CREATE 8, LG_FILE_TRUNC 16.
  • nfyHandle: >= 0 β€” This associates a notification with a GPIO alert.
  • *outBuf β€” A buffer used to return data from a function.
  • outCount β€” The size of an output buffer.
  • *param β€” An array of script parameters.
  • *portStr β€” A string specifying the port address used by the SBC running the rgpiod daemon. It may be NULL in which case "8889" is used unless overridden by the LG_PORT environment variable.
  • *pth β€” A thread identifier, returned by thread_start.
  • pthread_t β€” A thread identifier.
  • pulse_cycles: >= 0 β€” The number of pulses to generate. A value of 0 means infinite.#
  • pulse_off: >= 0 β€” The off period for a pulse in microseconds.
  • pulse_offset: >= 0 β€” The offset in microseconds from the nominal pulse start.
  • pulse_on: >= 0 β€” The on period for a pulse in microseconds.
  • pulses β€” An pointer to an array of lgPulse_t objects.
  • pulseWidth: 0, 500-2500 microseconds β€” Servo pulse width
  • pwmCycles: >= 0 β€” The number of PWM pulses to generate. A value of 0 means infinite.
  • pwmDutyCycle: 0-100 % β€” PWM duty cycle %
  • pwmFrequency: 0.1-10000 Hz β€” PWM frequency
  • pwmOffset: >= 0 β€” The offset in microseconds from the nominal PWM pulse start.
  • *rxBuf β€” A pointer to a buffer to receive data.
  • sbc β€” An integer defining a connected SBC. The value is returned by rgpiod_start upon success.
  • *script β€” A pointer to the text of a script.
  • *scriptName β€” The name of a shell_ script to be executed. The script must be present in the cgi directory of the daemon's configuration directory and must have execute permission.
  • *scriptString β€” The string to be passed to a shell_ script to be executed.
  • *secretsFile β€” The file containing the shared secret for a user. If the shared secret for a user matches that known by the rgpiod daemon the user can "log in" to the daemon.
  • seekFrom β€” Values: LG_FROM_START 0, LG_FROM_CURRENT 1, LG_FROM_END 2.
  • seekOffset β€” The number of bytes to move forward (positive) or backwards (negative) from the seek position (start, current, or end of file).
  • ser_baud β€” The speed of serial communication in bits per second.
  • ser_flags β€” Flags which modify a serial open command. None are currently defined.
  • *ser_tty β€” The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
  • servoCycles: >= 0 β€” The number of servo pulses to generate. A value of 0 means infinite.
  • servoFrequency: 40-500 Hz β€” Servo pulse frequency
  • servoOffset: >= 0 β€” The offset in microseconds from the nominal servo pulse start.
  • share_id β€” Objects created with a non-zero share_id are persistent and may be used by other software which knows the share_id.
  • sleepSecs β€” The number of seconds to delay.
  • spi_baud β€” The speed of SPI communication in bits per second.
  • spi_channel: >= 0 β€” A SPI channel.
  • spi_device: >= 0 β€” A SPI device.
  • spi_flags β€” See spi_open and bb_spi_open.
  • thread_func β€” A function of type gpioThreadFunc_t used as the main function of a thread.
  • *txBuf β€” An array of bytes to transmit.
  • uint32_t β€” A 32-bit unsigned value.
  • uint64_t β€” A 64-bit unsigned value.
  • *user β€” A name known by the rgpiod daemon and associated with a set of user permissions.
  • *userdata β€” A pointer to arbitrary user data. This may be used to identify the instance.

You must ensure that the pointer is in scope at the time it is processed. If it is a pointer to a global this is automatic. Do not pass the address of a local variable. If you want to pass a transient object then use the following technique.

In the calling function:

user_type *userdata;
user_type my_userdata;

userdata = malloc(sizeof(user_type));
*userdata = my_userdata;

In the receiving function:

user_type my_userdata = *(user_type*)userdata;

free(userdata);
  • value: 0-1 β€” A GPIO level.
  • *values β€” An array of GPIO values.
  • void β€” Denoting no parameter is required
  • watchdog_us β€” The watchdog time in microseconds.
  • wordVal: 0-65535 β€” A 16-bit word value.

πŸ’€ rgpio Error Codes πŸ’€

typedef enum
{
   lgif_bad_send           = -2000,
   lgif_bad_recv           = -2001,
   lgif_bad_getaddrinfo    = -2002,
   lgif_bad_connect        = -2003,
   lgif_bad_socket         = -2004,
   lgif_bad_noib           = -2005,
   lgif_duplicate_callback = -2006,
   lgif_bad_malloc         = -2007,
   lgif_bad_callback       = -2008,
   lgif_notify_failed      = -2009,
   lgif_callback_not_found = -2010,
   lgif_unconnected_sbc    = -2011,
   lgif_too_many_pis       = -2012,
} lgifError_t;

πŸ¦‹ SEE ALSO πŸ¦‹

Source: Linux, version/date: 2020-2021, page: rgpio(3). Stay iconic, bestie πŸ’…βœ¨

πŸ“¦ where this page comes from