#include <zephyr/devicetree/gpio.h>
#include <hardware/pio.h>
Go to the source code of this file.
|
#define | RPI_PICO_PIO_DEFINE_PROGRAM(name, wrap_target, wrap, ...) |
| Utility macro to define a PIO program.
|
|
#define | RPI_PICO_PIO_GET_WRAP_TARGET(name) name ## _wrap_target |
| Utility macro to get the wrap target of a program.
|
|
#define | RPI_PICO_PIO_GET_WRAP(name) name ## _wrap |
| Utility macro to get the wrap source of a program.
|
|
#define | RPI_PICO_PIO_GET_PROGRAM(name) &name ## _program |
| Utility macro to get a pointer to a PIO program.
|
|
#define | DT_RPI_PICO_PIO_PIN_BY_NAME(node_id, p_name, p_idx, g_name, g_idx) |
| Get a pin number from a pinctrl / group name and index.
|
|
#define | DT_INST_RPI_PICO_PIO_PIN_BY_NAME(inst, p_name, p_idx, g_name, g_idx) DT_RPI_PICO_PIO_PIN_BY_NAME(DT_DRV_INST(inst), p_name, p_idx, g_name, g_idx) |
| Get a pin number from a pinctrl / group name and index.
|
|
#define | DT_INST_PIO_PIN_BY_NAME(inst, name) DT_PIO_PIN_BY_NAME(DT_DRV_INST(inst), name) |
| Get the pin number of a pin by its name.
|
|
◆ DT_INST_PIO_PIN_BY_NAME
#define DT_INST_PIO_PIN_BY_NAME |
( |
|
inst, |
|
|
|
name |
|
) |
| DT_PIO_PIN_BY_NAME(DT_DRV_INST(inst), name) |
Get the pin number of a pin by its name.
- Parameters
-
inst | instance number |
name | name of the pin (e.g. tx, rx, sck). |
◆ DT_INST_RPI_PICO_PIO_PIN_BY_NAME
Get a pin number from a pinctrl / group name and index.
- Parameters
-
inst | instance number |
p_name | pinctrl name |
p_idx | pinctrl index |
g_name | group name |
g_idx | group index |
- Returns
- pin number
- See also
- DT_RPI_PICO_PIO_PIN_BY_NAME
◆ DT_RPI_PICO_PIO_PIN_BY_NAME
#define DT_RPI_PICO_PIO_PIN_BY_NAME |
( |
|
node_id, |
|
|
|
p_name, |
|
|
|
p_idx, |
|
|
|
g_name, |
|
|
|
g_idx |
|
) |
| |
Value:
#define DT_CHILD(node_id, child)
Get a node identifier for a child node.
Definition: devicetree.h:423
#define DT_PROP_BY_IDX(node_id, prop, idx)
Get the value at index idx in an array type property.
Definition: devicetree.h:809
#define DT_PINCTRL_BY_NAME(node_id, name, idx)
Get a node identifier for a phandle inside a pinctrl node by name.
Definition: pinctrl.h:81
Get a pin number from a pinctrl / group name and index.
Example devicetree fragment(s):
pinctrl {
pio_child_default: pio_child_default {
tx_gpio {
pinmux = <PIO0_P0>, <PIO0_P2>;
};
rx_gpio {
pinmux = <PIO0_P1>;
input-enable;
};
};
};
pio {
status = "okay";
c: child {
pinctrl-0 = <&pio_child_default>;
pinctrl-names = "default";
};
};
Example usage:
#define DT_RPI_PICO_PIO_PIN_BY_NAME(node_id, p_name, p_idx, g_name, g_idx)
Get a pin number from a pinctrl / group name and index.
Definition: pio_rpi_pico.h:103
- Parameters
-
node_id | node identifier |
p_name | pinctrl name |
p_idx | pinctrl index |
g_name | group name |
g_idx | group index |
- Returns
- pin number
◆ RPI_PICO_PIO_DEFINE_PROGRAM
#define RPI_PICO_PIO_DEFINE_PROGRAM |
( |
|
name, |
|
|
|
wrap_target, |
|
|
|
wrap, |
|
|
|
... |
|
) |
| |
Value: static const uint32_t name ## _wrap_target = wrap_target; \
static const uint32_t name ## _wrap = wrap; \
static const uint16_t name ## _program_instructions[] = { \
__VA_ARGS__ \
}; \
static const struct pio_program name ## _program = { \
.instructions = name ## _program_instructions, \
.length =
ARRAY_SIZE(name ## _program_instructions), \
.origin = -1, \
}
#define ARRAY_SIZE(array)
Number of elements in the given array.
Definition: util.h:127
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Utility macro to define a PIO program.
The program is a list of 16 bit instructions, generated by the pioasm tool.
- Parameters
-
name | Name of the program. |
wrap_target | Wrap target as specified by the PIO program. |
wrap | Wrap source as specified by the PIO program. |
... | Comma separated list of PIO instructions. |
◆ RPI_PICO_PIO_GET_PROGRAM
#define RPI_PICO_PIO_GET_PROGRAM |
( |
|
name | ) |
&name ## _program |
Utility macro to get a pointer to a PIO program.
- Parameters
-
◆ RPI_PICO_PIO_GET_WRAP
#define RPI_PICO_PIO_GET_WRAP |
( |
|
name | ) |
name ## _wrap |
Utility macro to get the wrap source of a program.
- Parameters
-
◆ RPI_PICO_PIO_GET_WRAP_TARGET
#define RPI_PICO_PIO_GET_WRAP_TARGET |
( |
|
name | ) |
name ## _wrap_target |
Utility macro to get the wrap target of a program.
- Parameters
-
◆ pio_rpi_pico_allocate_sm()
int pio_rpi_pico_allocate_sm |
( |
const struct device * |
dev, |
|
|
size_t * |
sm |
|
) |
| |
Allocate a state machine.
- Parameters
-
dev | Pointer to device structure for rpi_pio device instance |
sm | Pointer to store allocated state machine |
- Return values
-
0 | on success |
-EBUSY | if no state machines were available |
◆ pio_rpi_pico_get_pio()
PIO pio_rpi_pico_get_pio |
( |
const struct device * |
dev | ) |
|
Get PIO object.
- Parameters
-
dev | Pointer to device structure for rpi_pio device instance |
- Returns
- PIO object