summaryrefslogtreecommitdiffstats
path: root/pressure_control/firmware/valves.h
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-05-30 17:58:32 +0200
committerMichael Buesch <mb@bu3sch.de>2009-05-30 17:58:32 +0200
commitd31ac3343c7839c2c5244c615fd498bf63c3a2a8 (patch)
tree7b5cfc16d5c55f34412ee805e91de96f480264a0 /pressure_control/firmware/valves.h
parent4b9c9858e408dd8d8ef29a315496af714ccb8bdf (diff)
downloadcnc-d31ac3343c7839c2c5244c615fd498bf63c3a2a8.tar.xz
cnc-d31ac3343c7839c2c5244c615fd498bf63c3a2a8.zip
pressure_control: Add support for valves with one magnet
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Diffstat (limited to 'pressure_control/firmware/valves.h')
-rw-r--r--pressure_control/firmware/valves.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/pressure_control/firmware/valves.h b/pressure_control/firmware/valves.h
index 11ec6db..7586904 100644
--- a/pressure_control/firmware/valves.h
+++ b/pressure_control/firmware/valves.h
@@ -17,31 +17,38 @@ enum valves_global_state {
/* State for one valve. */
enum valve_state {
VALVE_STATE_IDLE,
- VALVE_STATE_12,
- VALVE_STATE_14,
+ VALVE_STATE_CLOSE,
+ VALVE_STATE_OPEN,
+};
+
+enum valves_type {
+ VALVES_1MAG, /* One magnet for opening the valve. Spring reset. */
+ VALVES_2MAG, /* One magnet for opening; one magnet for closing the valve. */
};
struct valves {
+ uint8_t type; /* enum valves_type */
uint16_t ddr; /* DDRx */
uint16_t port; /* PORTx */
- uint8_t bit_0_14; /* Valve 0: Pin for valve position 14 */
- uint8_t bit_0_12; /* Valve 0: Pin for valve position 12 */
- uint8_t bit_1_14; /* Valve 1: Pin for valve position 14 */
- uint8_t bit_1_12; /* Valve 1: Pin for valve position 12 */
+ uint8_t bit_0_open; /* Pin for opening valve 0. */
+ uint8_t bit_0_close; /* Pin for closing valve 0. */
+ uint8_t bit_1_open; /* Pin for opening valve 1. */
+ uint8_t bit_1_close; /* Pin for closing valve 1. */
uint8_t current_global_state; /* enum valves_global_state */
bool need_switch_to_idle; /* Need transition to VALVE_STATE_IDLE. */
jiffies_t switch_to_idle_time; /* Deadline for VALVE_STATE_IDLE transition. */
};
-#define DEFINE_VALVE(name, portid, bit0_14, bit0_12, bit1_14, bit1_12) \
+#define DEFINE_VALVE(name, _type, portid, bit0_open, bit0_close, bit1_open, bit1_close) \
struct valves name = { \
+ .type = _type, \
.ddr = _SFR_ADDR(DDR##portid), \
.port = _SFR_ADDR(PORT##portid), \
- .bit_0_14 = bit0_14, \
- .bit_0_12 = bit0_12, \
- .bit_1_14 = bit1_14, \
- .bit_1_12 = bit1_12, \
+ .bit_0_open = bit0_open, \
+ .bit_0_close = bit0_close, \
+ .bit_1_open = bit1_open, \
+ .bit_1_close = bit1_close, \
}
#define VALVE_TOGGLE_MSEC 10
bues.ch cgit interface