#endif
-
+#ifdef MM_USE_CALLBACK
/*
- * mm_switch_command - Callback function!
+ * mm_key_cb - Callback function!
*
* This function must be defined whenever the mm_switch module is used.
* It will be called from interrupt context whenever a new valid command
* has arrived.
*
* decoder is in the range from 1 to 25. Other values will not occur.
- *
+ *
* key is in the range from 0 to 8:
*
* 1 - key1 green pressed
* 4 - key2 red pressed
* ...
* 0 - all keys up
- *
+ *
*/
-void mm_switch_command(uint8_t decoder, uint8_t key);
+void mm_key_cb(uint8_t decoder, uint8_t function, uint8_t key);
+void mm_drive_cb(uint8_t decoder, uint8_t function, uint8_t command);
-/*
- * empty comment :-)
- */
-void mm_switch_drive_cb(uint8_t address, uint8_t speed, uint8_t functions, uint8_t flags);
+#endif
+
+void mm_pinchange_callback(void);
+
+enum mm_recmode {
+ __MM_INIT,
+ __MM_ARMED,
+ MM_SLOW,
+ MM_FAST,
+};
+
+#ifdef MM_USE_QUEUE
+
+struct mm_command {
+ enum mm_recmode recmode; /* Only MM_FAST or MM_SLOW! */
+ uint8_t address; /* Undecoded loco/decoder address */
+ uint8_t function; /* The two function bits */
+ uint8_t command; /* Button/Speed/Functions */
+};
-void mm_switch_drive(uint8_t decoder, uint8_t function, uint8_t command);
+struct mm_command *mm_get(void);
-void mm_switch_pinchange_callback(void);
+#endif /* MM_USE_QUEUE */
#endif