Beispiel #1
0
int main()
{
	RCC_ClocksTypeDef RCC_Clocks;
	RCC_GetClocksFreq(&RCC_Clocks);

	SysTick_Config(RCC_Clocks.HCLK_Frequency / 100);
	
	InitializeLEDs();
	MyUSART_Init();

	setvbuf(stdout, 0, _IONBF, 0);
	printf("Hello!\r\n");

	float a = 0.0f;
	a += 0.1f;

	float b = 32.74538f;

	printf("a: %f, b: %f\r\n", a, b);

	while(1)
	{
		a += b;
		printf("Float: %f\r\n", a);
		
		SetLEDs(0x5);
		Delay(50);
		SetLEDs(0xA);
		Delay(50);
	}
}
Beispiel #2
0
int main()
{
	RCC_ClocksTypeDef RCC_Clocks;
	RCC_GetClocksFreq(&RCC_Clocks);

	SysTick_Config(RCC_Clocks.HCLK_Frequency / 100);

	InitializeLEDs();
	MyUSART_Init();

	setvbuf(stdout, 0, _IONBF, 0);
	printf("Hello!\r\n");

	char c;
	while(1)
	{
		if(USART_ReceiveChar(&c))
			USART_SendChar(c);

		SetLEDs(c);
	}
}
Beispiel #3
0
int main()
{
	RCC_ClocksTypeDef RCC_Clocks;
	RCC_GetClocksFreq(&RCC_Clocks);

	SysTick_Config(RCC_Clocks.HCLK_Frequency / 100);

	InitializeLEDs();
	MyUSART_Init();

	setvbuf(stdout, 0, _IONBF, 0);
	printf("Hello!\r\n");

	InitializeSnesController();

	while(1)
	{
		snes_button_state_t btn = GetControllerState();
		printf("SNES: %02X\r\n", btn.raw);
		printf(
			"%s %s %s %s %s %s %s %s %s %s %s %s\r\n",
			btn.buttons.A ? "A" : "",
			btn.buttons.B ? "B" : "",
			btn.buttons.X ? "X" : "",
			btn.buttons.Y ? "Y" : "",
			btn.buttons.L ? "L" : "",
			btn.buttons.R ? "R" : "",
			btn.buttons.Start ? "Start" : "",
			btn.buttons.Select ? "Select" : "",
			btn.buttons.Left ? "Left" : "",
			btn.buttons.Up ? "Up" : "",
			btn.buttons.Down ? "Down" : "",
			btn.buttons.Right ? "Right" : ""
		);

		SetLEDs(btn.buttons.A << 3 | btn.buttons.B << 2 | btn.buttons.X << 1 | btn.buttons.Y);
	}
}