libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Defined Constants and Types for the SAMD Port controller. More...
Modules | |
Port Base registers | |
GPIO Pin Identifiers | |
GPIO mux configuration | |
PORT Registers | |
PortX WRCONFIG Values | |
GPIO Pin direction | |
GPIO mode configuration | |
Macros | |
#define | PORT_PMUX_PMUXO(mux) ((0xf & (mux)) << 4) |
PMUXO: Peripheral Multiplexing for Odd-Numbered Pin: 2*x+1 pin multiplexing. More... | |
#define | PORT_PMUX_PMUXE(mux) ((0xf & (mux)) << 0) |
PMUXE: Peripheral Multiplexing for Even-Numbered Pin: 2*x pin multiplexing. More... | |
#define | PORT_PINCFG_DRVSTR (1 << 6) |
DRVSTR: Output Driver Strength Selection. More... | |
#define | PORT_PINCFG_PULLEN (1 << 2) |
PULLEN: Pull Enable. More... | |
#define | PORT_PINCFG_INEN (1 << 1) |
INEN: Input Enable. More... | |
#define | PORT_PINCFG_PMUXEN (1 << 0) |
PMUXEN: Peripheral Multiplexer Enable. More... | |
Functions | |
void | gpio_mode_setup (uint32_t gpioport, uint8_t mode, uint8_t cnf, uint32_t gpios) |
Initialize GPIO pins. More... | |
void | gpio_set_af (uint32_t gpioport, uint8_t af, uint32_t gpios) |
Alternate function GPIO pins. More... | |
void | gpio_set (uint32_t gpioport, uint32_t gpios) |
Set a group of Pins. More... | |
void | gpio_clear (uint32_t gpioport, uint32_t gpios) |
Clear a group of Pins. More... | |
uint32_t | gpio_get (uint32_t gpioport, uint32_t gpios) |
Read level of a group of Pins. More... | |
void | gpio_toggle (uint32_t gpioport, uint32_t gpios) |
Toggle level of a group of Pins. More... | |
uint32_t | port_read (uint32_t port) |
Read level for all pins from a port. More... | |
void | port_write (uint32_t port, uint32_t data) |
Set level for all pins from a port. More... | |
Defined Constants and Types for the SAMD Port controller.
#define PORT_PINCFG_DRVSTR (1 << 6) |
#define PORT_PINCFG_PMUXEN (1 << 0) |
#define PORT_PMUX_PMUXE | ( | mux | ) | ((0xf & (mux)) << 0) |
#define PORT_PMUX_PMUXO | ( | mux | ) | ((0xf & (mux)) << 4) |
void gpio_clear | ( | uint32_t | gpioport, |
uint32_t | gpios | ||
) |
Clear a group of Pins.
Clear a group of Pins for the given port.
[in] | gpioport | port register address base Port Base registers |
[in] | gpios | GPIO Pin Identifiers. Any combination of pins may be specified by OR'ing then together. |
Definition at line 108 of file port.c.
References PORT_OUTCLR.
uint32_t gpio_get | ( | uint32_t | gpioport, |
uint32_t | gpios | ||
) |
Read level of a group of Pins.
Read the level of a group of Pins for the given port.
[in] | gpioport | port register address base Port Base registers |
[in] | gpios | GPIO Pin Identifiers. Any combination of pins may be specified by OR'ing then together. |
Definition at line 121 of file port.c.
References PORT_IN.
void gpio_mode_setup | ( | uint32_t | gpioport, |
uint8_t | mode, | ||
uint8_t | cnf, | ||
uint32_t | gpios | ||
) |
Initialize GPIO pins.
Configure a group of Pins for the given port.
[in] | gpioport | port register address base Port Base registers |
[in] | mode | direction GPIO Pin direction |
[in] | cnf | configuration mode GPIO mode configuration |
[in] | gpios | GPIO Pin Identifiers. Any combination of pins may be specified by OR'ing then together. |
Definition at line 23 of file port.c.
References GPIO_CNF_AF, GPIO_CNF_PULLDOWN, GPIO_CNF_PULLUP, GPIO_MODE_INPUT, GPIO_MODE_OUTPUT, PORT_DIRCLR, PORT_DIRSET, PORT_OUTCLR, PORT_OUTSET, PORT_WRCONFIG, PORT_WRCONFIG_HWSEL, PORT_WRCONFIG_INEN, PORT_WRCONFIG_PINMASK, PORT_WRCONFIG_PMUXEN, PORT_WRCONFIG_PULLEN, and PORT_WRCONFIG_WRPINCFG.
void gpio_set | ( | uint32_t | gpioport, |
uint32_t | gpios | ||
) |
Set a group of Pins.
Set a group of Pins for the given port.
[in] | gpioport | port register address base Port Base registers |
[in] | gpios | GPIO Pin Identifiers. Any combination of pins may be specified by OR'ing then together. |
Definition at line 95 of file port.c.
References PORT_OUTSET.
void gpio_set_af | ( | uint32_t | gpioport, |
uint8_t | af, | ||
uint32_t | gpios | ||
) |
Alternate function GPIO pins.
Configure a group of Pins in alternate function.
[in] | gpioport | port register address base Port Base registers |
[in] | af | pmux configuration GPIO mux configuration |
[in] | gpios | GPIO Pin Identifiers. Any combination of pins may be specified by OR'ing then together. |
Definition at line 73 of file port.c.
References PORT_WRCONFIG, PORT_WRCONFIG_HWSEL, PORT_WRCONFIG_PINMASK, PORT_WRCONFIG_PMUX, PORT_WRCONFIG_PMUXEN, PORT_WRCONFIG_WRPINCFG, and PORT_WRCONFIG_WRPMUX.
void gpio_toggle | ( | uint32_t | gpioport, |
uint32_t | gpios | ||
) |
Toggle level of a group of Pins.
Toggle one or more pins of the givent port.
[in] | gpioport | port register address base Port Base registers |
[in] | gpios | GPIO Pin Identifiers. Any combination of pins may be specified by OR'ing then together. |
Definition at line 134 of file port.c.
References PORT_OUTTGL.
uint32_t port_read | ( | uint32_t | port | ) |
Read level for all pins from a port.
Read the level of all pins of the given port.
[in] | port | register address base Port Base registers |
Definition at line 147 of file port.c.
References PORT_IN.
void port_write | ( | uint32_t | port, |
uint32_t | data | ||
) |
Set level for all pins from a port.
Set the level of all pins of the given port.
[in] | port | register address base Port Base registers |
[in] | data | GPIO Pin Identifiers. Any combination of pins may be specified by OR'ing then together. |
Definition at line 160 of file port.c.
References PORT_OUT.