Exemplo n.º 1
0
Arquivo: minut.c Projeto: nnayo/egere
void MNT_init(void)
{
	// init state machine
	STM_init(&MNT.stm, &init);

	// set the door pins direction
	CONE_DDR &= ~_BV(CONE_PIN);

	// init the cone state with its opposite value to generate the first event
	MNT.cone_state = ~(CONE & _BV(CONE_PIN));

	// init fifoes
	FIFO_init(&MNT.ev_fifo, MNT.ev_buf, NB_EVENTS, sizeof(mnt_event_t));
	FIFO_init(&MNT.cmds_fifo, MNT.cmds_buf, NB_CMDS, sizeof(frame_t));
	FIFO_init(&MNT.out_fifo, MNT.out_buf, NB_OUT_FR, sizeof(frame_t));

	// register to dispatcher
	MNT.interf.channel = 7;
	MNT.interf.cmde_mask = _CM(FR_TAKE_OFF) | _CM(FR_MINUT_TIME_OUT) | _CM(FR_STATE) | _CM(FR_APPLI_START);
	MNT.interf.queue = &MNT.cmds_fifo;
	DPT_register(&MNT.interf);

	// init threads
	PT_INIT(&MNT.pt_chk_time_out);
	PT_INIT(&MNT.pt_chk_cmds);
	PT_INIT(&MNT.pt_out);

	// prevent any time-out
	MNT.time_out = TIME_MAX;
	MNT.sampling_rate = SAMPLING_START;

	// the application start signal shall be received
	MNT.started = 0;
}
Exemplo n.º 2
0
/*============================================================================*/
void Global_Init(void)
{
	/* --------------------------------------------------------------------------
	*  Name                 :  Global_Init
	*  Description          :  Initialise the system resources
	*  Parameters           :  void 
	*  Return               :  void
	*  -------------------------------------------------------------------------
	*/
	STM_init();
	initModesAndClock();
	GPIO_Init();
	INTC_init();
}
Exemplo n.º 3
0
int main(void) {

	push_button_init_mode();
	led_init_mode();
	init_stm_interrupt();

	GPDO_portA();

	STM_init();		

 

  /* Loop forever */
  for (;;) {
	  
	  windowlifter();
	  
	  
  }
}