Compare commits

...
3 Commits
Author SHA1 Message Date
mtei d0f8e1babe modify quantum/template/avr/config.h: add rgblight effect configurations 2018-11-12 12:23:12 -08:00
comaid 2b7decbaeb Fix up screen off timer of helix (#4347)
* Fix up screen off timer of helix

* Fix Up ScreenOffInterval exceeded uint16_t

* Fix Up never waking up once screen off if in case of matrix are not dirty

* Changing referenIng incorrect constant name

* OLED_ENABLED => SSD1306OLED

* Improve internal processing of process_record_kb()

* Use the return value of process_record_gfx()

* Move a include statement into #ifdef block

Move   #include "ssd1306.h` statement into #ifdef block

* Move process_record_kbI()

Move process_record_kb() from helix.c to rev1.c/rev2.c/pico.c

* Move process_record_kb()
2018-11-12 12:20:50 -08:00
comaid aa03049015 Fix up screen off timer of crkbd (#4346)
* fix about screen off timer

* Fix Up ScreenOffInterval exceeded uint16_t

* Fix Up never waking up once screen off if in case of matrix are not dirty.

* Revert "fix about screen off timer"

This reverts commit 3d175f2340c14250a71af78afec5a1e890d9f4e7.

* Fix up screen off timer of crkbd

* Fix Up ScreenOffInterval exceeded uint16_t

* Fix Up never waking up once screen off if in case of matrix are not dirty.

* Fix up screen off timer of helix

* Fix Up ScreenOffInterval exceeded uint16_t

* Fix Up never waking up once screen off if in case of matrix are not dirty

* Revert "Fix up screen off timer of helix"

This reverts commit f0efb82443a7dc34b75579359b0514e8bfa51100.

* Improve internal processing of process_record_kb()

* Use the return value of process_record_gfx()

* Fix a indent

Fix a indent
2018-11-12 12:19:29 -08:00
9 changed files with 75 additions and 10 deletions

No files matched your search

+5
View File
@@ -1 +1,6 @@
#include "crkbd.h" #include "crkbd.h"
#include "ssd1306.h"
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_gfx(keycode,record) && process_record_user(keycode, record);
}
+14 -2
View File
@@ -24,12 +24,17 @@ static const unsigned char font[] PROGMEM;
//static uint16_t last_battery_update; //static uint16_t last_battery_update;
//static uint32_t vbat; //static uint32_t vbat;
//#define BatteryUpdateInterval 10000 /* milliseconds */ //#define BatteryUpdateInterval 10000 /* milliseconds */
#define ScreenOffInterval 300000 /* milliseconds */
// 'last_flush' is declared as uint16_t,
// so this must be less than 65535
#define ScreenOffInterval 60000 /* milliseconds */
#if DEBUG_TO_SCREEN #if DEBUG_TO_SCREEN
static uint8_t displaying; static uint8_t displaying;
#endif #endif
static uint16_t last_flush; static uint16_t last_flush;
static bool force_dirty = true;
// Write command sequence. // Write command sequence.
// Returns true on success. // Returns true on success.
static inline bool _send_cmd1(uint8_t cmd) { static inline bool _send_cmd1(uint8_t cmd) {
@@ -321,12 +326,19 @@ void iota_gfx_task_user(void) {
void iota_gfx_task(void) { void iota_gfx_task(void) {
iota_gfx_task_user(); iota_gfx_task_user();
if (display.dirty) { if (display.dirty|| force_dirty) {
iota_gfx_flush(); iota_gfx_flush();
force_dirty = false;
} }
if (timer_elapsed(last_flush) > ScreenOffInterval) { if (timer_elapsed(last_flush) > ScreenOffInterval) {
iota_gfx_off(); iota_gfx_off();
} }
} }
bool process_record_gfx(uint16_t keycode, keyrecord_t *record) {
force_dirty = true;
return true;
}
#endif #endif
+3
View File
@@ -3,6 +3,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include "pincontrol.h" #include "pincontrol.h"
#include "action.h"
enum ssd1306_cmds { enum ssd1306_cmds {
DisplayOff = 0xAE, DisplayOff = 0xAE,
@@ -86,3 +87,5 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data);
void matrix_write_ln(struct CharacterMatrix *matrix, const char *data); void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
void matrix_write_P(struct CharacterMatrix *matrix, const char *data); void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
void matrix_render(struct CharacterMatrix *matrix); void matrix_render(struct CharacterMatrix *matrix);
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
+6
View File
@@ -2,6 +2,12 @@
#ifdef SSD1306OLED #ifdef SSD1306OLED
#include "ssd1306.h"
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_gfx(keycode,record) && process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) { void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
//led_set_user(usb_led); //led_set_user(usb_led);
+6
View File
@@ -2,6 +2,12 @@
#ifdef SSD1306OLED #ifdef SSD1306OLED
#include "ssd1306.h"
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_gfx(keycode,record) && process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) { void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led); led_set_user(usb_led);
+6
View File
@@ -2,6 +2,12 @@
#ifdef SSD1306OLED #ifdef SSD1306OLED
#include "ssd1306.h"
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_gfx(keycode,record) && process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) { void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
//led_set_user(usb_led); //led_set_user(usb_led);
+15 -2
View File
@@ -1,3 +1,4 @@
#ifdef SSD1306OLED #ifdef SSD1306OLED
#include "ssd1306.h" #include "ssd1306.h"
@@ -27,12 +28,17 @@
//static uint16_t last_battery_update; //static uint16_t last_battery_update;
//static uint32_t vbat; //static uint32_t vbat;
//#define BatteryUpdateInterval 10000 /* milliseconds */ //#define BatteryUpdateInterval 10000 /* milliseconds */
#define ScreenOffInterval 300000 /* milliseconds */
// 'last_flush' is declared as uint16_t,
// so this must be less than 65535
#define ScreenOffInterval 60000 /* milliseconds */
#if DEBUG_TO_SCREEN #if DEBUG_TO_SCREEN
static uint8_t displaying; static uint8_t displaying;
#endif #endif
static uint16_t last_flush; static uint16_t last_flush;
static bool force_dirty = true;
// Write command sequence. // Write command sequence.
// Returns true on success. // Returns true on success.
static inline bool _send_cmd1(uint8_t cmd) { static inline bool _send_cmd1(uint8_t cmd) {
@@ -318,12 +324,19 @@ void iota_gfx_task_user(void) {
void iota_gfx_task(void) { void iota_gfx_task(void) {
iota_gfx_task_user(); iota_gfx_task_user();
if (display.dirty) { if (display.dirty|| force_dirty) {
iota_gfx_flush(); iota_gfx_flush();
force_dirty = false;
} }
if (timer_elapsed(last_flush) > ScreenOffInterval) { if (timer_elapsed(last_flush) > ScreenOffInterval) {
iota_gfx_off(); iota_gfx_off();
} }
} }
bool process_record_gfx(uint16_t keycode, keyrecord_t *record) {
force_dirty = true;
return true;
}
#endif #endif
+2 -1
View File
@@ -4,6 +4,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include "pincontrol.h" #include "pincontrol.h"
#include "action.h"
enum ssd1306_cmds { enum ssd1306_cmds {
DisplayOff = 0xAE, DisplayOff = 0xAE,
@@ -87,6 +88,6 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data);
void matrix_write_P(struct CharacterMatrix *matrix, const char *data); void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
void matrix_render(struct CharacterMatrix *matrix); void matrix_render(struct CharacterMatrix *matrix);
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
#endif #endif
+18 -5
View File
@@ -54,11 +54,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define RGB_DI_PIN E2 // #define RGB_DI_PIN E2
// #ifdef RGB_DI_PIN // #ifdef RGB_DI_PIN
// #define RGBLIGHT_ANIMATIONS // #define RGBLED_NUM 16
// #define RGBLED_NUM 16 // #define RGBLIGHT_HUE_STEP 8
// #define RGBLIGHT_HUE_STEP 8 // #define RGBLIGHT_SAT_STEP 8
// #define RGBLIGHT_SAT_STEP 8 // #define RGBLIGHT_VAL_STEP 8
// #define RGBLIGHT_VAL_STEP 8 // #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
// /*== all animations enable ==*/
// #define RGBLIGHT_ANIMATIONS
// /*== or choose animations ==*/
// #define RGBLIGHT_EFFECT_BREATHING
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
// #define RGBLIGHT_EFFECT_SNAKE
// #define RGBLIGHT_EFFECT_KNIGHT
// #define RGBLIGHT_EFFECT_CHRISTMAS
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
// #define RGBLIGHT_EFFECT_RGB_TEST
// #define RGBLIGHT_EFFECT_ALTERNATING
// #endif // #endif
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */