Rev Author Line No. Line
3047 miho 1 // ------------------------------------------------------------------
2 //
3 // TRAIN TIMER
4 // -----------
5 //
6 // Firmware for TRAIN02A board. It changes state of relay outputs
7 // as defined in configuration. Default configuration is in .h file
8 // and definitions may be changed online via USB port and if needed
9 // stored into EEPROM.
10 //
11 // Uses ATmega8 at 8MHz (internal RC or external XTAL)
12 //
13 // (c) miho WWW.MLAB.CZ/PermaLink/TRAIN
14 //
15 // ------------------------------------------------------------------
16  
17  
18 // Version info
19 #define VERSION "1.00"
20 #define YEAR "2013"
21  
22  
23 // Default Timers onfiguration (8 timers)
24 #define DEFAULT_TIMES_ON { 1, 2, 3, 4, 5, 6, 7, 8} // Time in [s] for "On"
25 #define DEFAULT_TIMES_OFF { 9, 8, 7, 6, 5, 4, 3, 2} // Time in [s] for "Off"
26 #define DEFAULT_TIMES_ON_RND { 0, 0, 0, 0, 0, 0, 0, 0} // Random adition in [s] for "On"
27 #define DEFAULT_TIMES_OFF_RND { 0, 0, 0, 0, 0, 0, 0, 0} // Random adition in [s] for "Off"
28  
29  
30 // Time granularity
31 #define F_TIME_GRAIN 100 // User Timer Time Quantum in Hz
32  
33  
34 // RS232 Config
35 #define BAUD 9600 // Bd
36 #define UART_TX0_BUFFER_SIZE 0x80 // TX FIFO - Must be power of 2 !
37 #define UART_RX0_BUFFER_SIZE 0x80 // RX FIFO - Must be power of 2 !
38  
39 #define LINE_LENGTH 40 // Length of line
40  
41  
42 // --------------------------------
43  
44  
45 // USART RX/TX buffers
46 #define UART_RX0_BUFFER_MASK ( UART_RX0_BUFFER_SIZE - 1)
47 #define UART_TX0_BUFFER_MASK ( UART_TX0_BUFFER_SIZE - 1)
48  
49 #if ( UART_RX0_BUFFER_SIZE & UART_RX0_BUFFER_MASK )
50 #error RX0 buffer size is not a power of 2
51 #endif
52  
53 #if ( UART_TX0_BUFFER_SIZE & UART_TX0_BUFFER_MASK )
54 #error TX0 buffer size is not a power of 2
55 #endif
56  
57  
58 // Standard control ASCII chars
59 #define CR 13
60 #define LF 10
61 #define BS 8
62 #define DEL 127
63 #define ESC 27