Move example apps to C-only API. (#99)

This commit is contained in:
Jonathan Hui
2016-06-02 18:38:27 -07:00
parent 1d5dae8578
commit c3009d0361
21 changed files with 221 additions and 65 deletions
+8 -5
View File
@@ -31,12 +31,15 @@
* This file implements the CLI server on the serial service.
*/
#include <new>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cli/cli.hpp>
#include <cli/cli-serial.h>
#include <cli/cli_serial.hpp>
#include <common/code_utils.hpp>
#include <common/encoding.hpp>
@@ -50,19 +53,19 @@ static const char sEraseString[] = {'\b', ' ', '\b'};
static const char CRNL[] = {'\r', '\n'};
static Serial *sServer;
Serial::Serial(void)
static otDEFINE_ALIGNED_VAR(sCliSerialRaw, sizeof(Serial), uint64_t);
extern "C" void otCliSerialInit(void)
{
sServer = this;
sServer = new(&sCliSerialRaw) Serial;
}
ThreadError Serial::Start(void)
Serial::Serial(void)
{
mRxLength = 0;
mTxHead = 0;
mTxLength = 0;
mSendLength = 0;
otPlatSerialEnable();
return kThreadError_None;
}
extern "C" void otPlatSerialReceived(const uint8_t *aBuf, uint16_t aBufLength)