Beispiel #1
0
 void process_generic_command(void) {
     uint8_t subcommand;

     if (! BYTE_IS_DATA(rs485_peek())) return;
     subcommand = rs485_getc();

     switch(subcommand) {
         case SUBCOMMAND_PING:
             rs485_putc(0x42);
             rs485_putc(0x40 | board_address);
             break;

         case SUBCOMMAND_IDENT:
             diagled_blink(board_address);
             break;
     }
 }
Beispiel #2
0
/*
 * Output a single byte to the rs485 port.
 */
void rs485_putc (const char c)
{
	struct s3c24x0_uart * const uart = s3c24x0_get_base_uart(UART_NR);

	/* wait for room in the tx FIFO */
	while (!(uart->UTRSTAT & 0x2));

	uart->UTXH = c;

	/* If \n, also do \r */
	if (c == '\n')
		rs485_putc ('\r');
}
Beispiel #3
0
void rs485_puts (const char *s)
{
	while (*s) {
		rs485_putc (*s++);
	}
}