diff options
author | Jay Greco <jayv.greco@gmail.com> | 2023-01-27 00:03:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-27 08:03:57 +0000 |
commit | b3dca4bb36d0c08e8145f6f25649aaf61b513fdd (patch) | |
tree | efa1166c6bae58dc30fd8f2d4157c64a1fbb4837 /keyboards/nullbitsco/scramble/v2/v2.h | |
parent | 6e42b5854902963469a4016abeca48a9df5c1c46 (diff) |
Add RP2040 SCRAMBLE v2 (#19489)
Diffstat (limited to 'keyboards/nullbitsco/scramble/v2/v2.h')
-rw-r--r-- | keyboards/nullbitsco/scramble/v2/v2.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/keyboards/nullbitsco/scramble/v2/v2.h b/keyboards/nullbitsco/scramble/v2/v2.h new file mode 100644 index 0000000000..d278c0a86a --- /dev/null +++ b/keyboards/nullbitsco/scramble/v2/v2.h @@ -0,0 +1,43 @@ +// Copyright 2022 Jay Greco +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "scramble.h" +#include <hal.h> + +enum led_mode { + LED_OFF = 0, + LED_DIM, + LED_ON, + NUM_LED_MODE +}; + +enum rgb_idx { + RED = 0, + GREEN, + BLUE, + NUM_RGB_IDX +}; + +typedef struct pwm_led_t { + uint32_t pin[3]; + PWMDriver* driver[3]; + uint8_t channel[3]; + uint8_t mode; + uint8_t init_complete; +} pwm_led_t; + +#define PWM_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) +#define PWM_PWM_COUNTER_FREQUENCY 1000000 +#define PWM_PWM_PERIOD PWM_PWM_COUNTER_FREQUENCY / 1000 + +// RP2040 adds HW PWM control! +// PWM values are in percent, 0-100 +void + set_scramble_LED(uint8_t mode), + set_scramble_LED_rgb_pwm(uint8_t r_pwm, uint8_t g_pwm, uint8_t b_pwm), + set_scramble_LED_r_pwm(uint8_t pwm), + set_scramble_LED_g_pwm(uint8_t pwm), + set_scramble_LED_b_pwm(uint8_t pwm); +
\ No newline at end of file |