summaryrefslogtreecommitdiffstats
path: root/actuators/motor/atmostripe.vala
diff options
context:
space:
mode:
Diffstat (limited to 'actuators/motor/atmostripe.vala')
-rw-r--r--actuators/motor/atmostripe.vala34
1 files changed, 29 insertions, 5 deletions
diff --git a/actuators/motor/atmostripe.vala b/actuators/motor/atmostripe.vala
index ad996e7..23f0fda 100644
--- a/actuators/motor/atmostripe.vala
+++ b/actuators/motor/atmostripe.vala
@@ -23,15 +23,39 @@ public class AtmostripeMotorController : SerialDevice, MotorController {
}
public void init(KeyFile cfg) throws Error {
- /* */
+ var device = cfg.get_string("AtmostripeMotorController", "device");
+ setup(device);
}
- public void set_single(uint8 m, uint8 v) {
- /* */
+ public bool set_single(uint8 engine, uint8 speed) {
+ uint8[2] buf = new uint8[2];
+ buf[0] = engine;
+ buf[1] = speed;
+
+ if(engine > 5)
+ return false;
+
+ write(buf, 2);
+ read(buf, 2);
+
+ if(buf[0] == '.')
+ return true;
+ else
+ return false;
}
- public void set_all(uint8 v) {
- /* */
+ public bool set_all(uint8 speed) {
+ uint8[2] buf = new uint8[2];
+ buf[0] = 6;
+ buf[1] = speed;
+
+ write(buf, 2);
+ read(buf, 2);
+
+ if(buf[0] == '.')
+ return true;
+ else
+ return false;
}
}