Trond Enger / d7a_1x

Fork of d7a_1x by WizziLab

Revision:
83:f4054d0b29ba
Parent:
82:5d1b101b6d11
Child:
84:e5388f1b8ed9
--- a/src/d7a_alp.cpp	Thu Jan 05 12:37:44 2017 +0000
+++ b/src/d7a_alp.cpp	Thu Jan 05 12:59:13 2017 +0000
@@ -13,9 +13,11 @@
 #if 0
     #define ALP_DPRINT(...)         DPRINT(__VA_ARGS__)
     #define ALP_DPRINT_DATA(...)    ALP_DPRINT_DATA(__VA_ARGS__)
+    #define ALP_FPRINT(...)         FPRINT(__VA_ARGS__)
 #else
     #define ALP_DPRINT(...);
     #define ALP_DPRINT_DATA(...);
+    #define ALP_FPRINT(...);
 #endif
 
 #define ALP_CMD_MAX_LENGHT          (256)
@@ -31,7 +33,7 @@
 
 d7a_errors_t d7a_alp_open(UnsolicitedMsgFunction uns_msg)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
 
     g_alp_uns_msg = uns_msg;    
     
@@ -43,7 +45,7 @@
 
 d7a_errors_t d7a_alp_close(void)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
 
     g_alp_thread.terminate();
     
@@ -52,26 +54,26 @@
 
 void d7a_alp_new_pkt(d7a_com_rx_msg_t* pkt)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     ASSERT(g_alp_pkt_queue.put(pkt) == osOK, "ALP queue full!\r\n");
 }
 
 static void d7a_alp_new_pl(d7a_com_rx_msg_t* pl)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     ASSERT(g_alp_pl_queue.put(pl) == osOK, "ALP PL queue full!\r\n");
 }
 
 static d7a_com_rx_msg_t* d7a_alp_wait_pkt(uint32_t millisec)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     osEvent evt = g_alp_pkt_queue.get(millisec);
     return (evt.status == osEventMessage)? (d7a_com_rx_msg_t*)evt.value.p : NULL;
 }
 
 static d7a_com_rx_msg_t* d7a_alp_wait_pl(uint32_t millisec)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     osEvent evt = g_alp_pl_queue.get(millisec);
     return (evt.status == osEventMessage)? (d7a_com_rx_msg_t*)evt.value.p : NULL;
 }
@@ -165,7 +167,7 @@
 
 void d7a_alp_free_msg(d7a_msg_t* msg)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     
     if (msg->data)
     {
@@ -176,7 +178,7 @@
 
 static d7a_msg_t* d7a_alp_new_msg(void)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     
     d7a_msg_t* msg = (d7a_msg_t*)MALLOC(sizeof(d7a_msg_t));
     memset(msg, 0, sizeof(d7a_msg_t));
@@ -187,7 +189,7 @@
 
 static d7a_alp_rsp_t* d7a_alp_parse_pl(d7a_com_rx_msg_t* pkt)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     
     if (pkt == NULL)
     {
@@ -362,7 +364,7 @@
 
 static void d7a_alp_construct_resp(d7a_msg_t** ret, uint8_t current_tag, uint32_t max_responses)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     
     int i = 0;
     d7a_alp_rsp_t* pl = NULL;
@@ -499,7 +501,7 @@
 
 d7a_msg_t** d7a_alp_write_file(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* const buf, const uint8_t* root_key, d7a_addressee_t* addressee, uint8_t retry, bool resp)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     
     // Get command buffer
     uint8_t* p = &g_alp_buffer[0];
@@ -544,7 +546,7 @@
 
 d7a_msg_t** d7a_alp_read_file(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* root_key, d7a_addressee_t* addressee, uint8_t retry)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     
     // Get command buffer
     uint8_t* p = &g_alp_buffer[0];
@@ -589,7 +591,7 @@
 
 d7a_msg_t** d7a_alp_flush_file(const uint8_t file_id, const uint8_t* root_key, d7a_addressee_t* addressee, uint8_t retry, bool resp)
 {
-    FPRINT("\r\n");
+    ALP_FPRINT("\r\n");
     
     // Get command buffer
     uint8_t* p = &g_alp_buffer[0];
@@ -634,7 +636,7 @@
 
 void d7a_alp_thread()
 {
-    FPRINT("(id:0x%08x)\r\n", osThreadGetId());
+    ALP_FPRINT("(id:0x%08x)\r\n", osThreadGetId());
     d7a_com_rx_msg_t* pkt;
     
     while (true)