]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - 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
index 323305183068c3694be92c4b5c7782b24d94cf10..a57816ec4ee36f8c4bc3e6cf7a9d2d94a60aef0b 100644 (file)
 
 #include "drv/mout.h"
 
-const static uint32_t dsc_pin_map[6U][2U] = {
-       {PIN_DSC_MOUT1IN, PIN_DSC_MOUT1EN},
-       {PIN_DSC_MOUT2IN, PIN_DSC_MOUT2EN},
-       {PIN_DSC_MOUT3IN, PIN_DSC_MOUT3EN},
-       {PIN_DSC_MOUT4IN, PIN_DSC_MOUT4EN},
-       {PIN_DSC_MOUT5IN, PIN_DSC_MOUT5EN},
-       {PIN_DSC_MOUT6IN, PIN_DSC_MOUT6EN}
-};
-
-
 int8_t drv_mout_set(uint8_t pin, uint8_t val)
 {
        // Check range
        if (pin > 5)
                return -1;
 
-       hal_gpio_pin_set_value(dsc_pin_map[pin][0], val);
+       dio_port_desc_t* mout_in_port = dio_port_get_dsc(DIO_PORT_NAME_MOUTIN, -1);
+
+       dio_gpio_pin_set_value(mout_in_port->config[pin], val);
        return SUCCESS;
 }
 
@@ -47,7 +39,9 @@ int8_t drv_mout_diag(uint8_t pin)
        if (pin > 5)
                return -1;
 
-       if (hal_gpio_pin_get_value(dsc_pin_map[pin][1]) == 1)
+       dio_port_desc_t* mout_en_port = dio_port_get_dsc(DIO_PORT_NAME_MOUTEN, -1);
+
+       if (dio_gpio_pin_get_value(mout_en_port->config[pin]) == 1)
                return HIGH;
        return LOW;
 }