Skip to content

Commit

Permalink
adjust thread stack size and make role prompt more friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
sogwms committed Feb 4, 2020
1 parent 00d04db commit fc3ad48
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions demo/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#define NRF24_DEMO_CE_PIN PKG_NRF24L01_DEMO_CE_PIN
#define NRF24_DEMO_IRQ_PIN PKG_NRF24L01_DEMO_IRQ_PIN

const static char *ROLE_TABLE[] = {"PTX", "PRX"};

static void rx_ind(nrf24_t nrf24, uint8_t *data, uint8_t len, int pipe)
{
/*! Don't need to care the pipe if the role is ROLE_PTX */
Expand Down Expand Up @@ -47,7 +49,7 @@ static void tx_done(nrf24_t nrf24, int pipe)

rt_kprintf(" (pipe%d)\n", pipe);

rt_sprintf(tbuf, "My role is %d [%dth]\n", nrf24->cfg.role, cnt);
rt_sprintf(tbuf, "My role is %s [%dth]\n", ROLE_TABLE[nrf24->cfg.role], cnt);
nrf24_send_data(nrf24, (uint8_t *)tbuf, rt_strlen(tbuf), pipe);
#ifdef PKG_NRF24L01_DEMO_ROLE_PTX
rt_thread_mdelay(NRF24_DEMO_SEND_INTERVAL);
Expand Down Expand Up @@ -93,7 +95,7 @@ static int nrf24l01_sample_init(void)
{
rt_thread_t thread;

thread = rt_thread_create("nrfDemo", thread_entry, RT_NULL, 2048, RT_THREAD_PRIORITY_MAX/2, 20);
thread = rt_thread_create("nrfDemo", thread_entry, RT_NULL, 1024, RT_THREAD_PRIORITY_MAX/2, 20);
rt_thread_startup(thread);

return RT_EOK;
Expand Down

0 comments on commit fc3ad48

Please sign in to comment.