No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.c 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * main.c
  3. *
  4. * Copyright (c) 2024 Thomas Buck (thomas@xythobuz.de)
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * See <http://www.gnu.org/licenses/>.
  17. */
  18. #include <stdio.h>
  19. #include "pico/stdlib.h"
  20. #include "hardware/watchdog.h"
  21. #include "buttons.h"
  22. #include "encoder.h"
  23. #include "lcd.h"
  24. #include "led.h"
  25. #include "pulse.h"
  26. #include "sequence.h"
  27. #include "ui.h"
  28. #include "main.h"
  29. #define WATCHDOG_PERIOD_MS 100
  30. int main(void) {
  31. watchdog_enable(WATCHDOG_PERIOD_MS, 1);
  32. stdio_init_all();
  33. buttons_init();
  34. encoder_init();
  35. lcd_init();
  36. led_init();
  37. sequence_init();
  38. ui_init();
  39. printf("init done\n");
  40. int32_t last_epos = 0;
  41. while (1) {
  42. watchdog_update();
  43. buttons_run();
  44. encoder_run();
  45. sequence_run();
  46. pulse_run();
  47. int32_t epos = encoder_pos();
  48. if (epos != last_epos) {
  49. ui_encoder(epos - last_epos);
  50. last_epos = epos;
  51. }
  52. }
  53. return 0;
  54. }