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.

Committer:
mbed_official
Date:
Fri Jul 17 09:15:10 2015 +0100
Revision:
592:a274ee790e56
Parent:
579:53297373a894
Synchronized with git revision e7144f83a8d75df80c4877936b6ffe552b0be9e6

Full URL: https://github.com/mbedmicro/mbed/commit/e7144f83a8d75df80c4877936b6ffe552b0be9e6/

More API implementation for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 579:53297373a894 1 #include <port.h>
mbed_official 579:53297373a894 2
mbed_official 579:53297373a894 3 /**
mbed_official 579:53297373a894 4 * \brief Writes a Port pin configuration to the hardware module.
mbed_official 579:53297373a894 5 *
mbed_official 579:53297373a894 6 * Writes out a given configuration of a Port pin configuration to the hardware
mbed_official 579:53297373a894 7 * module.
mbed_official 579:53297373a894 8 *
mbed_official 579:53297373a894 9 * \note If the pin direction is set as an output, the pull-up/pull-down input
mbed_official 579:53297373a894 10 * configuration setting is ignored.
mbed_official 579:53297373a894 11 *
mbed_official 579:53297373a894 12 * \param[in] gpio_pin Index of the GPIO pin to configure
mbed_official 579:53297373a894 13 * \param[in] config Configuration settings for the pin
mbed_official 579:53297373a894 14 */
mbed_official 579:53297373a894 15 void port_pin_set_config(
mbed_official 579:53297373a894 16 const uint8_t gpio_pin,
mbed_official 579:53297373a894 17 const struct port_config *const config)
mbed_official 579:53297373a894 18 {
mbed_official 579:53297373a894 19 /* Sanity check arguments */
mbed_official 579:53297373a894 20 Assert(config);
mbed_official 579:53297373a894 21
mbed_official 579:53297373a894 22 struct system_pinmux_config pinmux_config;
mbed_official 579:53297373a894 23 system_pinmux_get_config_defaults(&pinmux_config);
mbed_official 579:53297373a894 24
mbed_official 579:53297373a894 25 pinmux_config.mux_position = SYSTEM_PINMUX_GPIO;
mbed_official 579:53297373a894 26 pinmux_config.direction = (enum system_pinmux_pin_dir)config->direction;
mbed_official 579:53297373a894 27 pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->input_pull;
mbed_official 579:53297373a894 28 pinmux_config.powersave = config->powersave;
mbed_official 579:53297373a894 29
mbed_official 579:53297373a894 30 system_pinmux_pin_set_config(gpio_pin, &pinmux_config);
mbed_official 579:53297373a894 31 }
mbed_official 579:53297373a894 32
mbed_official 579:53297373a894 33 /**
mbed_official 579:53297373a894 34 * \brief Writes a Port group configuration group to the hardware module.
mbed_official 579:53297373a894 35 *
mbed_official 579:53297373a894 36 * Writes out a given configuration of a Port group configuration to the
mbed_official 579:53297373a894 37 * hardware module.
mbed_official 579:53297373a894 38 *
mbed_official 579:53297373a894 39 * \note If the pin direction is set as an output, the pull-up/pull-down input
mbed_official 579:53297373a894 40 * configuration setting is ignored.
mbed_official 579:53297373a894 41 *
mbed_official 579:53297373a894 42 * \param[out] port Base of the PORT module to write to
mbed_official 579:53297373a894 43 * \param[in] mask Mask of the port pin(s) to configure
mbed_official 579:53297373a894 44 * \param[in] config Configuration settings for the pin group
mbed_official 579:53297373a894 45 */
mbed_official 579:53297373a894 46 void port_group_set_config(
mbed_official 579:53297373a894 47 PortGroup *const port,
mbed_official 579:53297373a894 48 const uint32_t mask,
mbed_official 579:53297373a894 49 const struct port_config *const config)
mbed_official 579:53297373a894 50 {
mbed_official 579:53297373a894 51 /* Sanity check arguments */
mbed_official 579:53297373a894 52 Assert(port);
mbed_official 579:53297373a894 53 Assert(config);
mbed_official 579:53297373a894 54
mbed_official 579:53297373a894 55 struct system_pinmux_config pinmux_config;
mbed_official 579:53297373a894 56 system_pinmux_get_config_defaults(&pinmux_config);
mbed_official 579:53297373a894 57
mbed_official 579:53297373a894 58 pinmux_config.mux_position = SYSTEM_PINMUX_GPIO;
mbed_official 579:53297373a894 59 pinmux_config.direction = (enum system_pinmux_pin_dir)config->direction;
mbed_official 579:53297373a894 60 pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->input_pull;
mbed_official 579:53297373a894 61 pinmux_config.powersave = config->powersave;
mbed_official 579:53297373a894 62
mbed_official 579:53297373a894 63 system_pinmux_group_set_config(port, mask, &pinmux_config);
mbed_official 579:53297373a894 64 }