コード例 #1
0
ファイル: linesensor.cpp プロジェクト: matthewbot/IEEE2012
void linesensor_read(uint16_t *buf) {
	tick_suspend();
	for (int i=0; i<8; i++) {
		buf[i] = readingsbuf[7-i];
	}
	tick_resume();
}
コード例 #2
0
ファイル: tick.cpp プロジェクト: wegenerandrew/Instigator
void tick_init() {
	tim.CTRLA = TC_CLKSEL_DIV64_gc; 	// 32Mhz / 64 = .5 Mhz timer (TICK_TIMHZ == 5E5)
	tim.CTRLB = TC0_CCAEN_bm; 			// enable capture compare A
	tim.PER = TICK_TIMMAX; 				// TICK_TIMHZ / (TICK_TIMHZ / TICK_HZ) = TICK_HZ timer
	tim.CCABUF = 200; 					// 200 / .5Mhz = 400us CCA (for linesensor)
	tick_resume(); 						// enable interrupts
}
コード例 #3
0
ファイル: tick-common.c プロジェクト: longqzh/chronnOS
/*
 * Notification about clock event devices
 */
static int tick_notify(struct notifier_block *nb, unsigned long reason,
			       void *dev)
{
	switch (reason) {

	case CLOCK_EVT_NOTIFY_ADD:
		return tick_check_new_device(dev);

	case CLOCK_EVT_NOTIFY_BROADCAST_ON:
	case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
	case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
		tick_broadcast_on_off(reason, dev);
		break;

	case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
	case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
		tick_broadcast_oneshot_control(reason);
		break;

	case CLOCK_EVT_NOTIFY_CPU_DYING:
		tick_handover_do_timer(dev);
		break;

	case CLOCK_EVT_NOTIFY_CPU_DEAD:
		tick_shutdown_broadcast_oneshot(dev);
		tick_shutdown_broadcast(dev);
		tick_shutdown(dev);
		break;

	case CLOCK_EVT_NOTIFY_SUSPEND:
		tick_suspend();
		tick_suspend_broadcast();
		break;

	case CLOCK_EVT_NOTIFY_RESUME:
		tick_resume();
		break;

	default:
		break;
	}

	return NOTIFY_OK;
}
コード例 #4
0
void tick_notify(unsigned long reason, void *dev)
{
	switch (reason) {

	case CLOCK_EVT_NOTIFY_BROADCAST_ON:
	case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
	case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
		tick_broadcast_on_off(reason, dev);
		break;

	case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
	case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
		tick_broadcast_oneshot_control(reason);
		break;

	case CLOCK_EVT_NOTIFY_CPU_DYING:
		tick_handover_do_timer(dev);
		break;

	case CLOCK_EVT_NOTIFY_CPU_DEAD:
		tick_shutdown_broadcast_oneshot(dev);
		tick_shutdown_broadcast(dev);
		tick_shutdown(dev);
		break;

	case CLOCK_EVT_NOTIFY_SUSPEND:
		tick_suspend();
		tick_suspend_broadcast();
		break;

	case CLOCK_EVT_NOTIFY_RESUME:
		tick_resume();
		break;

	default:
		break;
	}
}