This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Basic questions about Nordic's style of programming.

Hello all,

In the proccess of migrating from arduino to SES IDE to work with the nrf52832 SOC and coming accros some of the examples in the SDK I'm strugglling to understand a few things I didn't came across before like in this loop:

 while (true)
{
    for (uint8_t i = 0; i < 40; ++i)
    {
        value = (i < 20) ? (i * 5) : (100 - (i - 20) * 5);

        ready_flag = false;
        /* Set the duty cycle - keep trying until PWM is ready... */
        while (app_pwm_channel_duty_set(&PWM1, 0, value) == NRF_ERROR_BUSY);

        /* ... or wait for callback. */
        while (!ready_flag);
       // APP_ERROR_CHECK(app_pwm_channel_duty_set(&PWM1, 1, value));
        nrf_delay_ms(25);
    }
}

what does the operations ? and : do?

and in other examples the main loop function seem empty with only a function to reduce power I guess putting the IC to sleep like:__WFE(); and code still manages to work for example in the SAADC example...

any explanation for that?

also I see those alot:

NRF_LOG_FLUSH(); info center def:

"Use the NRF_LOG_FLUSH() macro to ensure that all logs have been processed."

APP_ERROR_CHECK();

What are they necessary for?

Thanks for your time.

and:

Parents Reply Children
No Data
Related