]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/include/rpp/gio.h
Update rpp/gio.* to the new drv/gio interface and remove crap from it
[pes-rpp/rpp-lib.git] / rpp / include / rpp / gio.h
index 83a89ba20c9f1fd359712d8ce857c783b1dc5567..fd832f8490d3b5eedc5340f25e640b23bacce80a 100644 (file)
@@ -1,14 +1,22 @@
 /*
- * gio.h
+ * Copyright (C) 2015 Czech Technical University in Prague
+ *
+ * Authors:
+ *     - Michal Sojka <sojkam1@fel.cvut.cz>
+ *     - Michal Horn
+ *
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
  *
- *  Created on: 29.10.2014
- *      Author: Michal Horn
  */
 
-#ifndef GIO_H_
-#define GIO_H_
+#ifndef RPP_GIO_H
+#define RPP_GIO_H
 
 #include "types.h"
+#include "drv/gio_names.h"
 
 #define RPP_GIO_PORT_GIOA   0x2
 #define RPP_GIO_PORT_GIOB   0x4
 
 int8_t rpp_gio_init(uint32_t init_ports);
 
-int8_t rpp_gio_set_val(const char* pin_name, uint8_t value);
-
-int8_t rpp_gio_get_val(const char* pin_name);
-
-int8_t rpp_gio_set_output(const char* pin_name, uint8_t value);
-
-int8_t rpp_gio_set_input(const char* pin_name);
-
-int8_t rpp_gio_set_push_pull(const char* pin_name, boolean_t pull_up);
-
-int8_t rpp_gio_set_open_drain(const char* pin_name);
-
-int8_t rpp_gio_set_pull_up(const char* pin_name);
-
-int8_t rpp_gio_set_pull_down(const char* pin_name);
-
-boolean_t rpp_gio_is_dir_output(const char* pin_name);
+int8_t rpp_gio_set(enum pin_name pin, boolean_t value);
+int8_t rpp_gio_get(enum pin_name pin);
 
-boolean_t rpp_gio_is_push_pull(const char* pin_name);
+/** GIO pin input mode */
+enum rpp_gio_in_mode {
+       RPP_GIO_MODE_PULLDIS,           /**< Disable pull resistor */
+       RPP_GIO_MODE_PULLUP,
+       RPP_GIO_MODE_PULLDOWN,
+};
 
-boolean_t rpp_gio_is_pull_up(const char* pin_name);
+/** GIO pin direction */
+enum rpp_gio_io {
+       RPP_GIO_IN,
+       RPP_GIO_OUT,
+};
 
-uint32_t rpp_gio_get_pin_cnt();
-
-int8_t rpp_gio_get_pin_names(const char** pin_names, uint8_t max_names_cnt);
-
-int8_t rpp_port_set_val(const char* port_name, uint8_t port_num_vals, const uint32_t* values);
-
-int8_t rpp_port_get_val(const char* port_name, uint8_t port_num_vals, uint32_t* values);
-
-int32_t rpp_port_get_pin_cnt(const char* port_name);
-
-int32_t rpp_port_get_port_cnt();
-
-int8_t rpp_port_get_port_names(const char** port_names, uint8_t max_names_cnt);
-
-int8_t rpp_port_get_interface_type(const char* port_name);
+/**
+ * Configure GIO pin
+ *
+ * @param pin Pin to configure
+ * @param io Configure the pin as input or output.
+ * @param in_mode Input settings. Ignored when pin is configured as
+ *                               output.
+ * @param open_drain Output is open drain when TRUE, pull/push when
+ *                                      FALSE. Ignored when pin is configured as input.
+ *
+ * @return SUCCESS or FAILURE.
+ */
+int8_t rpp_gio_setup(enum pin_name pin,
+                                        enum rpp_gio_io io,
+                                        enum rpp_gio_in_mode in_mode,
+                                        boolean_t open_drain);
 
+int8_t rpp_gio_port_set(int port, uint32_t bits);
+int8_t rpp_gio_port_get(int port, uint32_t *bits);
 
 #endif /* GIO_H_ */