]> git.gir.st - tmk_keyboard.git/blob - protocol/lufa/LUFA-git/Projects/XPLAINBridge/Lib/SoftUART.h
Squashed 'tmk_core/' changes from caca2c0..dc0e46e
[tmk_keyboard.git] / 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
Imprint / Impressum