Esempio n. 1
0
static void led_display(){
	alt_16 switch_value = 0;
	int i = 0;
	switch_value = ReadSwitches();
	_Bool press_flag = true;
	edge_capture = 0;
	init_button_pio();
	while(1 == 1){
		if(edge_capture && press_flag){
			press_flag = false;
			edge_capture = 0;
			switch_value = ReadSwitches();
			/*displaying switches' value to LED or seven-segment*/
			for(i = 0; i < 8; i ++){
				if (edge_capture && !press_flag){//get interruption from button release
					edge_capture = 0;
					press_flag = true;
				}else if(edge_capture)//get interruption from reseting the switches
					break;
				/*If the next bit is 1 then turn on the led*/
				if (switch_value & 1)
					LED_on();
				else
				/*If the next bit is 0 then turn off the led*/
					LED_off();
				switch_value >>=  1;
			}
			LED_off();
		}else if(edge_capture){//get interruption from button release
Esempio n. 2
0
MainObject::MainObject(QObject *parent,const char *name)
{
  input_fd=-1;
  dest_hostname=RMLSEND_DEFAULT_ADDR;
  dest_port=RMLSEND_DEFAULT_PORT;
  rml_ptr=0;

  ReadSwitches();
  ResolveName();
  InitStream();
  ProcessCommands();
  CloseStream();

  exit(0);
}