This CLI (Command Line Interface) is based mbed-os. Both NNN50 and NQ620 are supported.

Fork of NNN40_CLI by Delta

BLE CLI Document can be downloaded here .

Note that when evaluate using Windows PC as the host, the Serial driver need to be installed in advance. The instruction is explained in the link below

https://developer.mbed.org/handbook/Windows-serial-configuration

Once installed, a device called 'mbed Serial Port (COM#)' should be recognized in Device Manager, as shown below

/media/uploads/tsungta/mbed_serial_port_1.png

Please open the com port at 115200 8n1 as default

Committer:
tsungta
Date:
Fri May 12 01:53:35 2017 +0000
Revision:
25:1423b707b705
Parent:
21:72d7a6e85d7f
update mbed-os to revision 2992; Note that NNN50 is temporary not supported due to the memory constraint

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsungta 17:03c8af30087a 1 #include <mbed.h>
tsungta 17:03c8af30087a 2
gillwei7 0:5c195ab2f696 3 #include "Gap.h"
gillwei7 0:5c195ab2f696 4 #include "command-interpreter.h"
gillwei7 3:38ec8ad317f4 5 #include "nrf_gpio.h"
gillwei7 0:5c195ab2f696 6
tsungta 17:03c8af30087a 7 #include "ble_cli.h"
tsungta 17:03c8af30087a 8
tsungta 25:1423b707b705 9 #if defined(TARGET_DELTA_DFCM_NNN50)
tsungta 25:1423b707b705 10 #error Delta_CLI is not supported on NNN50 temporary due to the memory constraint
tsungta 25:1423b707b705 11 #endif
tsungta 25:1423b707b705 12
tsungta 20:bd1760975052 13 #define uart_buffer_size 64 //Do not increase uart_buffer_size to prevent out of memory,
tsungta 25:1423b707b705 14 #define uart_baudrate 38400 //supported baudrate range between 1200 to 230400 (38400) for NQ620 (NNN50)
tsungta 17:03c8af30087a 15 unsigned char uart_buf[uart_buffer_size];
tsungta 17:03c8af30087a 16 unsigned int i = 0;
tsungta 17:03c8af30087a 17
tsungta 17:03c8af30087a 18 Serial console(USBTX, USBRX);
tsungta 17:03c8af30087a 19
tsungta 17:03c8af30087a 20 void CLI_execute() {
tsungta 17:03c8af30087a 21 // if (i>=2)
tsungta 17:03c8af30087a 22 // if (uart_buf[i-2] == 0x0D && uart_buf[i-1] == 0x0A){//detecting CR LF
tsungta 17:03c8af30087a 23 if (console.readable()) return;//retrun if it is not the end of packet
tsungta 17:03c8af30087a 24 for (int j=0; j<i; j++)
tsungta 17:03c8af30087a 25 cyntecProcessCommandInput(uart_buf[j]);
tsungta 17:03c8af30087a 26 //console.putc(uart_buf[j]);//used for debug only
tsungta 17:03c8af30087a 27 i=0;
tsungta 17:03c8af30087a 28 // }
tsungta 17:03c8af30087a 29 }
tsungta 17:03c8af30087a 30 void uart_interrupt() {
tsungta 17:03c8af30087a 31 uart_buf[i++] = console.getc();
tsungta 17:03c8af30087a 32 CLI_execute();
tsungta 17:03c8af30087a 33 }
gillwei7 4:b52035367aee 34
gillwei7 0:5c195ab2f696 35 int main(void)
gillwei7 0:5c195ab2f696 36 {
gillwei7 3:38ec8ad317f4 37
tsungta 17:03c8af30087a 38 console.attach(&uart_interrupt);
tsungta 17:03c8af30087a 39 console.baud(uart_baudrate);
tsungta 17:03c8af30087a 40 console.printf("\r\nBLE initialized\r\n");
tsungta 17:03c8af30087a 41 cynBLEInitCommand();
gillwei7 0:5c195ab2f696 42 }