Example #1
0
void system_init()
{
//  CONTROL_DDR &= ~(CONTROL_MASK); // Configure as input pins
//  #ifdef DISABLE_CONTROL_PIN_PULL_UP
//    CONTROL_PORT &= ~(CONTROL_MASK); // Normal low operation. Requires external pull-down.
//  #else
//    CONTROL_PORT |= CONTROL_MASK;   // Enable internal pull-up resistors. Normal high operation.
//  #endif
//  CONTROL_PCMSK |= CONTROL_MASK;  // Enable specific pins of the Pin Change Interrupt
//  PCICR |= (1 << CONTROL_INT);   // Enable Pin Change Interrupt

#ifdef 	RESET_PIN
	set_as_input(RESET_PIN);
#endif
#ifdef FEED_HOLD_PIN
	set_as_input(FEED_HOLD_PIN);
#endif
#ifdef CYCLE_START_PIN
	set_as_input(CYCLE_START_PIN);
#endif
#ifdef SAFETY_DOOR_PIN
	set_as_input(SAFETY_DOOR_PIN);
#endif

}
Example #2
0
void run()
{
	setup_hardware();
	current_state.current_screen->draw();
	set_as_input(DDRC, 5);
	set_as_input(DDRC, 4);
	set_as_input(DDRC, 3);
	forever
	{
		struct event_t e;
		if(NOTHING_HAPPENED != poll_hardware(&e) && e.emitter != NOTHING_HAPPENED)
		{
			if(current_state.current_screen->event_handler != NULL)
			{
				switch(current_state.current_screen->event_handler(&e))
				{
					case SIGNAL_REDRAW:
					{
						current_state.current_screen->draw();
						break;
					}
					
					default:
					{
						
					}
				}
			}
			
			global_event_handler(&e);
		}
	}
}
Example #3
0
void limits_init() 
{
//  LIMIT_DDR &= ~(LIMIT_MASK); // Set as input pins
//
//  #ifdef DISABLE_LIMIT_PIN_PULL_UP
//    LIMIT_PORT &= ~(LIMIT_MASK); // Normal low operation. Requires external pull-down.
//  #else
//    LIMIT_PORT |= (LIMIT_MASK);  // Enable internal pull-up resistors. Normal high operation.
//  #endif
//
//  if (bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE)) {
//    LIMIT_PCMSK |= LIMIT_MASK; // Enable specific pins of the Pin Change Interrupt
//    PCICR |= (1 << LIMIT_INT); // Enable Pin Change Interrupt
//  } else {
//    limits_disable();
//  }
//
//  #ifdef ENABLE_SOFTWARE_DEBOUNCE
//    MCUSR &= ~(1<<WDRF);
//    WDTCSR |= (1<<WDCE) | (1<<WDE);
//    WDTCSR = (1<<WDP0); // Set time-out at ~32msec.
//  #endif

	set_as_input(LIMX);
	set_as_input(LIMY);
	set_as_input(LIMZ);

	if (bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE)) {
		limits_enable();
	} else {
		limits_disable();
	}

}
Example #4
0
int main() {
	//set pin to output
	p.p_addr = GPIO_BASE_ADDR;
	map_gpio(&p);
	set_as_input(&p, 4);
	//set_as_output(&p, 4);
	set_output(&p, 4, 0);
	clear_output(&p, 4);
	read_pin(&p, 4);	
	return 0;
}
Example #5
0
// Probe pin initialization routine.
void probe_init() 
{
//  PROBE_DDR &= ~(PROBE_MASK); // Configure as input pins
//  #ifdef DISABLE_PROBE_PIN_PULL_UP
//    PROBE_PORT &= ~(PROBE_MASK); // Normal low operation. Requires external pull-down.
//  #else
//    PROBE_PORT |= PROBE_MASK;    // Enable internal pull-up resistors. Normal high operation.
//  #endif

	set_as_input(PROBE);
	probe_configure_invert_mask(false); // Initialize invert mask. Re-updated during use.
}