Example #1
0
// Call this function to initiate sending data to the serial port
void udb_serial_start_sending_data(void)
{
	int16_t c;
	int16_t pos = 0;

	while (pos < BUFLEN && (c = udb_serial_callback_get_byte_to_send()) != -1) {
//		buffer[pos++] = c;
	}
}
Example #2
0
void __attribute__((__interrupt__, __no_auto_psv__)) _U2TXInterrupt(void)
{
	_U2TXIF = 0; // clear the interrupt
	indicate_loading_inter;
	interrupt_save_set_corcon;

	int16_t txchar = udb_serial_callback_get_byte_to_send();
	if (txchar != -1)
	{
		U2TXREG = (uint8_t)txchar;
	}
	interrupt_restore_corcon;
}
Example #3
0
void __attribute__((__interrupt__,__no_auto_psv__)) _U1TXInterrupt(void)
{
	indicate_loading_inter ;
	interrupt_save_set_corcon ;
	
	_U1TXIF = 0 ; // clear the interrupt 
	
	int txchar = udb_serial_callback_get_byte_to_send() ;
	
	if ( txchar != -1 )
	{
		U1TXREG = (unsigned char)txchar ;
	}
	
	interrupt_restore_corcon ;
	return ;
}
Example #4
0
// Call this function to initiate sending a data to the serial port
void udb_serial_start_sending_data(void)
{
	if (!telemetrySocket) return;
	
	uint8_t buffer[BUFLEN];
	int16_t c;
	int16_t pos=0;
	
	while (pos < BUFLEN && (c = udb_serial_callback_get_byte_to_send()) != -1) {
		buffer[pos++] = c;
	}
	
	int16_t bytesWritten = UDBSocket_write(telemetrySocket, (uint8_t*)buffer, pos);
	
	if (bytesWritten == -1) {
		UDBSocket_close(telemetrySocket);
		telemetrySocket = NULL;
	}
}