Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7aba1fd176 | ||
|
|
569ed9db9d | ||
|
|
0306e487e2 | ||
|
|
1d3b9eea94 | ||
|
|
6ca52c9d57 | ||
|
|
9f3afae5d1 | ||
|
|
d55dc9b816 |
No files matched your search
@@ -11,6 +11,9 @@
|
|||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "rgblight_reconfig.h"
|
#include "rgblight_reconfig.h"
|
||||||
|
#ifdef SPLIT_KEYBOARD
|
||||||
|
#include "split_flags.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PROTOCOL_LUFA
|
#ifdef PROTOCOL_LUFA
|
||||||
#include "lufa.h"
|
#include "lufa.h"
|
||||||
@@ -22,6 +25,9 @@
|
|||||||
|
|
||||||
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
||||||
#include "rgblight.h"
|
#include "rgblight.h"
|
||||||
|
extern rgblight_config_t rgblight_config;
|
||||||
|
static bool rgblight_enabled;
|
||||||
|
static bool is_suspended;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -46,8 +52,7 @@ __asm__ __volatile__ ( \
|
|||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
*/
|
*/
|
||||||
void suspend_idle(uint8_t time)
|
void suspend_idle(uint8_t time) {
|
||||||
{
|
|
||||||
cli();
|
cli();
|
||||||
set_sleep_mode(SLEEP_MODE_IDLE);
|
set_sleep_mode(SLEEP_MODE_IDLE);
|
||||||
sleep_enable();
|
sleep_enable();
|
||||||
@@ -95,8 +100,7 @@ static uint8_t wdt_timeout = 0;
|
|||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
*/
|
*/
|
||||||
static void power_down(uint8_t wdto)
|
static void power_down(uint8_t wdto) {
|
||||||
{
|
|
||||||
#ifdef PROTOCOL_LUFA
|
#ifdef PROTOCOL_LUFA
|
||||||
if (USB_DeviceState == DEVICE_STATE_Configured) return;
|
if (USB_DeviceState == DEVICE_STATE_Configured) return;
|
||||||
#endif
|
#endif
|
||||||
@@ -120,7 +124,14 @@ static void power_down(uint8_t wdto)
|
|||||||
#ifdef RGBLIGHT_ANIMATIONS
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
rgblight_timer_disable();
|
rgblight_timer_disable();
|
||||||
#endif
|
#endif
|
||||||
rgblight_disable_noeeprom();
|
if (!is_suspended) {
|
||||||
|
is_suspended = true;
|
||||||
|
rgblight_enabled = rgblight_config.enable;
|
||||||
|
rgblight_disable_noeeprom();
|
||||||
|
#ifdef SPLIT_KEYBOARD
|
||||||
|
RGB_DIRTY = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
suspend_power_down_kb();
|
suspend_power_down_kb();
|
||||||
|
|
||||||
@@ -145,8 +156,7 @@ static void power_down(uint8_t wdto)
|
|||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
*/
|
*/
|
||||||
void suspend_power_down(void)
|
void suspend_power_down(void) {
|
||||||
{
|
|
||||||
suspend_power_down_kb();
|
suspend_power_down_kb();
|
||||||
|
|
||||||
#ifndef NO_SUSPEND_POWER_DOWN
|
#ifndef NO_SUSPEND_POWER_DOWN
|
||||||
@@ -156,8 +166,7 @@ void suspend_power_down(void)
|
|||||||
|
|
||||||
__attribute__ ((weak)) void matrix_power_up(void) {}
|
__attribute__ ((weak)) void matrix_power_up(void) {}
|
||||||
__attribute__ ((weak)) void matrix_power_down(void) {}
|
__attribute__ ((weak)) void matrix_power_down(void) {}
|
||||||
bool suspend_wakeup_condition(void)
|
bool suspend_wakeup_condition(void) {
|
||||||
{
|
|
||||||
matrix_power_up();
|
matrix_power_up();
|
||||||
matrix_scan();
|
matrix_scan();
|
||||||
matrix_power_down();
|
matrix_power_down();
|
||||||
@@ -186,8 +195,7 @@ void suspend_wakeup_init_kb(void) {
|
|||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
*/
|
*/
|
||||||
void suspend_wakeup_init(void)
|
void suspend_wakeup_init(void) {
|
||||||
{
|
|
||||||
// clear keyboard state
|
// clear keyboard state
|
||||||
clear_keyboard();
|
clear_keyboard();
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
@@ -195,10 +203,16 @@ void suspend_wakeup_init(void)
|
|||||||
#endif
|
#endif
|
||||||
led_set(host_keyboard_leds());
|
led_set(host_keyboard_leds());
|
||||||
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
||||||
#ifdef BOOTLOADER_TEENSY
|
is_suspended = false;
|
||||||
wait_ms(10);
|
if (rgblight_enabled) {
|
||||||
#endif
|
#ifdef BOOTLOADER_TEENSY
|
||||||
rgblight_enable_noeeprom();
|
wait_ms(10);
|
||||||
|
#endif
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
#ifdef SPLIT_KEYBOARD
|
||||||
|
RGB_DIRTY = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#ifdef RGBLIGHT_ANIMATIONS
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
rgblight_timer_enable();
|
rgblight_timer_enable();
|
||||||
#endif
|
#endif
|
||||||
@@ -208,8 +222,7 @@ void suspend_wakeup_init(void)
|
|||||||
|
|
||||||
#ifndef NO_SUSPEND_POWER_DOWN
|
#ifndef NO_SUSPEND_POWER_DOWN
|
||||||
/* watchdog timeout */
|
/* watchdog timeout */
|
||||||
ISR(WDT_vect)
|
ISR(WDT_vect) {
|
||||||
{
|
|
||||||
// compensate timer for sleep
|
// compensate timer for sleep
|
||||||
switch (wdt_timeout) {
|
switch (wdt_timeout) {
|
||||||
case WDTO_15MS:
|
case WDTO_15MS:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "arm_atsam_protocol.h"
|
#include "arm_atsam_protocol.h"
|
||||||
#include "tmk_core/common/led.h"
|
#include "tmk_core/common/led.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
void SERCOM1_0_Handler( void )
|
void SERCOM1_0_Handler( void )
|
||||||
{
|
{
|
||||||
@@ -217,6 +218,7 @@ void disp_calc_extents(void)
|
|||||||
|
|
||||||
disp.width = disp.right - disp.left;
|
disp.width = disp.right - disp.left;
|
||||||
disp.height = disp.top - disp.bottom;
|
disp.height = disp.top - disp.bottom;
|
||||||
|
disp.max_distance = sqrtf(powf(disp.width, 2) + powf(disp.height, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void disp_pixel_setup(void)
|
void disp_pixel_setup(void)
|
||||||
@@ -249,6 +251,7 @@ uint8_t led_animation_breathing;
|
|||||||
uint8_t led_animation_breathe_cur;
|
uint8_t led_animation_breathe_cur;
|
||||||
uint8_t breathe_step;
|
uint8_t breathe_step;
|
||||||
uint8_t breathe_dir;
|
uint8_t breathe_dir;
|
||||||
|
uint8_t led_animation_circular;
|
||||||
uint64_t led_next_run;
|
uint64_t led_next_run;
|
||||||
|
|
||||||
uint8_t led_animation_id;
|
uint8_t led_animation_id;
|
||||||
@@ -265,6 +268,7 @@ void led_matrix_run(void)
|
|||||||
float go;
|
float go;
|
||||||
float bo;
|
float bo;
|
||||||
float po;
|
float po;
|
||||||
|
|
||||||
uint8_t led_this_run = 0;
|
uint8_t led_this_run = 0;
|
||||||
led_setup_t *f = (led_setup_t*)led_setups[led_animation_id];
|
led_setup_t *f = (led_setup_t*)led_setups[led_animation_id];
|
||||||
|
|
||||||
@@ -327,13 +331,18 @@ void led_matrix_run(void)
|
|||||||
for (fcur = 0; fcur < fmax; fcur++)
|
for (fcur = 0; fcur < fmax; fcur++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (led_animation_orientation)
|
if (led_animation_circular) {
|
||||||
{
|
po = sqrtf((powf(fabsf((disp.width / 2) - (led_cur->x - disp.left)), 2) + powf(fabsf((disp.height / 2) - (led_cur->y - disp.bottom)), 2))) / disp.max_distance * 100;
|
||||||
po = led_cur->py;
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (led_animation_orientation)
|
||||||
po = led_cur->px;
|
{
|
||||||
|
po = led_cur->py;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
po = led_cur->px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float pomod;
|
float pomod;
|
||||||
@@ -466,6 +475,7 @@ uint8_t led_matrix_init(void)
|
|||||||
led_animation_breathe_cur = BREATHE_MIN_STEP;
|
led_animation_breathe_cur = BREATHE_MIN_STEP;
|
||||||
breathe_step = 1;
|
breathe_step = 1;
|
||||||
breathe_dir = 1;
|
breathe_dir = 1;
|
||||||
|
led_animation_circular = 0;
|
||||||
|
|
||||||
gcr_min_counter = 0;
|
gcr_min_counter = 0;
|
||||||
v_5v_cat_hit = 0;
|
v_5v_cat_hit = 0;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ typedef struct led_disp_s {
|
|||||||
float bottom;
|
float bottom;
|
||||||
float width;
|
float width;
|
||||||
float height;
|
float height;
|
||||||
|
float max_distance;
|
||||||
} led_disp_t;
|
} led_disp_t;
|
||||||
|
|
||||||
uint8_t led_matrix_init(void);
|
uint8_t led_matrix_init(void);
|
||||||
@@ -129,6 +130,7 @@ extern uint8_t led_animation_orientation;
|
|||||||
extern uint8_t led_animation_breathing;
|
extern uint8_t led_animation_breathing;
|
||||||
extern uint8_t led_animation_breathe_cur;
|
extern uint8_t led_animation_breathe_cur;
|
||||||
extern uint8_t breathe_dir;
|
extern uint8_t breathe_dir;
|
||||||
|
extern uint8_t led_animation_circular;
|
||||||
extern const uint8_t led_setups_count;
|
extern const uint8_t led_setups_count;
|
||||||
|
|
||||||
extern void *led_setups[];
|
extern void *led_setups[];
|
||||||
|
|||||||
Reference in new issue
Block a user