]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp/lib/rpp/src/hal/port_gpio.c
db4775f36b279c54400dc1130c3f15bc29af95c7
[pes-rpp/rpp-test-sw.git] / rpp / lib / rpp / src / hal / port_gpio.c
1 /*
2  * port_gpio.c
3  *
4  *  Created on: 26.11.2012
5  *      Author: Michal Horn
6  *
7  *  This file contains getter and setter functions for GPIO port type.
8  */
9
10 //#include "hal/port_gpio.h"
11 //#include "hal/gpio_tms570.h"
12 #include "hal/hal.h"
13
14 /**
15  * Get values of all pins of given port.
16  * @param[in] config    Pointer to array of pin descriptors
17  * @param[in] num_val   Number of pins assigned to the port
18  * @param[out] values   Stored values of all pins of the port. 1st bit -> pin0, 2nd bit -> pin1...
19  * @return always 0
20  */
21 uint32_t hal_gio_port_get_val(uint32_t* config, uint32_t num_val, uint32_t* values) {
22     uint32_t i;
23     for (i = 0; i < num_val; i++) {
24         values[i] = hal_gpio_pin_get_value(config[i]);
25     }
26     return 0;
27 }
28
29 /**
30  * Set values to all pins of given port.
31  * @param[in] config    Pointer to array of pin descriptors
32  * @param[in] num_val   Number of pins assigned to the port
33  * @param[in] values    Stored values of all pins of the port. 1st bit -> pin0, 2nd bit -> pin1...
34  * @return always 0
35  */
36 uint32_t hal_gio_port_set_val(uint32_t* config, uint32_t num_val, const uint32_t* values) {
37     uint32_t i;
38     for (i = 0; i < num_val; i++) {
39         hal_gpio_pin_set_value(config[i], values[i]);
40     }
41     return 0;
42 }
43