]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/protocol/lufa/LUFA-git/Projects/XPLAINBridge/Lib/SoftUART.h
Merge commit 'f6d56675f9f981c5464f0ca7a1fbb0162154e8c5'
[max/tmk_keyboard.git] / tmk_core / protocol / lufa / LUFA-git / Projects / XPLAINBridge / Lib / SoftUART.h
1 /*
2              LUFA Library
3      Copyright (C) Dean Camera, 2014.
4
5   dean [at] fourwalledcubicle [dot] com
6            www.lufa-lib.org
7 */
8
9 /*
10   Copyright 2010  David Prentice (david.prentice [at] farming [dot] uk)
11   Copyright 2010  Peter Danneger
12   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com)
13
14   Permission to use, copy, modify, distribute, and sell this
15   software and its documentation for any purpose is hereby granted
16   without fee, provided that the above copyright notice appear in
17   all copies and that both that the copyright notice and this
18   permission notice and warranty disclaimer appear in supporting
19   documentation, and that the name of the author not be used in
20   advertising or publicity pertaining to distribution of the
21   software without specific, written prior permission.
22
23   The author disclaims all warranties with regard to this
24   software, including all implied warranties of merchantability
25   and fitness.  In no event shall the author be liable for any
26   special, indirect or consequential damages or any damages
27   whatsoever resulting from loss of use, data or profits, whether
28   in an action of contract, negligence or other tortious action,
29   arising out of or in connection with the use or performance of
30   this software.
31 */
32
33 /** \file
34  *
35  *  Header file for SoftUART.c.
36  */
37
38 #ifndef _SOFT_UART_
39 #define _SOFT_UART_
40
41         /* Includes: */
42                 #include <avr/io.h>
43                 #include <avr/interrupt.h>
44                 #include <stdbool.h>
45
46                 #include "../XPLAINBridge.h"
47                 #include "Config/AppConfig.h"
48
49         /* Macros: */
50                 #define SRX        PD0
51                 #define SRXPIN     PIND
52                 #define SRXPORT    PORTD
53
54                 #define STX        PD1
55                 #define STXPORT    PORTD
56                 #define STXDDR     DDRD
57
58         /* Inline Functions: */
59                 static inline void SoftUART_SetBaud(const uint32_t Baud)
60                 {
61                         uint16_t BitTime = ((F_CPU / Baud) - 1);
62
63                         OCR1A = BitTime;
64                         OCR3A = BitTime;
65                 }
66
67         /* Function Prototypes: */
68                 void SoftUART_Init(void);
69
70 #endif
71