Exemplo n.º 1
0
/*
 * 通过串口发送一个字符串并换行
 */
void USART_puts(USART_TypeDef* USARTx, char *str)
{
    while(*str){
        USART_putchar(USARTx, *str);
        str++;
    }
    USART_putchar(USARTx, '\n');
}
Exemplo n.º 2
0
void USART_send_block(const uint8_t __memx *block, uint8_t size)
{
	while(size--)
	{
		USART_putchar(*block);
		++block;
	}
}
Exemplo n.º 3
0
void USART_send(const char __memx *txt)
{
	while(*txt)
	{
		USART_putchar(*txt);
		++txt;
	}
}
Exemplo n.º 4
0
static void printchar(char **str, int c)
{
	if (str) {
		**str = c;
		++(*str);
	}
	else (void)USART_putchar((unsigned short)c);
}
Exemplo n.º 5
0
void USART_putnum(USART_TypeDef* USARTx, uint32_t x)
{
	char value[10]; //a temp array to hold results of conversion
	int i = 0; //loop index
  
	do
	{
		value[i++] = (char)(x % 10) + '0'; //convert integer to character
		x /= 10;
	} while (x);
  
	while (i) //send data
	{
		USART_putchar(USARTx, value[--i]); 
	}
}
Exemplo n.º 6
0
void USART_PUT_TEMPF(USART_TypeDef* USARTx, uint32_t t){
		USART_putchar(USARTx, 'f');
		USART_putnum(USARTx, t);
		USART_putchar(USARTx, 'n');
}	
Exemplo n.º 7
0
void USART_puts(USART_TypeDef* USARTx, volatile char * s) {
	while (*s) {
		USART_putchar(USARTx, *s++);
	}
}
Exemplo n.º 8
0
int fputc(int ch, FILE *f) {
  USART_putchar(USART_DBG, ch);
  return ch;
}
Exemplo n.º 9
0
void _ttywrch(int ch) {
  /* Write one char "ch" to the default console
   * Need implementing with UART here. */
  USART_putchar(USART_DBG, ch);
}
Exemplo n.º 10
0
// Send a char of data out to the serial port
void send_msg(char* data)
{
	PORTH_OUT ^= 0x40;			// Turn on/off LED 6 to know if this was called
	msg = data;
	USART_putchar(&USARTinstance, data);
}
Exemplo n.º 11
0
void consolePutc(char c) {
  USART_putchar(c);
}