]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/src/drv/hbridge.c
spi: Rework the SPI interface
[pes-rpp/rpp-lib.git] / rpp / src / drv / hbridge.c
index cc126979c7fce84d8b3460803761a44d81443665..c5da440086d2bc5a42a39a3bd2ecac716bcbbd1b 100644 (file)
@@ -22,7 +22,7 @@
 // PWM is available for HBR control.
 #include "drv/drv.h"
 #include <os/semphr.h>
-#include "drv/spi.h"
+#include "drv/spi_tms570.h"
 #include "drv/gio_tab.h"
 
 //Flag variable if pwm was initialized and is ready to start.
@@ -81,7 +81,7 @@ int drv_hbr_spi_wdg_callback(struct spi_drv *ifc, int code,
 // SPI message format definition for watchdog reset command
 spi_msg_t hbr_spi_wdg = {
        .flags = 0,
-       .addr = 0,
+       .dev = SPIDEV_L99H01,
        .rq_len = 2,
        .tx_buf = (uint8_t *)&hbr_spi_wdg_tx_shd,
        .rx_buf = (uint8_t *)&hbr_spi_wdg_rx_shd,
@@ -100,15 +100,6 @@ spi_msg_t hbr_spi_wdg = {
  */
 void drv_hbr_wdg_task(void *p)
 {
-       spi_drv_t *ifc;
-
-       ifc = spi_find_drv(NULL, 4);
-
-       if (ifc == NULL) {
-               wdg_start = FALSE;
-               vTaskDelete(NULL);
-       }
-
        portTickType xLastWakeTime;
        xLastWakeTime = xTaskGetTickCount();
 
@@ -120,7 +111,7 @@ void drv_hbr_wdg_task(void *p)
                        wdg_start = FALSE;
                }
                else
-                       spi_msg_rq_ins(ifc, &hbr_spi_wdg);
+                       spi_msg_rq_ins(&hbr_spi_wdg);
                xSemaphoreGive(wdg_sync);
        }
 }