source: projects/anelex-interface/src/wiring.h @ 60

Last change on this file since 60 was 60, checked in by sven, 13 years ago

First import of code files from the bull-anelex-project. They were started in April 2010 and there are several development steps in the anelex-interface made in late 2010.

File size: 2.8 KB
Line 
1#ifndef __ANELEX_WIRING_H__
2#define __ANELEX_WIRING_H__
3
4/**
5 * ANELEX interface microcontroller
6 * Wiring constants
7 *
8 * Defined symbols for the wiring of the uC on our board.
9 * This is *very* specific to our hardware setup.
10 *
11 * This file is part of the Bull Anelex Project
12 * Copyright (C) 2010  Sven Koeppel
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 3 of
17 * the License, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see
26 * <http://www.gnu.org/licenses/>.
27 *
28 *
29 **/
30
31#include "avr/io.h"
32#include "avr/interrupt.h"
33
34// Port Input B: Button, Communication Announcment, IB2
35#define PINB_BUT        PINB4
36#define PINB_CA     PINB2
37#define PINB_IB2        PINB3
38#define is_button()  (!( PINB & (1 << PINB_BUT) ))
39
40// Port Input C: Errors (not important)
41#define PINC_TA3        PINC7
42#define PINC_TA1        PINC5 // TA2 was removed
43#define PINC_TA0        PINC4
44
45// Port Input D:
46#define PIND_IB1    PIND2
47#define PIND_LR     PIND3 // Line Ready
48#define PIND_RTS    PIND4
49// leider ist RTS nicht das, wofuer ich es gehalten habe: Es geht
50// auf 1, wenn am PC ein terminal lauscht, sonst auf 0. Also keine
51// "Ich habe noch Zeichen im Puffer"-Anzeige.
52#define is_ready()  ( PIND & (1 << PIND_LR) )
53#define is_rts()    ( PIND & (1 << PIND_RTS) )
54#define has_character()  ( UCSR0A & 0b10000000 )
55
56// Port Output A: DATA
57#define set_data(x)      ( PORTA = ~ (x) )
58
59// Port Output B: LED
60#define PORTB_LED            PORTB0
61#define start_led()              ( PORTB &= ~(1 << PORTB_LED) )
62#define stop_led()               ( PORTB |= (1 << PORTB_LED) )
63#define is_led()         ( PINB & (1 << PORTB_LED) )
64#define toggle_led()     ( is_led() ? stop_led() : start_led() )
65
66// Port Output C: "Booleans Out"
67#define PORTC_RESET      PORTC3
68#define PORTC_PRINTCMD   PORTC2
69#define PORTC_CP         PORTC1
70#define PORTC_STROBE     PORTC0
71#define start_strobe()   ( PORTC &= ~(1 << PORTC_STROBE) )  // auf 0 legen
72#define stop_strobe()    ( PORTC |= (1 << PORTC_STROBE) )   // auf 1 heben
73#define start_printcmd() ( PORTC &= ~(1 << PORTC_PRINTCMD) )
74#define stop_printcmd()  ( PORTC |= (1 << PORTC_PRINTCMD) )
75
76// Port Output D: Apperatus Indicators, flow control
77#define PORTD_CTS        PORTD7
78#define start_cts()              ( PORTD &= ~(1 << PORTD_CTS) )
79#define stop_cts()               ( PORTD |= (1 << PORTD_CTS) )
80
81
82#endif /* __ANELEX_WIRING_H__ */
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License