aboutsummaryrefslogtreecommitdiff
path: root/src/modules/px4iofirmware
diff options
context:
space:
mode:
authorJean Cyr <jcyr@dillobits.com>2013-07-09 20:37:00 -0400
committerJean Cyr <jcyr@dillobits.com>2013-07-09 20:37:00 -0400
commit897b541b12d5782af51ce0a78658cc153bd13544 (patch)
tree9f4ff4b364a7967f96ce3b38fb45e2518f497213 /src/modules/px4iofirmware
parent328f4f8c872a0e33857fd9a1112963438a87165b (diff)
downloadpx4-firmware-897b541b12d5782af51ce0a78658cc153bd13544.tar.gz
px4-firmware-897b541b12d5782af51ce0a78658cc153bd13544.tar.bz2
px4-firmware-897b541b12d5782af51ce0a78658cc153bd13544.zip
General cleanup of /dev/px4io and /dev/px4fmu
- Use distinct common symbols for px4io and px4fmu device files, and use instead of hardcoded filenames - Use common symbols defining px4io bits consistently between px4fmu and px4io builds.
Diffstat (limited to 'src/modules/px4iofirmware')
-rw-r--r--src/modules/px4iofirmware/protocol.h7
-rw-r--r--src/modules/px4iofirmware/registers.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/src/modules/px4iofirmware/protocol.h b/src/modules/px4iofirmware/protocol.h
index 6ee5c2834..88d8cc87c 100644
--- a/src/modules/px4iofirmware/protocol.h
+++ b/src/modules/px4iofirmware/protocol.h
@@ -157,6 +157,13 @@
#define PX4IO_P_SETUP_PWM_DEFAULTRATE 3 /* 'low' PWM frame output rate in Hz */
#define PX4IO_P_SETUP_PWM_ALTRATE 4 /* 'high' PWM frame output rate in Hz */
#define PX4IO_P_SETUP_RELAYS 5 /* bitmask of relay/switch outputs, 0 = off, 1 = on */
+
+/* px4io relay bit definitions */
+#define PX4IO_RELAY1 (1<<0)
+#define PX4IO_RELAY2 (1<<1)
+#define PX4IO_ACC1 (1<<2)
+#define PX4IO_ACC2 (1<<3)
+
#define PX4IO_P_SETUP_VBATT_SCALE 6 /* battery voltage correction factor (float) */
#define PX4IO_P_SETUP_DSM 7 /* DSM bind state */
enum { /* DSM bind states */
diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c
index 805eb7ecc..a922362b6 100644
--- a/src/modules/px4iofirmware/registers.c
+++ b/src/modules/px4iofirmware/registers.c
@@ -349,10 +349,10 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value)
case PX4IO_P_SETUP_RELAYS:
value &= PX4IO_P_SETUP_RELAYS_VALID;
r_setup_relays = value;
- POWER_RELAY1(value & (1 << 0) ? 1 : 0);
- POWER_RELAY2(value & (1 << 1) ? 1 : 0);
- POWER_ACC1(value & (1 << 2) ? 1 : 0);
- POWER_ACC2(value & (1 << 3) ? 1 : 0);
+ POWER_RELAY1(value & PX4IO_RELAY1 ? 1 : 0);
+ POWER_RELAY2(value & PX4IO_RELAY2 ? 1 : 0);
+ POWER_ACC1(value & PX4IO_ACC1 ? 1 : 0);
+ POWER_ACC2(value & PX4IO_ACC2 ? 1 : 0);
break;
case PX4IO_P_SETUP_SET_DEBUG: