logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

v2.h (925B)


  1. // Copyright 2022 Jay Greco
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "quantum.h"
  5. #include <hal.h>
  6. enum led_mode {
  7. LED_OFF = 0,
  8. LED_DIM,
  9. LED_ON,
  10. NUM_LED_MODE
  11. };
  12. enum rgb_idx {
  13. RED = 0,
  14. GREEN,
  15. BLUE,
  16. NUM_RGB_IDX
  17. };
  18. typedef struct pwm_led_t {
  19. uint32_t pin[3];
  20. PWMDriver* driver[3];
  21. uint8_t channel[3];
  22. uint8_t mode;
  23. uint8_t init_complete;
  24. } pwm_led_t;
  25. #define PWM_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE)
  26. #define PWM_PWM_COUNTER_FREQUENCY 1000000
  27. #define PWM_PWM_PERIOD PWM_PWM_COUNTER_FREQUENCY / 1000
  28. // RP2040 adds HW PWM control!
  29. // PWM values are in percent, 0-100
  30. void
  31. set_scramble_LED(uint8_t mode),
  32. set_scramble_LED_rgb_pwm(uint8_t r_pwm, uint8_t g_pwm, uint8_t b_pwm),
  33. set_scramble_LED_r_pwm(uint8_t pwm),
  34. set_scramble_LED_g_pwm(uint8_t pwm),
  35. set_scramble_LED_b_pwm(uint8_t pwm);