From 183cacf730e767b5139b5c0547e3e768423c12d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Sat, 6 May 2017 17:00:10 +0200 Subject: [PATCH] control numbers using buttons --- main.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 0b6b52d..ee1e687 100644 --- a/main.c +++ b/main.c @@ -81,8 +81,23 @@ volatile uint8_t frame_count = 0; /**< number of frames passed */ #define MUX_S2_PORT B /**< port to select multiplexer output */ #define MUX_S2_PIN 5 /**< pin to select multiplexer output */ +/** number to be display and changed using the buttons */ +struct number_t { + uint16_t number; /**< number to display (0-9999, 0xffff=off) */ + uint8_t up; /**< which of the 16 buttons is to increment the number */ + uint8_t down; /**< which of the 16 buttons is to decrement the number */ +}; /** episode, scene, take, video 1, audio 1, video 2, audio 2 number (does not have to be in this order) */ -uint16_t numbers[7] = {0}; +struct number_t numbers[] = { + {0, 2, 3}, + {0, 14, 15}, + {0, 10, 11}, + {0, 6, 7}, + {0, 1, 0}, + {0, 13, 12}, + {0, 5, 4}, +}; + #define POWER_SWITCH_PORT B /**< port to switch power of all devices (including this micro-controller) */ #define POWER_SWITCH_PIN 8 /**< pin to switch power of all devices (including this micro-controller) */ @@ -498,10 +513,10 @@ void main(void) // display numbers on TM1637 for (uint8_t number=0; number