btnut/btnode/include/suart/btn-suart.h File Reference


Detailed Description

Software UART device driver.

Author:
Martin Hinz <btnode@hinz.ch>
Date:
18.06.2004
This driver uses an internal counter to produce and read the UART bit stream connected to the pin defined in the btn-hardware.h file. Only low bauds are working reliable (2400baud till 9600baud) because for every bit an interrupt handle has to be called. Interrupts can not be executed if the system is already in a interrupt handle but timing is very important for this driver.
Read and write at the same time is not possible because both use the same internal counter.
Attention:
The NutOS sets threads to sleep if the output buffer is full!
See hardware header file btn-hardware.h for connection.

Use this driver like the hardware uart of the nutos:

FILE *uarts;
long sbaud = 2400;
NutRegisterDevice(&S_UART, 0, 0);
uarts = fopen(S_UART.dev_name, "r+");
_ioctl(_fileno(uarts), UART_SETSPEED, &sbaud);
(default baud is set to 9600)

#include <sys/device.h>
#include <dev/uart.h>
#include <dev/usart.h>

Defines

#define S_UART   devUsartAvrS

Variables

NUTDEVICE devUsartAvrS


Generated on Wed Apr 29 11:12:29 2009 for BTnut System Software by doxygen 1.5.1
!!! Dieses Dokument stammt aus dem ETH Web-Archiv und wird nicht mehr gepflegt !!!
!!! This document is stored in the ETH Web archive and is no longer maintained !!!