본문 바로가기

Study502

nRF51 DK 예제 6 -Radio Transmitter 이번 예제는 무선으로 패킷을 주고받는 예제입니다. 이 예제를 하기위해서는 보드가 2개가 필요한데, 동글을 이용하여도 됩니다. nrf51 DK(PCA 10028)은 transmitter로 dongle(PCA 10031)은 receiver로 설정합니다. main 12345678910111213141516171819202122232425262728293031323334353637383940414243444546int main(void){ uint32_t err_code = NRF_SUCCESS; clock_initialization(); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false); APP_GP.. 2015. 3. 3.
nRF51 DK 예제 5 -GPIOTE 이 예제가 본격적으로 GPIOTE를 사용하는 예제인 것 같습니다. 타이머를 설정하고, PPI를 설정하여서 GPIOTE로 LED를 제어하는 예제. main.c123456789101112131415int main(void){ gpiote_init(); // Configure a GPIO to toggle on a GPIOTE task. timer0_init(); // Use TIMER0 to generate events every 200 ms. ppi_init(); // Use a PPI channel to connect the event to the task automatically. // Workaround for PAN-73: Use of an EVENT from any TIMER module to t.. 2015. 3. 2.
nRF51 DK 예제4 flashwrite 이번 예제는 uart로 char형 문자 하나를 입력 받아 flash에 써주고, 써넣은걸 읽어오는 예제입니다. main.c 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970int main(void){ uint32_t * addr; uint8_t patwr; uint8_t patrd; uint8_t patold; uint32_t i; uint32_t pg_size; uint32_t pg_num; uint32_t err_code; APP_GPIOTE_INIT(1); const app_uart_comm_params_t comm_.. 2015. 3. 2.
nRF51 DK 예제3 bsp bsp는 Board Support Package로 검색해보면 부트로더와 함께 생성되고 하드웨어 보드의 모든 장치를 위한 장치 드라이버를 말한다고 되어있는데 좀 이해하기 힘드네요;;(출처 : 위키) 아무튼~한번 다운로딩받아서 실행해 보면 좀 더 이해가 빠르겠죠? 이번 예제는 버튼(버튼 1과 버튼2)를 누를때마다 상태가 변하고, LED가 변하고, 상태를 uart로 알려줍니다. UART는 P0.11 - Rx, P0.9 - Tx, Vdd와 Gnd를 이용하여 PC와 연결하였습니다. main.c 12345678910111213141516171819202122#include #include #include "boards.h"#include "bsp.h"#include "app_timer.h"#include "app_.. 2015. 2. 27.
nRF51 DK 예제 2 LED blinky_rtx 예제명이 blinky_rtx라길래 uart로 led 제어하는 줄 알았는데, 전혀 상관없네요.^^;; RTX는 CMSIS-RTOS라고 하네요. 어쨌든 이번 예제는 RTX를 이용한 LED 블링크입니다. LED 하나는 스레드를 이용하고, LED하나는 timer를 이용해서 서로 다른 interval로 블링크합니다. main.c 123456789101112131415161718#define OUTPUT_0_INTERVAL 100 /** 2015. 2. 26.
nRF51 DK 예제 1 LED blinky nRF51 DK 예제소스가 keil로 되어 있습니다. IAR stm32f 를 하다 넘어오니 힘드네요;; 헤더파일찾기도 힘들고;; 우선 LED blink 예제!! main.c 1234567891011121314151617181920212223242526#include #include #include "nrf_delay.h"#include "nrf_gpio.h"#include "boards.h" const uint8_t leds_list[LEDS_NUMBER] = LEDS_LIST; /** * @brief Function for application main entry. */int main(void){ // Configure LED-pins as outputs. LEDS_CONFIGURE(LEDS_MASK).. 2015. 2. 26.

인기글