Beispiel #1
0
int main( void ) {
  /* init peripherals */
  timer_init();
  uart_init();
  soft_uart_init();
  adc_init();
  sei();

  /*  enter mainloop */
  while( 1 ) {
    if(timer_periodic())
      periodic_task();
    if (soft_uart_error) {
      LINK_TMTC_SEND_ERROR(soft_uart_error);
      soft_uart_error = 0;
    }
    if (soft_uart_got_byte) {
      input_buf[input_buf_idx] = soft_uart_byte;
      input_buf_idx++;
      if (input_buf_idx >= INPUT_BUF_LEN) {
	LINK_TMTC_SEND_DATA(input_buf, input_buf_idx);
	input_buf_idx = 0;
      }
      soft_uart_got_byte = FALSE;
    }
    if (adc_got_val) {
      saved_valim = adc_alim;
      adc_got_val = FALSE;
    }
  }
  return 0;
}
Beispiel #2
0
int main( void ) 
{
  uint8_t init_cpt;
  /* init peripherals */
  timer_init(); 
  modem_init();
  adc_init();
#ifdef CTL_BRD_V1_1  
  adc_buf_channel(ADC_CHANNEL_BAT, &buf_bat);
#endif
  spi_init();
  link_fbw_init();
  gps_init();
  nav_init();
  ir_init();
  estimator_init();
#	ifdef PAPABENCH_SINGLE
		fbw_init();
#	endif

  /* start interrupt task */
  //sei(); /*Fadia*/

  /* Wait 0.5s (for modem init ?) */
  init_cpt = 30;
  _Pragma("loopbound min 31 max 31")
  while (init_cpt) {
    if (timer_periodic())
      init_cpt--;
  }

  /*  enter mainloop */
#ifndef NO_MAINLOOP
  while( 1 ) {
#endif
    if(timer_periodic()) {
      periodic_task();
#		if PAPABENCH_SINGLE
			fbw_schedule();
#		endif
	}
    if (gps_msg_received) 
    {
	/*receive_gps_data_task()*/
	parse_gps_msg();
	send_gps_pos();
        send_radIR();
        send_takeOff();
    }
    if (link_fbw_receive_complete) {
      link_fbw_receive_complete = FALSE;
      radio_control_task();
    }
#ifndef NO_MAINLOOP
  } 
#endif
  return 0;
}
Beispiel #3
0
/** @brief: Function for handling the RTC0 interrupts.
 * Triggered on TICK and COMPARE0 match.
 */
static void rtc_handler(nrf_drv_rtc_int_type_t int_type)
{
    switch (int_type)
    {
    case CC_PERIODIC:
        periodic_task();
        break;
    case CC_DEBOUNCE:
        btn_debounce();
        break;
    case CC_BLINK:
        if (!g_btn_pressed)
            led_off();
        rtc_cc_disable(CC_BLINK);
        break;
    default:
        ;
    }
}