Lots of fixes.
[uccvend-snackrom.git] / ROM2 / motors.c
index 80a11a7..4bb216b 100644 (file)
@@ -1,2 +1,50 @@
+#include "motors.h"
 #include "vend.h"
 
+void motor_on(u8 slot) {
+       /* from jump34 */
+}
+
+void motors_off() {
+       bset_changer_output(A3000_MOTOR_ROW_ENABLE); /* XXX active low? */
+       delay(10); /* XXX cf motors_off */
+       bset((void*)&_io_ports[M6811_PORTA], PORTA_MOTOR_COL_DISABLE);
+       bclr_misc_output(A3800_MOTOR_COL8_ENABLE | A3800_MOTOR_COL9_ENABLE);
+}
+
+bool motor_here(u8 slot) {
+       int i, c = 0;
+       motor_on(slot);
+       for (i=0; i < 8; i++) {
+               if (_io_ports[M6811_PORTE] & PORTE_MOTOR_OVERVOLTAGE) {
+                       c++;
+                       if (c == 0xff) {
+                               motors_off();
+                               return 1;
+                       } else
+                               continue;
+               }
+       }
+       motors_off();
+       return 0;
+}
+
+bool is_motor(u8 slot) {
+       /* FIXME */
+       return 1;
+}
+
+u8 dispense_motor(u8 slot) {
+       if (!is_motor(slot)) {
+               return MOTOR_NOSLOT;
+       }
+
+       motor_on(slot);
+       /* FIXME */
+       return MOTOR_SUCCESS;
+}
+
+void scan_motors() {
+       /* FIXME */
+}
+

UCC git Repository :: git.ucc.asn.au