1 | #ifndef __M200_WIRING_H__ |
---|
2 | #define __M200_WIRING_H__ |
---|
3 | |
---|
4 | /** |
---|
5 | * specific things about the wiring of the uC on the board |
---|
6 | * |
---|
7 | **/ |
---|
8 | |
---|
9 | #include "avr/io.h" |
---|
10 | #include "avr/interrupt.h" |
---|
11 | |
---|
12 | // pracitcal utilities |
---|
13 | #define check(where, what) ( ((what) & (where)) ? 1 : 0 ) |
---|
14 | #define check_pin(where, which) ( ((1 << (which)) & (where)) ? 1 : 0 ) |
---|
15 | |
---|
16 | // 1. Pin Input Names |
---|
17 | // (PINx registers for INPUT reading) |
---|
18 | |
---|
19 | // Port Input A: Data |
---|
20 | #define PINA_D0 PINA0 |
---|
21 | #define PINA_D1 PINA1 |
---|
22 | #define PINA_D2 PINA2 |
---|
23 | #define PINA_D3 PINA3 |
---|
24 | #define PINA_D4 PINA4 |
---|
25 | #define PINA_D5 PINA5 |
---|
26 | #define PINA_D6 PINA6 |
---|
27 | #define PINA_D7 PINA7 |
---|
28 | |
---|
29 | // Port Input B: Error, Button |
---|
30 | #define PINB_BUT PINB4 |
---|
31 | #define PINB_ERROR PINB1 |
---|
32 | #define PINB_HCK PINB2 |
---|
33 | #define PINB_MOCK PINB3 |
---|
34 | |
---|
35 | // Port Input C: Error, Signals, Data |
---|
36 | #define PINC_BSY PINC7 |
---|
37 | #define PINC_RDY PINC5 |
---|
38 | #define PINC_IM PINC4 |
---|
39 | #define PINC_PC PINC6 // only for reading in the current state |
---|
40 | #define PINC_D8 PINC0 |
---|
41 | #define PINC_D9 PINC1 |
---|
42 | #define PINC_D11 PINC2 |
---|
43 | #define PINC_D12 PINC3 |
---|
44 | |
---|
45 | // Port Input D: (RS232 Hardware flow control) |
---|
46 | |
---|
47 | |
---|
48 | // 2. Port Output Names |
---|
49 | // (PORTx registers for OUTPUT writing) |
---|
50 | |
---|
51 | // Port Output B: LED |
---|
52 | #define PORTB_LED PORTB0 |
---|
53 | |
---|
54 | // Port Output C: Pick Command |
---|
55 | #define PORTC_PC PORTC6 |
---|
56 | |
---|
57 | |
---|
58 | // 3. Port Interrupts |
---|
59 | |
---|
60 | // Pin Change Masks |
---|
61 | #define PCINT_IM PCINT20 |
---|
62 | #define PCINT_RDY PCINT21 |
---|
63 | #define PCINT_ERROR PCINT9 |
---|
64 | #define PCINT_HCK PCINT10 |
---|
65 | #define PCINT_MOCK PCINT11 |
---|
66 | #define PCINT_PC PCINT22 |
---|
67 | #define PCINT_BSY PCINT23 |
---|
68 | |
---|
69 | // 4. Output Lines |
---|
70 | |
---|
71 | #define start_reader() ( PORTC |= (1 << PORTC_PC) ) |
---|
72 | #define stop_reader() ( PORTC &= ~(1 << PORTC_PC) ) |
---|
73 | |
---|
74 | // sic! mit ja/nein und so |
---|
75 | #define start_led() ( PORTB &= ~(1 << PORTB_LED) ) |
---|
76 | #define stop_led() ( PORTB |= (1 << PORTB_LED) ) |
---|
77 | |
---|
78 | #endif /* __M200_WIRING_H__ */ |
---|