1 /* Copyright (C) 2012-2013 Czech Technical University in Prague
4 * - Michal Horn <hornmich@fel.cvut.cz>
6 * This document contains proprietary information belonging to Czech
7 * Technical University in Prague. Passing on and copying of this
8 * document, and communication of its contents is not permitted
9 * without prior written authorization.
14 * This file contains getter and setter functions for GPIO port type.
20 * Get values of all pins of given port.
21 * @param[in] config Pointer to array of pin descriptors
22 * @param[in] num_val Number of pins assigned to the port
23 * @param[out] values Stored values of all pins of the port. 1st bit -> pin0, 2nd bit -> pin1...
26 uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *values)
30 for (i = 0; i < num_val; i++) {
31 values[i] = hal_gpio_pin_get_value(config[i]);
37 * Set values to all pins of given port.
38 * @param[in] config Pointer to array of pin descriptors
39 * @param[in] num_val Number of pins assigned to the port
40 * @param[in] values Stored values of all pins of the port. 1st bit -> pin0, 2nd bit -> pin1...
43 uint32_t hal_gio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t *values)
47 for (i = 0; i < num_val; i++) {
48 hal_gpio_pin_set_value(config[i], (values[i/8] >> i%8) & 0x1);