From cbff3e6d3a557908591146fbba9bed0d26051af1 Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Date: Thu, 24 May 2018 19:17:59 +0200
Subject: [PATCH] drivers: Implemented missing function in cc110x

Function cc110x_state_to_text is defined and (with ENABLE_DEBUG) referenced,
but implemented. This commit adds the missing implementation.
---
 drivers/cc110x/cc110x-rxtx.c              | 19 +++++++++++++++++++
 drivers/cc110x/include/cc110x-interface.h |  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/cc110x/cc110x-rxtx.c b/drivers/cc110x/cc110x-rxtx.c
index 878ccf678c..b5618e3c74 100644
--- a/drivers/cc110x/cc110x-rxtx.c
+++ b/drivers/cc110x/cc110x-rxtx.c
@@ -43,6 +43,25 @@
 #define ENABLE_DEBUG (0)
 #include "debug.h"
 
+const char *cc110x_state_to_text(uint8_t state)
+{
+    switch (state){
+    case RADIO_IDLE:
+        return "idle";
+    case RADIO_TX_BUSY:
+        return "tx busy";
+    case RADIO_RX:
+        return "rx";
+    case RADIO_RX_BUSY:
+        return "rx busy";
+    case RADIO_PWD:
+        return "pwd";
+    case RADIO_UNKNOWN:
+        return "unknown";
+    }
+    return "invalid";
+}
+
 static void _rx_abort(cc110x_t *dev)
 {
     gpio_irq_disable(dev->params.gdo2);
diff --git a/drivers/cc110x/include/cc110x-interface.h b/drivers/cc110x/include/cc110x-interface.h
index 02f0b20692..4e77b94789 100644
--- a/drivers/cc110x/include/cc110x-interface.h
+++ b/drivers/cc110x/include/cc110x-interface.h
@@ -35,7 +35,7 @@ extern "C" {
  * @{
  */
 char *cc110x_get_marc_state(cc110x_t *dev);
-char *cc110x_state_to_text(uint8_t state);
+const char *cc110x_state_to_text(uint8_t state);
 int cc110x_rd_set_mode(cc110x_t *dev, int mode);
 uint8_t cc110x_get_buffer_pos(cc110x_t *dev);
 void cc110x_isr_handler(cc110x_t *dev, void(*callback)(void*), void*arg);
-- 
GitLab