nrf51822的DEMO代码不能将TASKS类寄存器赋值???
int main(void){
init();
uint8_t btn0_nstate; // Store new (current) state of button 0
uint8_t btn1_nstate; // Store new (current) state of button 1
uint8_t btn0_ostate = nrf_gpio_pin_read(BUTTON0); // Store old (previous) state of button 0
uint8_t btn1_ostate = nrf_gpio_pin_read(BUTTON1); // Store old (previous) state of button 1
while(true)
{
uint8_t btns = 0;
btn0_nstate = nrf_gpio_pin_read(BUTTON0);
btn1_nstate = nrf_gpio_pin_read(BUTTON1);
if ((btn0_ostate == 1) && (btn0_nstate == 0))
{
btns |= 1;
}
if ((btn1_ostate == 1) && (btn1_nstate == 0))
{
btns |= 2;
}
btn0_ostate = btn0_nstate;
btn1_ostate = btn1_nstate;
// Place the read buttons in the payload, enable the radio and
// send the packet:
// packet = 1;
NRF_RADIO->EVENTS_READY = 0U;
NRF_RADIO->TASKS_TXEN = 1U;
while (NRF_RADIO->EVENTS_READY == 0U)
{
}
NRF_RADIO->TASKS_START = 1U;
NRF_RADIO->EVENTS_END = 0U;
while(NRF_RADIO->EVENTS_END == 0U)
{
}
NRF_RADIO->EVENTS_DISABLED = 0U;
// Disable radio
NRF_RADIO->TASKS_DISABLE = 1U;
while(NRF_RADIO->EVENTS_DISABLED == 0U)
{
}
}
}
/**
*@}
**/
此代码为nrf51822 demo代码,代码不能将TASKS_TXEN寄存器赋值?
楼主能否将完整代码贴出来供大家分析?
页:
[1]