Hi, I try to combine example Blinky with Uart. but i have problem error as link below
Output/blinky_pca10056 Release/Obj/main.o: in function `uart_init':
undefined reference to `app_uart_init'
please check my code
my code
#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include "nrf_delay.h" #include "boards.h" #include "app_uart.h" #include "app_error.h" #include "nrf.h" #include "bsp.h" #if defined (UART_PRESENT) #include "nrf_uart.h" #endif #if defined (UARTE_PRESENT) #include "nrf_uarte.h" #endif #define LED1 NRF_GPIO_PIN_MAP(0,7) #define LED2 NRF_GPIO_PIN_MAP(0,17) #define LED3 NRF_GPIO_PIN_MAP(1,0) #define LED4 NRF_GPIO_PIN_MAP(0,10) #define BT1 NRF_GPIO_PIN_MAP(0,15) #define BT2 NRF_GPIO_PIN_MAP(0,20) #define BT3 NRF_GPIO_PIN_MAP(0,22) #define BT4 NRF_GPIO_PIN_MAP(0,9) /** * @brief Function for application main entry. */ // const uint32_t UICR_ADDR_0x20C __attribute__((at(0x1000120C))) __attribute__((used)) = 0xFFFFFFFE; //#define ENABLE_LOOPBACK_TEST /**< if defined, then this example will be a loopback test, which means that TX should be connected to RX to get data loopback. */ #define MAX_TEST_DATA_BYTES (15U) /**< max number of test bytes to be used for tx and rx. */ #define UART_TX_BUF_SIZE 256 /**< UART TX buffer size. */ #define UART_RX_BUF_SIZE 256 /**< UART RX buffer size. */ void uart_error_handle(app_uart_evt_t * p_event) { if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR) { APP_ERROR_HANDLER(p_event->data.error_communication); } else if (p_event->evt_type == APP_UART_FIFO_ERROR) { APP_ERROR_HANDLER(p_event->data.error_code); } } void uart_event_handle(app_uart_evt_t * p_event) { static uint8_t data_array[UART_RX_BUF_SIZE]; static uint8_t index = 0; uint32_t err_code; switch (p_event->evt_type) { case APP_UART_DATA_READY: UNUSED_VARIABLE(app_uart_get(&data_array[index++])); break; case APP_UART_COMMUNICATION_ERROR: APP_ERROR_HANDLER(p_event->data.error_communication); break; case APP_UART_FIFO_ERROR: APP_ERROR_HANDLER(p_event->data.error_code); break; default: break; } } /**@brief Function for initializing the UART module. */ /**@snippet [UART Initialization] */ static void uart_init(void) { uint32_t err_code; app_uart_comm_params_t const comm_params = { .rx_pin_no = RX_PIN_NUMBER, .tx_pin_no = TX_PIN_NUMBER, .rts_pin_no = RTS_PIN_NUMBER, .cts_pin_no = CTS_PIN_NUMBER, .flow_control = APP_UART_FLOW_CONTROL_DISABLED, .use_parity = false, #if defined (UART_PRESENT) .baud_rate = NRF_UART_BAUDRATE_115200 #else .baud_rate = NRF_UARTE_BAUDRATE_115200 #endif }; APP_UART_FIFO_INIT(&comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_event_handle, APP_IRQ_PRIORITY_LOWEST, err_code); APP_ERROR_CHECK(err_code); } /**@snippet [UART Initialization] */ int main(void) { /* Configure board. */ //bsp_board_init(BSP_INIT_LEDS); uint32_t err_code; uart_init(); nrf_gpio_cfg_output(LED1); nrf_gpio_cfg_output(LED2); nrf_gpio_cfg_output(LED3); nrf_gpio_cfg_output(LED4); nrf_gpio_cfg_input(BT1, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BT2, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BT3, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BT4, NRF_GPIO_PIN_PULLUP); while (true) { // nrf_delay_ms(100); // nrf_gpio_pin_toggle(LED1); // nrf_gpio_pin_toggle(LED2); // nrf_gpio_pin_toggle(LED3); // nrf_gpio_pin_toggle(LED4); uint32_t sb1 = nrf_gpio_pin_read(BT1); uint32_t sb2 = nrf_gpio_pin_read(BT2); uint32_t sb3 = nrf_gpio_pin_read(BT3); uint32_t sb4 = nrf_gpio_pin_read(BT4); nrf_gpio_pin_write(LED1, sb1); nrf_gpio_pin_write(LED2, sb2); nrf_gpio_pin_write(LED3, sb3); nrf_gpio_pin_write(LED4, sb4); } } /** *@} **/