Нема описа
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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * led.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 "pico/stdlib.h"
  19. #include "sequence.h"
  20. #include "led.h"
  21. static const uint led_gpio_num[LED_COUNT] = {
  22. 12, 13, 14, 15,
  23. };
  24. static const uint ch_gpio_num[NUM_CHANNELS] = {
  25. 2, 3, 4,
  26. };
  27. void led_init(void) {
  28. for (uint i = 0; i < LED_COUNT; i++) {
  29. gpio_init(led_gpio_num[i]);
  30. gpio_set_dir(led_gpio_num[i], GPIO_OUT);
  31. }
  32. for (uint i = 0; i < NUM_CHANNELS; i++) {
  33. gpio_init(ch_gpio_num[i]);
  34. gpio_set_dir(ch_gpio_num[i], GPIO_OUT);
  35. }
  36. }
  37. void led_set(uint32_t i, bool v) {
  38. i %= LED_COUNT;
  39. gpio_put(i, v);
  40. }
  41. void ch_set(uint32_t i, bool v) {
  42. i %= NUM_CHANNELS;
  43. gpio_put(i, v);
  44. }