Port API Overview
This API contains the functions to configure and control the ports of the
the programmable XBee devices. The ports are not the actual ports of the hcs08 chip, so they are not read and written atomically. They are groups of GPIOs that have a custom read and write implementation in code. The ports are defined by an array of xpin_t values and they can go from 2 pins to 8 pins. The value written and read in a port is always a byte.
- Port configuration functions:
- port_config()
- Port functions to read/write the ports:
- port_set()
- port_get()
Reads the value of the specified bit of the selected port.
- Parameters
-
[in] | port | the port where a bit will be read. |
[in] | bit | the bit of the port that will be read. |
- Return values
-
int | the value read from the port on success |
-EINVAL | on error |
Writes a value in the specified bit of the selected port.
- Parameters
-
[in] | port | the port where a bit will be written. |
[in] | bit | the bit of the port that will be written. |
[in] | val | the value that will be written. |
- Return values
-
0 | on success |
-EINVAL | on error (invalid port bit) |
Initializes and configures the specified port with the parameters selected in cfg param.
- Parameters
-
[in] | port | the port that to initialize. A port is defined by an array of standard GPIO capable pins. |
[in] | cfg | a byte containing the configuration masks for the standard GPIO pins of the port. See the Standard GPIO Macros for more information. |
- Return values
-
0 | on successfully |
EINVAL | invalid xpin_t parameter (one or more of the pins are not standard GPIO capable pins). |
Reads a byte of data from the specified port.
- Parameters
-
[in] | pin | the port to read the data from. |
- Return values
-
uint8_t | the byte read from the port. |
Writes a byte in the specified port.
- Parameters
-
[in] | port | the port where the byte will be written. |
[in] | val | the byte to write in the port. |
- Return values
-