Example #1
0
void comm_puts(const void *str){
	uint8_t *s = (uint8_t *) str;

	while (*s){
		UARTPutChar(LPC_UART0, *s++);
	}
}
/**
 * send data from usb to rs232
 */
void vport_uart_write(int port, char * buf, int len)
{
	int i;
	for(i=0;i<len;i++)
		UARTPutChar(buf[i]);

}
Example #3
0
void myfputchar(int uartPortNr,uint8 ch)
{
	LPC_UART_TypeDef *UARTx;

	UARTx=(LPC_UART_TypeDef *)uartDrvDataArray[uartPortNr].reg_base;
	UARTPutChar(UARTx,ch);
}
Example #4
0
void _mon_putc(char c) {
#ifdef UARTConsole
UARTPutChar( c );
#endif

#ifdef UseVideo
    VideoPutc(c);
#endif

}
Example #5
0
// usb zu rs232
void USBtoRS232(char * buf)
{

	//fifo_put(toRS232FIFO,0x33);
	//fifo_put(toRS232FIFO,0x34);
	//fifo_put(toRS232FIFO,0x35);
	UARTPutChar(buf[0]);

	//USBNWrite(TXC2,FLUSH);
	//USBNWrite(TXD2,0x44);
	//rs232_send();	
	//UARTWrite("usb to rs232");
	
}
Example #6
0
int UARTPutChar(char c, FILE *stream)
{
    if (c == '\n') UARTPutChar('\r', stream);
  
	#if defined (__AVR_ATmega328P__) || defined (__AVR_ATmega328__)
		loop_until_bit_is_set(UCSR0A, UDRE0);
		UDR0 = c;
	#elif defined (__AVR_ATmega32U4__)
		loop_until_bit_is_set(UCSR1A, UDRE1);
		UDR1 = c;
    #else
		#error: MCU not defined/handled
	#endif
	
    return 0;
}
Example #7
0
void Terminal(void)
{
	char data;

   if (OSSemCreate(0,&sUART) != ALLOC_EVENT_OK)
   {
     // Oh Oh
     // Não deveria entrar aqui !!!
     BlockTask(th6);
   };

   if (OSMutexCreate(&mutexTx,6) != ALLOC_EVENT_OK)
   {
     // Oh Oh
     // Não deveria entrar aqui !!!
     BlockTask(th6);
   };

   if (OSQueueCreate(64, &qUART) != ALLOC_EVENT_OK)
   {
     // Oh Oh
     // Não deveria entrar aqui !!!
	 BlockTask(th6);
   };

	//
	// Enable the peripherals used by this example.
	// The UART itself needs to be enabled, as well as the GPIO port
	// containing the pins that will be used.
	//
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

	//
	// Configure the GPIO pin muxing for the UART function.
	// This is only necessary if your part supports GPIO pin function muxing.
	// Study the data sheet to see which functions are allocated per pin.
	// TODO: change this to select the port/pin you are using
	//
	GPIOPinConfigure(GPIO_PA0_U0RX);
	GPIOPinConfigure(GPIO_PA1_U0TX);

	//
	// Since GPIO A0 and A1 are used for the UART function, they must be
	// configured for use as a peripheral function (instead of GPIO).
	// TODO: change this to match the port/pin you are using
	//
	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	//
	// Configure the UART for 115,200, 8-N-1 operation.
	// This function uses SysCtlClockGet() to get the system clock
	// frequency.  This could be also be a variable or hard coded value
	// instead of a function call.
	//
	UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
						(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
						 UART_CONFIG_PAR_NONE));

	UARTFIFODisable(UART0_BASE);

	//
	// Enable the UART interrupt.
	//
	ROM_IntEnable(INT_UART0);
	ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);

    //
    // Put a character to show start of example.  This will display on the
    // terminal.
    //
    UARTPutString(UART0_BASE, "Iniciou!\n\r\n\r");

    while(1)
    {
    	if(!OSQueuePend(qUART, (INT8U*)&data, 0))
    	{
    		if (data != 13)
    		{
    			UARTPutChar(UART0_BASE, data);
    		}else
    		{
    			UARTPutString(UART0_BASE, "\n\r");
    		}
    	}
    }
}