int main() { HardwareInit(); g_Uart.printf("UART over BLE Demo\r\n"); //g_Uart.Disable(); BleAppInit((const BLEAPP_CFG *)&s_BleAppCfg, true); BleAppRun(); return 0; }
int main() { bool res; char *data = "nRF UART Hello World\r\n"; uint8_t buff[20]; /* nrf_gpio_cfg_output(9); while (1) { nrf_gpio_pin_toggle(9); usDelay(1000); }*/ //NRF_MPU->PERR0 &= ~(1 << 2); //uart_init(); //simple_uart_config(UART_RTS_PIN, UART_TX_PIN, UART_CTS_PIN, UART_RX_PIN, false); #ifdef C_CODE res = UARTInit(&g_UartDev, &g_UartCfg); UARTprintf(&g_UartDev, data); #else res = g_Uart.Init(g_UartCfg); g_Uart.printf(data);dfg #endif // nrf_drv_gpiote_in_config_t cts_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false); // nrf_drv_gpiote_in_init(p_comm_params->cts_pin_no, &cts_config, gpiote_uart_event_handler); //for (int i = 0; i < 20; i++) // simple_uart_put(data[i]); //simple_uart_putstring((const uint8_t*)data); while(1) { uint8_t d; //usDelay(1000); //d = simple_uart_get(); //simple_uart_put(d); #ifndef TEST_INTERRUPT if (UARTRx(&g_UartDev, &d, 1) > 0) { UARTTx(&g_UartDev, &d, 1); // UARTTx(&g_UartDev, (uint8_t*)data, 22); //usDelay(1000); } #else int cnt = UARTRx(&g_UartDev, buff, 20); if (cnt > 0) { uint8_t *p = buff; while (cnt > 0) { int l = UARTTx(&g_UartDev, p, cnt); cnt -= l; p += l; } // UARTTx(&g_UartDev, (uint8_t*)data, 22); //usDelay(1000); } #endif //__WFI(); } return 0; }