All pastes #19516 Raw Edit

Something

public text v1 · immutable
#19516 ·published 2005-08-07 18:39 UTC
rendered paste body
void DoSevenSegSegmentControls(void)
	{
	np_pio *pio = na_seven_seg_pio;
	long bits = 0xffff;
	long keyBit;
	char c;

	printf("\n");
	printf("\n");
	printf("         +-A--+     +-a--+\n");
	printf("         |    |     |    |\n");
	printf("         F    B     f    b\n");
	printf("         |    |     |    |\n");
	printf("         +-G--+     +-g--+\n");
	printf("         |    |     |    |\n");
	printf("         E    C     e    c\n");
	printf("         |    |     |    |\n");
	printf("         +-D--+ (H) +-d--+ (h)\n");
	printf("\n");
	printf("Press <Esc> to finish.\n");

	while((c = rGetChar()) != 27)
		{
		keyBit = 0;
		if(c >= 'a' && c <= 'g')
			keyBit = 1 << ('g' - c);
		else if(c == 'h')
			keyBit = 1 << 7;
		else if(c >= 'A' && c <= 'G')
			keyBit = 1 << ('G' - c + 8);
		else if(c == 'H')
			keyBit = 1 << 15;

		bits ^= keyBit;
		pio->np_piodata = bits;
		}
	}