aboutsummaryrefslogtreecommitdiff
path: root/avr/uart.c
blob: 2a2218175f81b46a1624bfec1ebf1523644d8ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/************************************************************************/
/*                                                                      */
/*  File:           avr/uart.c                                          */
/*  Description:    serial line device.                                 */
/*  Version:        1.0                                                 */
/*  Author:         Otto Mattik                                         */
/*                                                                      */
/*  (C)Copyright Otto Mattik 2014-2021.                                 */
/*                                                                      */
/*  This file is a part of 'armen' (a tiny operating system).           */
/*  'armen' is distributed under the CeCILL-V2.1 licence. For more      */
/*  details about this licence, please visit the website cecill.info    */
/*                                                                      */
/************************************************************************/

#ifndef AVR_UART_C
  #error "do not use this code directly, it must be included via uart.c"
#endif

#if defined(__AVR_ATtiny84__)\
 || defined(__AVR_ATtiny85__)
  #include "avr/usi.c"
#else
  #include "avr/usart.c"
#endif

void _uart_init( void )
{
    uint8_t i;

    for( i = 0; i < ARMEN_UARTS; i++ )
    {
        devices[i].open =  _uart_open;
        devices[i].close = _uart_close;
        devices[i].read =  _uart_read;
        devices[i].write = _uart_write;
  #ifdef UART_IOCTL
        devices[i].ioctl = _uart_ioctl;
  #endif
    }
}