Esempio n. 1
0
static void enable_parallel_programming(void) // TODO
{
#if 1
	PGMW1 &= ~(PAGEL | XA1 | XA0 | BS1);
	read_switch();
	// Applied +5V & +12V
	erase_chip();
	write_fuse(0, 0x99E0);
#else
	_delay_us(100);
	PGMW2 &= ~RESETb;
	xtal1_pulse();
	xtal1_pulse();
	xtal1_pulse();
	PGMW1 &= ~(PAGEL | XA1 | XA0 | BS1);
	_delay_us(1);
	read_switch();
	apply_high_voltage_to_reset();
	_delay_us(1);
#endif
}
Esempio n. 2
0
// Handle an initial switch closure by backing off the closed switch
// NOTE: Relies on independent switches per axis (not shared)
static stat_t _homing_axis_clear(int8_t axis)				// first clear move
{
#ifndef __NEW_SWITCHES
	if (read_switch(hm.homing_switch) == SW_CLOSED) {
		_homing_axis_move(axis, hm.latch_backoff, hm.search_velocity);
	} else if (read_switch(hm.limit_switch) == SW_CLOSED) {
		_homing_axis_move(axis, -hm.latch_backoff, hm.search_velocity);
	} else { // no move needed, so target position is same as current position
		hm.target_position = cm_get_absolute_position(MODEL, axis);
	}
#else
	if (read_switch(hm.homing_switch_axis, hm.homing_switch_position) == SW_CLOSED) {
		_homing_axis_move(axis, hm.latch_backoff, hm.search_velocity);
	} else if (read_switch(hm.limit_switch_axis, hm.limit_switch_position) == SW_CLOSED) {
		_homing_axis_move(axis, -hm.latch_backoff, hm.search_velocity);
	} else { // no move needed, so target position is same as current position
		hm.target_position = cm_get_absolute_position(MODEL, axis);
	}
#endif
	return (_set_homing_func(_homing_axis_search));
}