mbed library sources
Dependents: Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more
Superseded
This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.
Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.
If you are looking for a stable and tested release, please import one of the official mbed library releases:
Import librarymbed
The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
targets/hal/TARGET_Atmel/TARGET_SAM21/drivers/port/port.c
- Committer:
- mbed_official
- Date:
- 2015-07-17
- Revision:
- 592:a274ee790e56
- Parent:
- 579:53297373a894
File content as of revision 592:a274ee790e56:
#include <port.h> /** * \brief Writes a Port pin configuration to the hardware module. * * Writes out a given configuration of a Port pin configuration to the hardware * module. * * \note If the pin direction is set as an output, the pull-up/pull-down input * configuration setting is ignored. * * \param[in] gpio_pin Index of the GPIO pin to configure * \param[in] config Configuration settings for the pin */ void port_pin_set_config( const uint8_t gpio_pin, const struct port_config *const config) { /* Sanity check arguments */ Assert(config); struct system_pinmux_config pinmux_config; system_pinmux_get_config_defaults(&pinmux_config); pinmux_config.mux_position = SYSTEM_PINMUX_GPIO; pinmux_config.direction = (enum system_pinmux_pin_dir)config->direction; pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->input_pull; pinmux_config.powersave = config->powersave; system_pinmux_pin_set_config(gpio_pin, &pinmux_config); } /** * \brief Writes a Port group configuration group to the hardware module. * * Writes out a given configuration of a Port group configuration to the * hardware module. * * \note If the pin direction is set as an output, the pull-up/pull-down input * configuration setting is ignored. * * \param[out] port Base of the PORT module to write to * \param[in] mask Mask of the port pin(s) to configure * \param[in] config Configuration settings for the pin group */ void port_group_set_config( PortGroup *const port, const uint32_t mask, const struct port_config *const config) { /* Sanity check arguments */ Assert(port); Assert(config); struct system_pinmux_config pinmux_config; system_pinmux_get_config_defaults(&pinmux_config); pinmux_config.mux_position = SYSTEM_PINMUX_GPIO; pinmux_config.direction = (enum system_pinmux_pin_dir)config->direction; pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->input_pull; pinmux_config.powersave = config->powersave; system_pinmux_group_set_config(port, mask, &pinmux_config); }