Expand description
The C ABI for on-board bus addressing and pin logic.
These functions wrap [pamoja_gpio] for callers that reach the SDK through
the flat C boundary: I2C addressing per NXP UM10204, the four SPI clock modes,
the pin model that maps a logical “asserted” onto a physical level, and a line
opened on a Linux board.
The addressing and the pin model allocate nothing and hold no state. An I2C
address is two scalars and crosses by value as PamojaI2cAddress; the rest
are enumerations and small pure functions over them. A PamojaGpioLine is the
one handle: a line on a Linux board’s GPIO chip, opened with
pamoja_gpio_line_open_output or pamoja_gpio_line_open_input and let go with
pamoja_gpio_line_free. On any other platform opening one returns
PamojaStatus::Unsupported with a message saying why.
Structs§
- Pamoja
Gpio Line - A GPIO line opened on a Linux board. Opaque; let it go with
pamoja_gpio_line_free, which hands the line back to the kernel. - Pamoja
I2cAddress - A validated I2C device address.
Enums§
- Pamoja
I2cDirection - Which direction an I2C transfer runs, as the read/write bit encodes it.
- Pamoja
PinEdge - The signal transition that triggers a pin interrupt.
- Pamoja
PinLevel - The physical voltage level on a pin.
- Pamoja
PinPolarity - Whether a signal is asserted by a high or a low physical level.
Constants§
- PAMOJA_
I2C_ FRAME_ MAX - The largest I2C address frame, in bytes: the two a 10-bit address needs.
- PAMOJA_
I2C_ RESERVED_ BELOW - The first 7-bit address above the reserved block at the bottom of the range.
- PAMOJA_
I2C_ RESERVED_ FROM - The lowest 7-bit address the I2C specification keeps for itself.
Functions§
- pamoja_
gpio_ ⚠line_ drive - Drives an output line to a level.
- pamoja_
gpio_ ⚠line_ free - Lets a line go, handing it back to the kernel. A null pointer is ignored.
- pamoja_
gpio_ ⚠line_ open_ input - Opens a line on a Linux board as an input.
- pamoja_
gpio_ ⚠line_ open_ output - Opens a line on a Linux board as an output, driving
initialfrom the moment it is taken. - pamoja_
gpio_ ⚠line_ read - Reads the level on a line now.
- pamoja_
i2c_ ⚠address_ frame - Writes the address bytes a controller puts on the bus for a transfer.
- pamoja_
i2c_ address_ frame_ len - Returns how many bytes an address frame occupies.
- pamoja_
i2c_ address_ is_ general_ call - Reports whether an address is the general call address
0x00. - pamoja_
i2c_ address_ is_ reserved - Reports whether a 7-bit address falls in a range the I2C specification reserves.
- pamoja_
i2c_ ⚠address_ seven_ bit - Validates a 7-bit I2C address.
- pamoja_
i2c_ ⚠address_ ten_ bit - Validates a 10-bit I2C address.
- pamoja_
pin_ edge_ triggered_ by - Reports whether a change from one level to another fires an interrupt trigger.
- pamoja_
pin_ level_ from_ bool - Returns the level a boolean names.
- pamoja_
pin_ level_ inverted - Returns the opposite level.
- pamoja_
pin_ polarity_ is_ asserted - Reports whether a physical level means the signal is asserted.
- pamoja_
pin_ polarity_ level - Returns the physical level that represents a logical state under a polarity.
- pamoja_
spi_ ⚠mode_ cpol_ cpha - Returns the
(CPOL, CPHA)pair an SPI mode number names. - pamoja_
spi_ mode_ from_ cpol_ cpha - Returns the SPI mode number a
(CPOL, CPHA)pair names.