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:
- 83:f4054d0b29ba
- Parent:
- 82:5d1b101b6d11
- Child:
- 84:e5388f1b8ed9
diff -r 5d1b101b6d11 -r f4054d0b29ba src/d7a_com.cpp
--- a/src/d7a_com.cpp Thu Jan 05 12:37:44 2017 +0000
+++ b/src/d7a_com.cpp Thu Jan 05 12:59:13 2017 +0000
@@ -13,9 +13,11 @@
#if 1
#define COM_DPRINT(...) DPRINT(__VA_ARGS__)
#define COM_DPRINT_DATA(...) DPRINT_DATA(__VA_ARGS__)
+ #define COM_FPRINT(...) FPRINT(__VA_ARGS__)
#else
#define COM_DPRINT(...);
#define COM_DPRINT_DATA(...);
+ #define COM_FPRINT(...);
#endif
#define XON_SIGNAL (0x0001 << 0)
@@ -112,7 +114,7 @@
// CTS-host <- RTS-modem
d7a_errors_t d7a_com_open( const d7a_com_config_t* config )
{
- FPRINT("\r\n");
+ COM_FPRINT("\r\n");
g_com_state = SEARCH_HEADER;
g_com_skipped_bytes = 0;
@@ -140,7 +142,7 @@
// Destructor
d7a_errors_t d7a_com_close(void)
{
- FPRINT("\r\n");
+ COM_FPRINT("\r\n");
g_com_rx_thread.terminate();
g_com_tx_thread.terminate();
delete g_com_serial;
@@ -153,7 +155,7 @@
void d7a_com_restart(void)
{
- FPRINT("\r\n");
+ COM_FPRINT("\r\n");
g_com_serial->attach(NULL, Serial::RxIrq);
@@ -177,7 +179,7 @@
*/
static void d7a_com_send(d7a_com_tx_buf_t* tx_buf)
{
- FPRINT("\r\n");
+ COM_FPRINT("\r\n");
COM_DPRINT("<-- (0x%02X) %d\r\n", tx_buf->buf[4], (tx_buf->len - KAL_COM_HEADER_LEN));
@@ -202,7 +204,7 @@
d7a_com_tx_buf_t* d7a_com_new_msg(d7a_com_tx_msg_t* msg)
{
uint8_t len = KAL_COM_HEADER_LEN + msg->alen + msg->plen;
- FPRINT("(len:%d)\r\n", len);
+ COM_FPRINT("(len:%d)\r\n", len);
d7a_com_tx_buf_t* tx_buf = (d7a_com_tx_buf_t*)MALLOC(sizeof(d7a_com_tx_buf_t) - 1 + len);
@@ -231,7 +233,7 @@
void d7a_com_post_msg(d7a_com_tx_msg_t* msg)
{
- FPRINT("\r\n");
+ COM_FPRINT("\r\n");
g_com_tx_queue.put(d7a_com_new_msg(msg));
}
@@ -249,7 +251,7 @@
static void d7a_com_new_pkt(d7a_com_rx_msg_t* pkt)
{
- //FPRINT("\r\n");
+ //COM_COM_FPRINT("\r\n");
COM_DPRINT("--> (0x%02X) %d\r\n", pkt->id, pkt->blen);
@@ -300,7 +302,7 @@
*/
static void parse_packet_header(void)
{
- FPRINT("\r\n");
+ COM_FPRINT("\r\n");
uint8_t header[KAL_COM_HEADER_LEN];
uint8_t seqnum;
@@ -401,7 +403,7 @@
// Thread for parsing packets from RX buffer.
void d7a_com_rx_thread()
{
- FPRINT("(id:0x%08x)\r\n", osThreadGetId());
+ COM_FPRINT("(id:0x%08x)\r\n", osThreadGetId());
while (true)
{
// wait for data available
@@ -420,7 +422,7 @@
void d7a_com_tx_thread()
{
- FPRINT("(id:0x%08x)\r\n", osThreadGetId());
+ COM_FPRINT("(id:0x%08x)\r\n", osThreadGetId());
d7a_com_tx_buf_t* msg;
osEvent evt;
