Exemple #1
0
int main(void)
{
	gpio_init();
	uart_init();
    timers_init();
    __LOG("Timers initialized.");

    ble_stack_init();
    //device_manager_init(erase_bonds);
    gap_params_init();
    services_init();
    advertising_init();
   	__LOG("Radio initialized.");
    conn_params_init();

   	storage_init();
   	contacts_init();
   	__LOG("Application modules initialized");

    // Start execution.
    timers_start();
    advertising_start();
   	__LOG("ADV Started");
   	scan_start();
   	__LOG("Scan Started");

    // Enter main loop.
    for (;;)
    {
        power_manage();
    }
}
Exemple #2
0
int main()
{

   motors_init();
   movman_init();
   contacts_init();
   event_q_init();
   adc_init();
   leds_init();

   sei();

   adc_start();

   movman_schedule_move(
      WAIT_5_SECONDS_THEN_FULL_FORWARD_FOR_A_LONG_TIME,
      TO_MEET_STARTUP_REQUIREMENT,
      IMMEDIATELY);

   while(1){

      // Testing in the lab showed this runs every ~95us

      event_t e = event_q_get_next_event();

      switch(e){

         case LINE_DETECTED:
            handle_line_detected();
            break;
         case CONTACT_DETECTED_BOTH:
         case CONTACT_DETECTED_FRONT:
            handle_front_contact();
            break;
         case CONTACT_DETECTED_REAR:
            handle_rear_contact();
            break;
         case MOVEMENT_COMPLETE:
            handle_movement_complete();
            break;
         case NEW_PROXIMITY_READINGS:
            handle_new_prox_readings();
            break;
         default:
            break;


      }

   }

   return 0;
}