Open Garden  0.10.1-21
io_pin.h
Go to the documentation of this file.
1 /* This file is part of OpenGarden
2  * Copyright (C) 2011-2013 Enrico Rossi
3  *
4  * OpenGarden is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * OpenGarden is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
22 #ifndef OG_IO_OUT_H
23 #define OG_IO_OUT_H
24 
25 #include "ogstruct.h"
26 
28 #define OUT_PORT PORTA
29 
30 #define OUT_PIN PINA
31 
32 #define OUT_DDR DDRA
33 
35 #define OUT_P0 PA0
36 
37 #define OUT_P1 PA1
38 
39 #define OUT_P2 PA2
40 
41 #define OUT_P3 PA3
42 
43 #define OUT_P4 PA4
44 
45 #define OUT_P5 PA5
46 
47 #define OUT_P6 PA6
48 
49 #define OUT_P7 PA7
50 
52 #define IN_PORT PORTD
53 
54 #define IN_PIN PIND
55 
56 #define IN_DDR DDRD
57 
58 #define IN_P0 PIND4
59 
60 #define IN_P1 PIND5
61 
63 #define OUT_CMD_PORT PORTB
64 
65 #define OUT_CMD_DDR DDRB
66 
67 #define OUT_CMD_ONOFF PB0
68 
69 #define OUT_CMD_PN PB1
70 
72 #define OFF 0
73 
74 #define ON 1
75 
76 #define PULSE 2
77 
78 #define PULSE_MSEC 50
79 
80 struct iolines_t {
81  uint8_t valvetype;
82  uint8_t lines;
83  uint8_t lines_no_alarm;
84  uint8_t alarms;
85 };
86 
87 struct iolines_t *iolines;
88 
89 void io_suspend(void);
90 void io_resume(void);
91 void io_init(void);
92 void io_shut(void);
93 void io_set(const uint8_t oline, const uint8_t onoff, struct programs_t *progs);
94 uint8_t io_get(struct programs_t *progs);
95 void io_off(struct programs_t *progs);
96 uint8_t io_alarm(struct programs_t *progs);
97 
98 #endif
void io_shut(void)
Shutdown all I/O pin.
Definition: io_pin.c:116
Definition: io_pin.h:80
void io_off(struct programs_t *progs)
Definition: io_pin.c:250
uint8_t io_alarm(struct programs_t *progs)
get alarm status.
Definition: io_pin.c:264
void io_suspend(void)
Definition: io_pin.c:87
Definition: ogstruct.h:170
structures.
void io_init(void)
Definition: io_pin.c:107
void io_set(const uint8_t oline, const uint8_t onoff, struct programs_t *progs)
Definition: io_pin.c:157
uint8_t io_get(struct programs_t *progs)
Definition: io_pin.c:237