Пример #1
0
void main(void) {
	uint8_t counter = 0;
	GPIO_SetDir(LED_PORT, LED_PIN, GPIO_Output);
	GPIO_SetDir(KEY_PORT, KEY_PIN, GPIO_Input);
	GPIO_WriteOutput(LED_PORT, LED_PIN, false);
	SYSCON_StartSystick(72*200000); // 0.2s
	blinks = 0;

	while (true) {
		if (!debounced(KEY_PORT, KEY_PIN) && blinks == 0)
			blinks = counter = (counter+1)&7;
	}
}
Пример #2
0
void main () {
	every_gpio_set_dir (LED_PORT, LED_PIN, OUTPUT);
	every_gpio_write (LED_PORT, LED_PIN, false);
	every_gpio_set_dir (KEY_PORT, KEY_PIN, INPUT);
	EVERY_GPIO_SET_PULL (KEY_PORT, KEY_PIN, PULL_UP);
	
	buttonWasDown = false;
	downKey = 0;
	counter = -1;
	
	KeyboardInit (&usbDeviceDefinition,
				  &usbDevice,
				  &hidBehaviour,
				  inBuffer,
				  outBuffer,
				  &idleValue,
				  &currentProtocol,
				  inReportHandler,
				  outReportHandler);
	
	USB_SoftConnect (&usbDevice);

	SYSCON_StartSystick (71999);	// 1KHz
}
Пример #3
0
void SYSCON_StartSystick_10ms() {
	SYSCON_StartSystick(CLOCKS_10MS);
}
Пример #4
0
void main(void) {	// main is used for setup and starting the systick timer
	every_gpio_set_dir(LED_PORT, LED_PIN, OUTPUT);
	counter = 0;			//use main to initialize globals, don't init them statically
	SYSCON_StartSystick(SYSTICK_CYCLES-1);	//systick() is called all SYSTICK_CYCLES cycles
}
Пример #5
0
void main(void) {	// main is used for setup and starting the systick timer
    GPIO_SetDir(LED_PORT, LED_PIN, GPIO_Output);
    counter = 0;			//use main to initialize globals, don't init them statically
    SYSCON_StartSystick(SYSTICK_CYCLES-1);	//systick() is called all SYSTICK_CYCLES cycles
}