/**
 * @brief Function for main application entry.
 */
int main(void)
{
    LEDS_CONFIGURE(LEDS_MASK);                       //Configure all leds
    LEDS_OFF(LEDS_MASK);                             //Turn off all leds
	
    NRF_POWER->DCDCEN = 1;                           //Enabling the DCDC converter for lower current consumption
	
#ifdef UART_PRINTING_ENABLED
    uint32_t err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);                       //Configure Logging. LOGGING is used to show the SAADC sampled result. Default is UART, but RTT can be configured in sdk_config.h
    NRF_LOG_INFO("\n\rSAADC Low Power Example.\r\n");	
#endif //UART_PRINTING_ENABLED	

    lfclk_config();                                  //Configure low frequency 32kHz clock
    rtc_config();                                    //Configure RTC. The RTC will generate periodic interrupts. Requires 32kHz clock to operate.

    saadc_init();                                    //Initialize and start SAADC
    
    while (1)
    {
        if(m_saadc_calibrate == true)
        {
#ifdef UART_PRINTING_ENABLED
            NRF_LOG_INFO("SAADC calibration starting...  \r\n");    //Print on UART
#endif //UART_PRINTING_ENABLED	
            while(nrf_drv_saadc_calibrate_offset() != NRF_SUCCESS); //Trigger calibration task
            m_saadc_calibrate = false;
        }
        nrf_pwr_mgmt_run();
#ifdef UART_PRINTING_ENABLED
        NRF_LOG_FLUSH();
#endif //UART_PRINTING_ENABLED
    }
}
Exemple #2
0
int main(void)
{
    LEDS_CONFIGURE(1U << READ_ALL_INDICATOR);
    LEDS_OFF(1U << READ_ALL_INDICATOR);

    // Start internal LFCLK XTAL oscillator - it is needed by BSP to handle
    // buttons with the use of APP_TIMER and for "read_all" ticks generation
    // (by RTC).
    lfclk_config();

    bsp_config();
    uart_config();

    printf("\n\rTWI master example\r\n");

    twi_config();

    // Initialize sensors.
    APP_ERROR_CHECK(app_twi_perform(&m_app_twi, lm75b_init_transfers,
        LM75B_INIT_TRANSFER_COUNT, NULL));
    APP_ERROR_CHECK(app_twi_perform(&m_app_twi, mma7660_init_transfers,
        MMA7660_INIT_TRANSFER_COUNT, NULL));

    rtc_config();

    while (true)
    {
        __WFI();
    }
}
Exemple #3
0
/**
 * main function
 * \return 0. int return type required by ANSI/ISO standard.
 */
int main(void)
{
  gpio_config();
  lfclk_config();
  rtc_config();
  NRF_RTC0->TASKS_START = 1;
  while (true)
  {
  }
}
Exemple #4
0
int main( void )
{
    lfclk_config();
    //RTC1_Init();
    rtc_timer_init();
    setup();
    
    for (;;)
    {
        loop();
    }
    
    return 0;
}
Exemple #5
0
/**
 * @brief Function for application main entry.
 */
int main(void)
{
    leds_config();

    lfclk_config();

    rtc_config();

    while (true)
    {
        __SEV();
        __WFE();
        __WFE();
    }
}
Exemple #6
0
/**
 * @brief Function for application main entry.
 */
int main(void) {

    // setup
    gpio_config();
    lfclk_config();
    rtc_config();

    // loop
    while (true) {
            // Enter System ON sleep mode
            __WFE();
            // Make sure any pending events are cleared
            __SEV();
            __WFE();
    }
}