This CLI (Command Line Interface) is based mbed-os. Both NNN50 and NQ620 are supported.
Fork of NNN40_CLI by
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
Please open the com port at 115200 8n1 as default
main.cpp@3:38ec8ad317f4, 2015-10-02 (annotated)
- Committer:
- gillwei7
- Date:
- Fri Oct 02 10:36:29 2015 +0000
- Revision:
- 3:38ec8ad317f4
- Parent:
- 0:5c195ab2f696
- Child:
- 4:b52035367aee
Gill Wei commit 20151002 update with WIFI_API_32kRAM Rev. 12, provide Scan, Read version and other wifi function, Set AP mode not ready.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gillwei7 | 0:5c195ab2f696 | 1 | #include "mbed.h" |
gillwei7 | 0:5c195ab2f696 | 2 | #include "Gap.h" |
gillwei7 | 0:5c195ab2f696 | 3 | #include "command-interpreter.h" |
gillwei7 | 3:38ec8ad317f4 | 4 | #include "nrf_gpio.h" |
gillwei7 | 0:5c195ab2f696 | 5 | |
gillwei7 | 3:38ec8ad317f4 | 6 | #define UART_2ND_CFG_PIN 5 |
gillwei7 | 3:38ec8ad317f4 | 7 | #define UART_2ND_TX p16 |
gillwei7 | 3:38ec8ad317f4 | 8 | #define UART_2ND_RX p17 |
gillwei7 | 3:38ec8ad317f4 | 9 | #define UART_2ND_TX_PIN 16 |
gillwei7 | 3:38ec8ad317f4 | 10 | #define UART_2ND_RX_PIN 17 |
gillwei7 | 0:5c195ab2f696 | 11 | DigitalOut swio(p19); |
gillwei7 | 0:5c195ab2f696 | 12 | Serial console(TX_PIN_NUMBER,RX_PIN_NUMBER); |
gillwei7 | 3:38ec8ad317f4 | 13 | //Serial console(3,4); |
gillwei7 | 0:5c195ab2f696 | 14 | int main(void) |
gillwei7 | 0:5c195ab2f696 | 15 | { |
gillwei7 | 3:38ec8ad317f4 | 16 | |
gillwei7 | 3:38ec8ad317f4 | 17 | /* Removing Select external 32MHz crystal for NNN40-DT1R */ |
gillwei7 | 3:38ec8ad317f4 | 18 | uint8_t inputChar; |
gillwei7 | 3:38ec8ad317f4 | 19 | nrf_gpio_cfg_output(7); |
gillwei7 | 3:38ec8ad317f4 | 20 | nrf_gpio_pin_set(7); |
gillwei7 | 3:38ec8ad317f4 | 21 | // gill 20150914 Re-configure UART pin by UART_2ND_CFG_PIN |
gillwei7 | 3:38ec8ad317f4 | 22 | //nrf_gpio_cfg_input(UART_2ND_TX_PIN, NRF_GPIO_PIN_NOPULL); |
gillwei7 | 3:38ec8ad317f4 | 23 | nrf_gpio_cfg_input(UART_2ND_RX_PIN, NRF_GPIO_PIN_PULLDOWN); |
gillwei7 | 3:38ec8ad317f4 | 24 | wait(0.5); |
gillwei7 | 3:38ec8ad317f4 | 25 | //console.printf("UART RX 2ND READ %i\r\n",nrf_gpio_pin_read(UART_2ND_RX_PIN)); |
gillwei7 | 3:38ec8ad317f4 | 26 | if (nrf_gpio_pin_read(UART_2ND_RX_PIN)) |
gillwei7 | 3:38ec8ad317f4 | 27 | { |
gillwei7 | 3:38ec8ad317f4 | 28 | Serial console(UART_2ND_TX,UART_2ND_RX); |
gillwei7 | 3:38ec8ad317f4 | 29 | //console.baud(115200); |
gillwei7 | 3:38ec8ad317f4 | 30 | //console.printf("UART RX 2ND READ %i\r\n",nrf_gpio_pin_read(UART_2ND_RX_PIN)); |
gillwei7 | 3:38ec8ad317f4 | 31 | } |
gillwei7 | 3:38ec8ad317f4 | 32 | else |
gillwei7 | 3:38ec8ad317f4 | 33 | { |
gillwei7 | 3:38ec8ad317f4 | 34 | |
gillwei7 | 3:38ec8ad317f4 | 35 | } |
gillwei7 | 3:38ec8ad317f4 | 36 | console.baud(115200); |
gillwei7 | 3:38ec8ad317f4 | 37 | |
gillwei7 | 0:5c195ab2f696 | 38 | /* swio default low for BLE RF */ |
gillwei7 | 0:5c195ab2f696 | 39 | swio = 0; |
gillwei7 | 3:38ec8ad317f4 | 40 | console.printf("\r\nDELTA BLE with WiFi\r\n"); |
gillwei7 | 0:5c195ab2f696 | 41 | while(1) { |
gillwei7 | 0:5c195ab2f696 | 42 | while (NRF_UART0->EVENTS_RXDRDY != 1) |
gillwei7 | 0:5c195ab2f696 | 43 | { |
gillwei7 | 0:5c195ab2f696 | 44 | // Wait for RXD data to be received |
gillwei7 | 0:5c195ab2f696 | 45 | } |
gillwei7 | 0:5c195ab2f696 | 46 | NRF_UART0->EVENTS_RXDRDY = 0; |
gillwei7 | 3:38ec8ad317f4 | 47 | inputChar = (uint8_t)NRF_UART0->RXD; |
gillwei7 | 3:38ec8ad317f4 | 48 | //char input = inputChar; |
gillwei7 | 3:38ec8ad317f4 | 49 | // console.printf(&input); |
gillwei7 | 3:38ec8ad317f4 | 50 | |
gillwei7 | 0:5c195ab2f696 | 51 | cyntecProcessCommandInput(inputChar); |
gillwei7 | 0:5c195ab2f696 | 52 | } |
gillwei7 | 0:5c195ab2f696 | 53 | } |