test test_pin & led
This commit is contained in:
@@ -102,6 +102,80 @@ static void le_stack_Init(void)
|
||||
NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, le_evt_handler, NULL);
|
||||
}
|
||||
|
||||
|
||||
#define ROY_MEM_SEL NRF_GPIO_PIN_MAP(1, 9)
|
||||
#define ROY_MEM_BZY NRF_GPIO_PIN_MAP(0, 8)
|
||||
#define ROY_MEM_REQ NRF_GPIO_PIN_MAP(0, 6)
|
||||
#define ROY_RAM_SEL NRF_GPIO_PIN_MAP(0, 5)
|
||||
#define ROY_MEM_TEST_01 NRF_GPIO_PIN_MAP(0, 26)
|
||||
#define ROY_MEM_TEST_02 NRF_GPIO_PIN_MAP(0, 17)
|
||||
#define ROY_MEM_TEST_03 NRF_GPIO_PIN_MAP(0, 21)
|
||||
#define ROY_MEM_TEST_04 NRF_GPIO_PIN_MAP(0, 19)
|
||||
#define ROY_MEM_TEST_05 NRF_GPIO_PIN_MAP(0, 22)
|
||||
#define ROY_LED1 NRF_GPIO_PIN_MAP(1, 10)
|
||||
|
||||
static void mem_pin(void *p_arg)
|
||||
{
|
||||
nrf_gpio_cfg_output(ROY_MEM_SEL);
|
||||
nrf_gpio_cfg_output(ROY_MEM_BZY);
|
||||
nrf_gpio_cfg_output(ROY_MEM_REQ);
|
||||
nrf_gpio_cfg_output(ROY_RAM_SEL);
|
||||
|
||||
static uint8_t time = 0;
|
||||
for (;;) {
|
||||
|
||||
NRF_LOG_INFO("mem_pin %d", time);
|
||||
time++;
|
||||
nrf_gpio_pin_set(ROY_MEM_SEL);
|
||||
nrf_gpio_pin_set(ROY_MEM_BZY);
|
||||
nrf_gpio_pin_set(ROY_MEM_REQ);
|
||||
nrf_gpio_pin_set(ROY_RAM_SEL);
|
||||
NRF_LOG_INFO("mem_pin on");
|
||||
nrf_delay_ms(2000);
|
||||
|
||||
nrf_gpio_pin_clear(ROY_MEM_SEL);
|
||||
nrf_gpio_pin_clear(ROY_MEM_BZY);
|
||||
nrf_gpio_pin_clear(ROY_MEM_REQ);
|
||||
nrf_gpio_pin_clear(ROY_RAM_SEL);
|
||||
NRF_LOG_INFO("mem_pin off");
|
||||
nrf_delay_ms(2000);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_pin(void *p_arg)
|
||||
{
|
||||
nrf_gpio_cfg_output(ROY_MEM_TEST_01);
|
||||
nrf_gpio_cfg_output(ROY_MEM_TEST_02);
|
||||
nrf_gpio_cfg_output(ROY_MEM_TEST_03);
|
||||
nrf_gpio_cfg_output(ROY_MEM_TEST_04);
|
||||
nrf_gpio_cfg_output(ROY_MEM_TEST_05);
|
||||
nrf_gpio_cfg_output(ROY_LED1);
|
||||
|
||||
static uint8_t time = 0;
|
||||
for (;;) {
|
||||
|
||||
NRF_LOG_INFO("test_pin %d", time);
|
||||
time++;
|
||||
nrf_gpio_pin_set(ROY_MEM_TEST_01);
|
||||
nrf_gpio_pin_set(ROY_MEM_TEST_02);
|
||||
nrf_gpio_pin_set(ROY_MEM_TEST_03);
|
||||
nrf_gpio_pin_set(ROY_MEM_TEST_04);
|
||||
nrf_gpio_pin_set(ROY_MEM_TEST_05);
|
||||
nrf_gpio_pin_set(ROY_LED1);
|
||||
NRF_LOG_INFO("test_pin on");
|
||||
nrf_delay_ms(1000);
|
||||
|
||||
nrf_gpio_pin_clear(ROY_MEM_TEST_01);
|
||||
nrf_gpio_pin_clear(ROY_MEM_TEST_02);
|
||||
nrf_gpio_pin_clear(ROY_MEM_TEST_03);
|
||||
nrf_gpio_pin_clear(ROY_MEM_TEST_04);
|
||||
nrf_gpio_pin_clear(ROY_MEM_TEST_05);
|
||||
nrf_gpio_pin_clear(ROY_LED1);
|
||||
NRF_LOG_INFO("test_pin off");
|
||||
nrf_delay_ms(1000);
|
||||
}
|
||||
}
|
||||
|
||||
static void initialize(void *p_context)
|
||||
{
|
||||
extern void uart_drv_init(void);
|
||||
@@ -138,9 +212,12 @@ int main(void)
|
||||
NRF_LOG_DEFAULT_BACKENDS_INIT();
|
||||
NRF_LOG_INFO("%s Build: %s %s", LE_DEVICE_NAME, __TIME__, __DATE__);
|
||||
|
||||
le_stack_Init();
|
||||
//le_stack_Init();
|
||||
|
||||
nrf_sdh_freertos_init(initialize, NULL);
|
||||
//nrf_sdh_freertos_init(initialize, NULL);
|
||||
|
||||
//xTaskCreate(mem_pin, "mem_pin", 512, NULL, 5, NULL);
|
||||
xTaskCreate(test_pin, "test_pin", 512, NULL, 5, NULL);
|
||||
|
||||
vTaskStartScheduler();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user