fork test
Dependencies: BLE_API WIFI_API_32kRAM mbed nRF51822
Fork of NNN40_CLI by
Diff: main.cpp
- Revision:
- 3:38ec8ad317f4
- Parent:
- 0:5c195ab2f696
- Child:
- 4:b52035367aee
--- a/main.cpp Fri Sep 11 07:52:06 2015 +0000 +++ b/main.cpp Fri Oct 02 10:36:29 2015 +0000 @@ -1,41 +1,53 @@ #include "mbed.h" #include "Gap.h" #include "command-interpreter.h" +#include "nrf_gpio.h" - +#define UART_2ND_CFG_PIN 5 +#define UART_2ND_TX p16 +#define UART_2ND_RX p17 +#define UART_2ND_TX_PIN 16 +#define UART_2ND_RX_PIN 17 DigitalOut swio(p19); Serial console(TX_PIN_NUMBER,RX_PIN_NUMBER); - -//void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) -//{ -// /* Leave for application */ -//} - +//Serial console(3,4); int main(void) { + + /* Removing Select external 32MHz crystal for NNN40-DT1R */ + uint8_t inputChar; + nrf_gpio_cfg_output(7); + nrf_gpio_pin_set(7); + // gill 20150914 Re-configure UART pin by UART_2ND_CFG_PIN + //nrf_gpio_cfg_input(UART_2ND_TX_PIN, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_input(UART_2ND_RX_PIN, NRF_GPIO_PIN_PULLDOWN); + wait(0.5); + //console.printf("UART RX 2ND READ %i\r\n",nrf_gpio_pin_read(UART_2ND_RX_PIN)); + if (nrf_gpio_pin_read(UART_2ND_RX_PIN)) + { + Serial console(UART_2ND_TX,UART_2ND_RX); + //console.baud(115200); + //console.printf("UART RX 2ND READ %i\r\n",nrf_gpio_pin_read(UART_2ND_RX_PIN)); + } + else + { + + } + console.baud(115200); + /* swio default low for BLE RF */ swio = 0; - - /* Select external 32MHz crystal for NNN40-DT1R */ - NRF_CLOCK->XTALFREQ = 0x00000000; - NRF_CLOCK->EVENTS_HFCLKSTARTED = 0; - NRF_CLOCK->TASKS_HFCLKSTART = 1; - while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) - {// Do nothing. - } - - uint8_t inputChar; - console.baud(115200); - console.printf("\r\nDELTA BLE with WiFi\r\n"); - + console.printf("\r\nDELTA BLE with WiFi\r\n"); while(1) { while (NRF_UART0->EVENTS_RXDRDY != 1) { // Wait for RXD data to be received } NRF_UART0->EVENTS_RXDRDY = 0; - inputChar = (uint8_t)NRF_UART0->RXD; - + inputChar = (uint8_t)NRF_UART0->RXD; + //char input = inputChar; +// console.printf(&input); + cyntecProcessCommandInput(inputChar); } }