]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/src/drv/mout.c
Merge port and gpio definitions into one file in the DRV layer
[pes-rpp/rpp-lib.git] / rpp / src / drv / mout.c
1 /* Copyright (C) 2012-2013 Czech Technical University in Prague
2  *
3  * Authors:
4  *     - Carlos Jenkins <carlos@jenkins.co.cr>
5  *
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.
10  *
11  * File : mout.c
12  * Abstract:
13  *     RPP driver implementation for MOUT.
14  *
15  * References:
16  *     hal/gpio_tms570.h
17  *     hal/gpio_tms570_def.h
18  */
19
20
21 #include "drv/mout.h"
22
23 int8_t drv_mout_set(uint8_t pin, uint8_t val)
24 {
25         // Check range
26         if (pin > 5)
27                 return -1;
28
29         dio_port_desc_t* mout_in_port = dio_port_get_dsc(DIO_PORT_NAME_MOUTIN, -1);
30
31         dio_gpio_pin_set_value(mout_in_port->config[pin], val);
32         return SUCCESS;
33 }
34
35
36 int8_t drv_mout_diag(uint8_t pin)
37 {
38         // Check range
39         if (pin > 5)
40                 return -1;
41
42         dio_port_desc_t* mout_en_port = dio_port_get_dsc(DIO_PORT_NAME_MOUTEN, -1);
43
44         if (dio_gpio_pin_get_value(mout_en_port->config[pin]) == 1)
45                 return HIGH;
46         return LOW;
47 }