diff --git a/main.c b/main.c index 936bb8b..c7fecb3 100644 --- a/main.c +++ b/main.c @@ -40,8 +40,9 @@ #include "print.h" // printing utilities #include "usart.h" // USART utilities #include "usb_cdcacm.h" // USB CDC ACM utilities -#include "led_tm1637.h" // TM1637 7-segment controller utilities #include "rtc_ds1307.h" // DS1307 RTC utilities +#include "led_tm1637.h" // TM1637 7-segment controller utilities +#include "led_max7219.h" // MAX7219 7-segment controller utilities #define WATCHDOG_PERIOD 10000 /**< watchdog period in ms */ @@ -205,15 +206,17 @@ void main(void) printf("current date: 20%02u-%02u-%02u %02u:%02u:%02u\n", rtc_ds1307_time[6], rtc_ds1307_time[5], rtc_ds1307_time[4], rtc_ds1307_time[2], rtc_ds1307_time[1], rtc_ds1307_time[0]); } - // setup TM1637 - puts("setup 7-segment display: "); - led_tm1637_setup(); - if (!led_tm1637_time(88,88)) { // test display + // setup TM1637 and MAX7219 7-segments displays + puts("setup 7-segment displays: "); + led_tm1637_setup(); // setup TM1637 + led_max7219_setup(); // setup MAX7219 + if (!led_tm1637_time(88,88)) { // test TM1637 display puts("could not send time to TM1637\n"); } - if (!led_tm1637_on()) { // switch on display + if (!led_tm1637_on()) { // switch on TM1637 display puts("could not switch on TM1637\n"); } + led_max7219_test(true); // test MAX7219 display for (uint32_t i=0; i<5000000; i++) { // wait a bit to have the user check the display __asm__("nop"); } @@ -223,8 +226,10 @@ void main(void) if (!led_tm1637_off()) { // switch off display puts("could not switch off TM1637\n"); } + led_max7219_test(false); // go back in normal operation + led_max7219_off(); // switch display off puts("OK\n"); - + // main loop puts("command input: ready\n"); bool action = false; // if an action has been performed don't go to sleep