]> rtime.felk.cvut.cz Git - rpp-test-sw.git/blobdiff - rpp-test-sw/commands/cmd_vbat.c
Update to the reworked gio and port in the rpp-lib
[rpp-test-sw.git] / rpp-test-sw / commands / cmd_vbat.c
index 98dfa8b9cb1c9ba8b026e3ca8269fe6d6204a3eb..4e7494d011305379bc445c1188c1c135a7c1029c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
+ * Copyright (C) 2012-2013, 2015 Czech Technical University in Prague
  *
  * Created on: 28.2.2013
  *
@@ -24,7 +24,6 @@
 #ifndef DOCGEN
 
 #include "rpp/rpp.h"
-#include "drv/digital_io_def.h"
 
 #define VBATPWM_PERIOD 400
 
@@ -52,7 +51,7 @@ int vbat1_pwm()
        int i, j;
        int pulse_cnt = 100;
 
-       if (rpp_gio_set_output(DIO_PIN_NAME_VBAT1EN, 0) == FAILURE) {
+       if (rpp_gio_setup(PIN_VBAT1EN, RPP_GIO_IN, RPP_GIO_MODE_PULLDIS, false) == FAILURE) {
                return -CMDERR_BADDIO;
        }
 
@@ -60,22 +59,22 @@ int vbat1_pwm()
        _disable_IRQ();
        while ((pwm = *(ppwm++)))
                for (i = 0; i < pulse_cnt; i++) {
-                       if (rpp_gio_set_val(DIO_PIN_NAME_VBAT1EN, 1) == FAILURE) {
+                       if (rpp_gio_set(PIN_VBAT1EN, 1) == FAILURE) {
                                return -CMDERR_BADDIO;
                        }
                        for (j = 0; j < pwm; j++)
                                ;
-                       if (rpp_gio_set_val(DIO_PIN_NAME_VBAT1EN, 0) == FAILURE) {
+                       if (rpp_gio_set(PIN_VBAT1EN, 0) == FAILURE) {
                                return -CMDERR_BADDIO;
                        }
                        for (j = 0; j < VBATPWM_PERIOD - pwm; j++)
                                ;
                }
-       if (rpp_gio_set_val(DIO_PIN_NAME_VBAT1EN, 1) == FAILURE) {
+       if (rpp_gio_set(PIN_VBAT1EN, 1) == FAILURE) {
                return -CMDERR_BADDIO;
        }
        _enable_IRQ();
-       int32_t ret = rpp_gio_get_val(DIO_PIN_NAME_VBAT1EN);
+       int32_t ret = rpp_gio_get(PIN_VBAT1EN);
        if (ret == FAILURE) {
                return -CMDERR_BADDIO;
        }
@@ -94,10 +93,10 @@ int cmd_do_power_on(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
        int ret = 0;
 
-       if (rpp_gio_set_val(DIO_PIN_NAME_VBATEN, 1) == FAILURE) {
+       if (rpp_gio_set(PIN_VBATEN, 1) == FAILURE) {
                return -CMDERR_BADDIO;
        }
-       ret = rpp_gio_get_val(DIO_PIN_NAME_VBATEN);
+       ret = rpp_gio_get(PIN_VBATEN);
        if (ret == FAILURE) {
                return -CMDERR_BADDIO;
        }
@@ -117,17 +116,17 @@ int cmd_do_power_off(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
        int ret, ret2 = 0;
 
-       if (rpp_gio_set_val(DIO_PIN_NAME_VBAT1EN, 0) == FAILURE) {
+       if (rpp_gio_set(PIN_VBAT1EN, 0) == FAILURE) {
                return -CMDERR_BADDIO;
        }
-       ret = rpp_gio_get_val(DIO_PIN_NAME_VBAT1EN);
+       ret = rpp_gio_get(PIN_VBAT1EN);
        if (ret == FAILURE) {
                return -CMDERR_BADDIO;
        }
-       if (rpp_gio_set_val(DIO_PIN_NAME_VBATEN, 0) == FAILURE) {
+       if (rpp_gio_set(PIN_VBATEN, 0) == FAILURE) {
                return -CMDERR_BADDIO;
        }
-       ret = rpp_gio_get_val(DIO_PIN_NAME_VBATEN);
+       ret = rpp_gio_get(PIN_VBATEN);
        if (ret == FAILURE) {
                return -CMDERR_BADDIO;
        }