Пример #1
0
static int check_dial_pulses(int line)
{
	int current_state = read_hook_state(line);
	int new_state;
	int dial_pulses = 0;

	xprintf("Counting dial pulses for line %d, press any key to exit...\n\r", line);

	while (UARTAvail() == 0) {
		if ((new_state = read_hook_state(line)) != current_state) {
			current_state = new_state;
			if (current_state == ON_HOOK) {
				dial_pulses++;
				xprintf("Current pulse count %d\n\r", dial_pulses);
			}
		}
	}

	xgetc();	// flush character that ended the while loop.

	xprintf("Final pulse count %d\n\r", dial_pulses);
	return dial_pulses;
}
Пример #2
0
int  main(void)
{
	char						c;

//	PORTC_PCR5 = PORT_PCR_MUX(0x1); // LED is on PC5 (pin 13), config as GPIO (alt = 1)
//	GPIOC_PDDR = (1<<5);			// make this an output pin
//	LED_OFF;						// start with LED off

	UARTInit(TERM_UART, TERM_BAUD);			// open UART for comms
	UARTWrite(hello, strlen(hello));
	EnableInterrupts;

	while (1)
	{
		while (UARTAvail() != 0)
		{
			UARTRead(&c, 1);
			UARTWrite(&c, 1);
			if (c == '\r')  UARTWrite("\n", 1);
		}
	}

	return  0;						// should never get here!
}