binary Clock
ports.h
Go to the documentation of this file.
1 #ifndef PORTS_H__
2 #define PORTS_H__
3 
4 #include <avr/io.h>
5 
11 #define IND_LED0 PA0
13 #define RTC_SQW PA1
14 // Pin PA2 is reset input
15 
17 #define HOUR_TEN_ANO PB0
18 #define HOUR_ONE_ANO PB1
19 #define MIN_TEN_ANO PB2
20 #define MIN_ONE_ANO PB3
21 #define SEC_TEN_ANO PB4
22 #define RTC_SDA PB5
23 #define SEC_ONE_ANO PB6
24 #define RTC_SCL PB7
25 
27 #define UART_RXD PD0
28 #define UART_TXD PD1
29 #define IND_LED1 PD2
30 #define LEDDRV_SDI PD3
31 #define LEDDRV_CLK PD4
32 #define LEDDRV_OE PD5
33 #define LEDDRV_LE PD6
34 // no 7th pin on the port
35 
36 #define ANO_PORT PORTB
37 
38 #define LEDDRV_OE_SET(val) (val ? PORTD |= (1 << LEDDRV_OE) : (PORTD &= ~(1 << LEDDRV_OE)))
40 #define LEDDRV_LE_SET(val) (val ? PORTD |= (1 << LEDDRV_LE) : (PORTD &= ~(1 << LEDDRV_LE)))
42 #define LEDDRV_SDI_SET(val) (val ? PORTD |= (1 << LEDDRV_SDI) : (PORTD &= ~(1 << LEDDRV_SDI)))
44 #define LEDDRV_CLK_SET(val) (val ? PORTD |= (1 << LEDDRV_CLK) : (PORTD &= ~(1 << LEDDRV_CLK)))
46 
48 #define LED0_set(val) (val ? (PORTA |= 1 << IND_LED0) : (PORTA &= ~(1 << IND_LED0)))
49 #define LED1_set(val) (val ? (PORTD |= 1 << IND_LED1) : (PORTD &= ~(1 << IND_LED1)))
51 #define LED0_toggle() (PORTA ^= (1 << IND_LED0))
53 #define LED1_toggle() (PORTD ^= (1 << IND_LED1))
55 
56 #endif /* PORTS_H__ */