Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of d7a_1x by
Diff: src/d7a_com.cpp
- Revision:
- 84:e5388f1b8ed9
- Parent:
- 83:f4054d0b29ba
- Child:
- 89:8c4c0fa6cbfa
--- a/src/d7a_com.cpp Thu Jan 05 12:59:13 2017 +0000
+++ b/src/d7a_com.cpp Fri Jan 06 15:33:26 2017 +0000
@@ -8,6 +8,7 @@
#include "d7a_fs.h"
#include "d7a_modem.h"
#include "d7a_sys.h"
+#include "d7a_typedefs.h"
#include "cbuffer.h"
#if 1
@@ -28,22 +29,24 @@
uint8_t buf[1];
} d7a_com_tx_buf_t;
-static uint8_t g_com_state;
-static DigitalOut* g_com_rts;
-static InterruptIn* g_com_cts;
-static CBuffer<uint8_t, 512> g_com_rx_buf;
-static d7a_com_rx_msg_t g_com_msg;
-static uint16_t g_com_skipped_bytes;
-static uint8_t g_com_tx_seq;
-static uint8_t g_com_rx_seq;
-static Semaphore g_com_data_parsing(0);
-static Semaphore g_com_cts_int(0);
-static RawSerial* g_com_serial;
-static Thread g_com_rx_thread(osPriorityRealtime, 512, NULL);
-static Thread g_com_tx_thread(osPriorityHigh, 512, NULL);
-static Queue<d7a_com_tx_buf_t, 8> g_com_tx_queue;
-static Timer g_com_tim;
+static uint8_t g_com_state;
+static d7a_com_rx_msg_t g_com_msg;
+static uint16_t g_com_skipped_bytes;
+static uint8_t g_com_tx_seq;
+static uint8_t g_com_rx_seq;
+static MBED_DigitalOut* g_com_rts;
+static MBED_InterruptIn* g_com_cts;
+static MBED_RawSerial* g_com_serial;
+static MBED_Timer g_com_tim;
+
+static UTILS_CBuffer<uint8_t, 512> g_com_rx_buf;
+
+static OS_Semaphore g_com_data_parsing(0);
+static OS_Semaphore g_com_cts_int(0);
+static OS_Thread g_com_rx_thread(osPriorityRealtime, 512, NULL);
+static OS_Thread g_com_tx_thread(osPriorityHigh, 512, NULL);
+static OS_Queue<d7a_com_tx_buf_t, 8> g_com_tx_queue;
enum {
SEARCH_HEADER,
@@ -54,7 +57,7 @@
/**
- Thread for parsing packets from RX buffer.
+ OS_Thread for parsing packets from RX buffer.
@param void
@return void
@@ -121,9 +124,9 @@
g_com_tx_seq = 0;
g_com_rx_seq = 0;
- g_com_serial = new RawSerial(config->tx, config->rx, 115200);
- g_com_rts = new DigitalOut(config->rts);
- g_com_cts = new InterruptIn(config->cts);
+ g_com_serial = new MBED_RawSerial(config->tx, config->rx, 115200);
+ g_com_rts = new MBED_DigitalOut(config->rts);
+ g_com_cts = new MBED_InterruptIn(config->cts);
g_com_cts->rise(&cts_isr);
@@ -187,7 +190,7 @@
//dbg_print_data("", "%02X ", (uint8_t*)tx_buf->buf, tx_buf->len, "\r\n");
- Thread::wait(3);
+ OS_Thread ::wait(3);
for (uint32_t i=0 ; i<tx_buf->len ; i++)
{
@@ -195,7 +198,7 @@
}
// Important to not release the ressource too soon
- Thread::wait(2);
+ OS_Thread ::wait(2);
*(g_com_rts) = 0;
}
@@ -400,7 +403,7 @@
}
-// Thread for parsing packets from RX buffer.
+// OS_Thread for parsing packets from RX buffer.
void d7a_com_rx_thread()
{
COM_FPRINT("(id:0x%08x)\r\n", osThreadGetId());
