コード例 #1
0
ファイル: lm4f_con.c プロジェクト: Archer-sys/atomthreads
int _write(int fd, const void *buf, size_t count)
{
    int sent;
    char *ptr;

    if(fd <= 2){
        sent = count;
        ptr = (char *) buf;

        while(count > 0){
            if(*ptr == '\n'){
                uart_send_blocking(STD_CON, '\r');
            }
            uart_send_blocking(STD_CON, *ptr++);

            ++sent;
            --count;
        }
    }else{
        errno = EIO;
        sent = -1;
    }

    return sent;
}
コード例 #2
0
ファイル: usbuart.c プロジェクト: molnarkares/blackmagic
void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep)
{
	(void)ep;

	char buf[CDCACM_PACKET_SIZE];
	int len = usbd_ep_read_packet(dev, CDCACM_UART_ENDPOINT,
					buf, CDCACM_PACKET_SIZE);

	for(int i = 0; i < len; i++)
		uart_send_blocking(USBUART, buf[i]);
}
コード例 #3
0
void glue_send_data_cb(uint8_t * buf, uint16_t len)
{
	int i;

	/* Red LED indicates data going out */
	gpio_set(RGB_PORT, LED_R);

	for (i = 0; i < len; i++) {
		uart_send_blocking(UART1, buf[i]);
	}

	gpio_clear(RGB_PORT, LED_R);
}
コード例 #4
0
int main(void)
{
	u8 rx;
	
	uart_setup();

	/*
	 * Yes, it's that simple !
	 */
	while(1) {
		rx = uart_recv_blocking(UART0);
		uart_send_blocking(UART0, rx);
	}

	return 0;
}
コード例 #5
0
int main(void)
{
	uint8_t rx;

	gpio_enable_ahb_aperture();
	uart_setup();

	/*
	 * Yes, it's that simple !
	 */
	while(1) {
		rx = uart_recv_blocking(UART0);
		uart_send_blocking(UART0, rx);
	}

	return 0;
}
コード例 #6
0
static void uart_send_one_byte(char byte)
{
	uart_send_blocking(UART0, byte);
	tx_chars++;
}