PCF8574(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… PCF8574(4) β€” like, the Kernel Interfaces Manual page, bestie πŸŽ€

okay so picture this: it's a manual page for pcf8574, and it lives in section 4 of the Kernel Interfaces Manual. that's the whole vibe. now let me tell you what this lil guy actually does ✨

🌸 NAME 🌸

pcf8574 β€” the driver for the PCF8574 8-bit I2C IO expander. yes she's an IO expander and yes she's iconic πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

so if you wanna compile this driver into the kernel (main character energy, permanently in the build), you drop these lines into your kernel configuration file:

device pcf8574
device gpio
device iicbus

OR β€” and this is the lowkey easier route β€” you can load the driver as a module at boot time instead, by putting this line in loader.conf(5):

pcf8574_load="YES"

pick your fighter 🫢

✨ DESCRIPTION ✨

the pcf8574 driver gives you gpiobus(4) control over 8 GPIO pins. eight!! a whole little octet of them πŸ™

here's the tea though, and it's important: the pins are quasi-bidirectional. only low output can be actively driven. a high output is literally just equivalent to input. so don't come for her expecting push-pull realness, okay? she's doing her best 😭

on an FDT(4) based system, these properties must be set β€” no cap:

  • compatible β€” must be set to "nxp,pcf8574". exactly that. character for character. πŸ’–
  • reg β€” the I2C address of pcf8574.

and the DTS part for a pcf8574 device usually looks like this, slay:

/ {

        ...
        pcf8574@27 {
                compatible = "nxp,pcf8574";
                reg = <0x27>;
        };
};

look at that lil 0x27 address living its best life πŸ“

πŸ‘‘ SEE ALSO πŸ‘‘

fdt(4), gpiobus(4), iicbus(4) β€” go read those too, iykyk πŸ“š

🌈 HISTORY 🌈

the pcf8574 driver and this manual page were written by Andriy Gapon <avg@FreeBSD.org>. we stan a legend πŸ«‘πŸ’œ

πŸ’€ BUGS πŸ’€

okay so here's the one thing to know: the pcf8574 driver does not support the input change interrupt that the hardware provides. the hardware has it, the driver just... doesn't do it πŸ™ˆ not me pointing that out but like, someone had to


and that's the whole page bestie!! source/version is Debian and it's dated November 6, 2021 β€” mwah, go expand some IO πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from