Skip to main content

Module gpio

Module gpio 

Source
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, and the pin model that maps a logical “asserted” onto a physical level.

Nothing here allocates or holds state, so nothing here is a handle. An I2C address is two scalars and crosses by value as PamojaI2cAddress; the rest are enumerations and small pure functions over them.

Structs§

PamojaI2cAddress
A validated I2C device address.

Enums§

PamojaI2cDirection
Which direction an I2C transfer runs, as the read/write bit encodes it.
PamojaPinEdge
The signal transition that triggers a pin interrupt.
PamojaPinLevel
The physical voltage level on a pin.
PamojaPinPolarity
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_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.