Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 <stdio.h>
  19. #include <inttypes.h>
  20. #include "pico/stdlib.h"
  21. #include "sequence.h"
  22. #include "log.h"
  23. #include "led.h"
  24. #if 0
  25. static const uint led_gpio_num[LED_COUNT] = {
  26. 10, 11, 13, 15,
  27. };
  28. #else
  29. static const uint led_gpio_num[LED_COUNT] = {
  30. 6, 7, 8, 9, 10, 11, 12, 13,
  31. };
  32. #endif
  33. static const uint ch_gpio_num[NUM_CHANNELS] = {
  34. 22, 26, 27,
  35. };
  36. void led_init(void) {
  37. for (uint i = 0; i < LED_COUNT; i++) {
  38. gpio_init(led_gpio_num[i]);
  39. gpio_set_dir(led_gpio_num[i], GPIO_OUT);
  40. }
  41. for (uint i = 0; i < NUM_CHANNELS; i++) {
  42. gpio_init(ch_gpio_num[i]);
  43. gpio_set_dir(ch_gpio_num[i], GPIO_OUT);
  44. }
  45. }
  46. void led_set(uint32_t i, bool v) {
  47. i %= LED_COUNT;
  48. gpio_put(led_gpio_num[i], v);
  49. //debug("led %"PRIu32" now %d", i, v);
  50. }
  51. void ch_set(uint32_t i, bool v) {
  52. i %= NUM_CHANNELS;
  53. gpio_put(ch_gpio_num[i], v);
  54. //debug("ch %"PRIu32" now %d", i, v);
  55. }