|
Open Garden
0.10.1-21
|
IO lines definitions. More...
#include "ogstruct.h"

Go to the source code of this file.
Data Structures | |
| struct | iolines_t |
Macros | |
| #define | OUT_PORT PORTA |
| #define | OUT_PIN PINA |
| #define | OUT_DDR DDRA |
| #define | OUT_P0 PA0 |
| #define | OUT_P1 PA1 |
| #define | OUT_P2 PA2 |
| #define | OUT_P3 PA3 |
| #define | OUT_P4 PA4 |
| #define | OUT_P5 PA5 |
| #define | OUT_P6 PA6 |
| #define | OUT_P7 PA7 |
| #define | IN_PORT PORTD |
| #define | IN_PIN PIND |
| #define | IN_DDR DDRD |
| #define | IN_P0 PIND4 |
| #define | IN_P1 PIND5 |
| #define | OUT_CMD_PORT PORTB |
| #define | OUT_CMD_DDR DDRB |
| #define | OUT_CMD_ONOFF PB0 |
| #define | OUT_CMD_PN PB1 |
| #define | OFF 0 |
| #define | ON 1 |
| #define | PULSE 2 |
| #define | PULSE_MSEC 50 |
Functions | |
| void | io_suspend (void) |
| void | io_resume (void) |
| void | io_init (void) |
| void | io_shut (void) |
| Shutdown all I/O pin. More... | |
| void | io_set (const uint8_t oline, const uint8_t onoff, struct programs_t *progs) |
| uint8_t | io_get (struct programs_t *progs) |
| void | io_off (struct programs_t *progs) |
| uint8_t | io_alarm (struct programs_t *progs) |
| get alarm status. More... | |
Variables | |
| struct iolines_t * | iolines |
IO lines definitions.
| #define IN_DDR DDRD |
Alarm DDR
| #define IN_P0 PIND4 |
Alarm line 0
| #define IN_P1 PIND5 |
Alarm line 1
| #define IN_PIN PIND |
Alarm PIN
| #define IN_PORT PORTD |
Alarm port
| #define OFF 0 |
Macro OFF
| #define ON 1 |
Macro ON
| #define OUT_CMD_DDR DDRB |
Command DDR
| #define OUT_CMD_ONOFF PB0 |
Command On Off line 0
| #define OUT_CMD_PN PB1 |
Command +- line
| #define OUT_CMD_PORT PORTB |
Command PORT
| #define OUT_DDR DDRA |
IO DDR
| #define OUT_P0 PA0 |
IO line 0
| #define OUT_P1 PA1 |
IO line 1
| #define OUT_P2 PA2 |
IO line 2
| #define OUT_P3 PA3 |
IO line 3
| #define OUT_P4 PA4 |
IO line 4
| #define OUT_P5 PA5 |
IO line 5
| #define OUT_P6 PA6 |
IO line 6
| #define OUT_P7 PA7 |
IO line 7
| #define OUT_PIN PINA |
IO PIN
| #define OUT_PORT PORTA |
the IO line port
| #define PULSE 2 |
Macro PULSE
| #define PULSE_MSEC 50 |
PULSE msec delay
| uint8_t io_alarm | ( | struct programs_t * | progs | ) |
get alarm status.
Sets/clear and return the alarm flag in the flag register (FL_ALRM) if one or both the alarm line are set, based on the alarm level trigger (FL_LEVEL high or low).
| progs | the struct to look for the alarm level setup. |
| uint8_t io_get | ( | struct programs_t * | progs | ) |
Are there any IO out line in use?
| void io_init | ( | void | ) |
setup the I/O port.
| void io_off | ( | struct programs_t * | progs | ) |
Close all the output line.
| void io_set | ( | const uint8_t | oline, |
| const uint8_t | onoff, | ||
| struct programs_t * | progs | ||
| ) |
Set I/O oline.
open or close the I/O line, the OUT_PORT is supposed to represent the correct status of the I/O lines only if the valve type is MONOSTABLE. In the open case, we set the port to the corresponding oline, then we also set the oline into the progs structure in order to remember which ioline we are using, because this info will be lost during the stand-by period. Then, after opened the valve, if the valve is BISTABLE we can clear the oline from the port, no need to keep the line up; instead if the valve is MONOSTABLE then the PORT represent the ioline in use and it must not be cleared. In the close case and bistable valve, the port must be set to the correct ioline before the close operation or it will not affect any line.
Special case: GTP hardware. Monostable valve ignore the ON/OFF line. Bistable valve uses +/- and ON/OFF line in a different way, to open: set the ioline and the ON/OFF to 1, after 1msec clear the ioline and after PULSE_MSEC clear also the ON/OFF line. to close: set the ioline and the +/- to 1, after 1msec clear the ioline and after PULSE_MSEC clear also the +/- line.
| oline | the output line to be set. |
| onoff | set or clear. |
| progs | ptr to the parameters. |
| void io_shut | ( | void | ) |
Shutdown all I/O pin.
Not only make them 0, but also release the IO lines.
| void io_suspend | ( | void | ) |
release all the I/O lines before suspend
1.8.13