Merge branch 'master' into hid_joystick
This commit is contained in:
commit
a80ea8b7cc
284 changed files with 9404 additions and 2408 deletions
|
@ -151,6 +151,8 @@ void process_record_nocache(keyrecord_t *record) { process_record(record); }
|
|||
|
||||
__attribute__((weak)) bool process_record_quantum(keyrecord_t *record) { return true; }
|
||||
|
||||
__attribute__((weak)) void post_process_record_quantum(keyrecord_t *record) {}
|
||||
|
||||
#ifndef NO_ACTION_TAPPING
|
||||
/** \brief Allows for handling tap-hold actions immediately instead of waiting for TAPPING_TERM or another keypress.
|
||||
*
|
||||
|
@ -185,6 +187,11 @@ void process_record(keyrecord_t *record) {
|
|||
|
||||
if (!process_record_quantum(record)) return;
|
||||
|
||||
process_record_handler(record);
|
||||
post_process_record_quantum(record);
|
||||
}
|
||||
|
||||
void process_record_handler(keyrecord_t *record) {
|
||||
action_t action = store_or_get_action(record->event.pressed, record->event.key);
|
||||
dprint("ACTION: ");
|
||||
debug_action(action);
|
||||
|
@ -988,7 +995,6 @@ bool is_tap_action(action_t action) {
|
|||
* FIXME: Needs documentation.
|
||||
*/
|
||||
void debug_event(keyevent_t event) { dprintf("%04X%c(%u)", (event.key.row << 8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time); }
|
||||
|
||||
/** \brief Debug print (FIXME: Needs better description)
|
||||
*
|
||||
* FIXME: Needs documentation.
|
||||
|
|
|
@ -84,6 +84,8 @@ void process_hand_swap(keyevent_t *record);
|
|||
|
||||
void process_record_nocache(keyrecord_t *record);
|
||||
void process_record(keyrecord_t *record);
|
||||
void process_record_handler(keyrecord_t *record);
|
||||
void post_process_record_quantum(keyrecord_t *record);
|
||||
void process_action(keyrecord_t *record, action_t action);
|
||||
void register_code(uint8_t code);
|
||||
void unregister_code(uint8_t code);
|
||||
|
|
|
@ -5,6 +5,30 @@
|
|||
#include "led.h"
|
||||
#include "sleep_led.h"
|
||||
|
||||
#ifndef SLEEP_LED_TIMER
|
||||
# define SLEEP_LED_TIMER 1
|
||||
#endif
|
||||
|
||||
#if SLEEP_LED_TIMER == 1
|
||||
# define TCCRxB TCCR1B
|
||||
# define TIMERx_COMPA_vect TIMER1_COMPA_vect
|
||||
# if defined(__AVR_ATmega32A__) // This MCU has only one TIMSK register
|
||||
# define TIMSKx TIMSK
|
||||
# else
|
||||
# define TIMSKx TIMSK1
|
||||
# endif
|
||||
# define OCIExA OCIE1A
|
||||
# define OCRxx OCR1A
|
||||
#elif SLEEP_LED_TIMER == 3
|
||||
# define TCCRxB TCCR3B
|
||||
# define TIMERx_COMPA_vect TIMER3_COMPA_vect
|
||||
# define TIMSKx TIMSK3
|
||||
# define OCIExA OCIE3A
|
||||
# define OCRxx OCR3A
|
||||
#else
|
||||
error("Invalid SLEEP_LED_TIMER config")
|
||||
#endif
|
||||
|
||||
/* Software PWM
|
||||
* ______ ______ __
|
||||
* | ON |___OFF___| ON |___OFF___| ....
|
||||
|
@ -25,15 +49,14 @@
|
|||
void sleep_led_init(void) {
|
||||
/* Timer1 setup */
|
||||
/* CTC mode */
|
||||
TCCR1B |= _BV(WGM12);
|
||||
TCCRxB |= _BV(WGM12);
|
||||
/* Clock selelct: clk/1 */
|
||||
TCCR1B |= _BV(CS10);
|
||||
TCCRxB |= _BV(CS10);
|
||||
/* Set TOP value */
|
||||
uint8_t sreg = SREG;
|
||||
cli();
|
||||
OCR1AH = (SLEEP_LED_TIMER_TOP >> 8) & 0xff;
|
||||
OCR1AL = SLEEP_LED_TIMER_TOP & 0xff;
|
||||
SREG = sreg;
|
||||
OCRxx = SLEEP_LED_TIMER_TOP;
|
||||
SREG = sreg;
|
||||
}
|
||||
|
||||
/** \brief Sleep LED enable
|
||||
|
@ -42,7 +65,7 @@ void sleep_led_init(void) {
|
|||
*/
|
||||
void sleep_led_enable(void) {
|
||||
/* Enable Compare Match Interrupt */
|
||||
TIMSK1 |= _BV(OCIE1A);
|
||||
TIMSKx |= _BV(OCIExA);
|
||||
}
|
||||
|
||||
/** \brief Sleep LED disable
|
||||
|
@ -51,7 +74,7 @@ void sleep_led_enable(void) {
|
|||
*/
|
||||
void sleep_led_disable(void) {
|
||||
/* Disable Compare Match Interrupt */
|
||||
TIMSK1 &= ~_BV(OCIE1A);
|
||||
TIMSKx &= ~_BV(OCIExA);
|
||||
}
|
||||
|
||||
/** \brief Sleep LED toggle
|
||||
|
@ -60,7 +83,7 @@ void sleep_led_disable(void) {
|
|||
*/
|
||||
void sleep_led_toggle(void) {
|
||||
/* Disable Compare Match Interrupt */
|
||||
TIMSK1 ^= _BV(OCIE1A);
|
||||
TIMSKx ^= _BV(OCIExA);
|
||||
}
|
||||
|
||||
/** \brief Breathing Sleep LED brighness(PWM On period) table
|
||||
|
@ -72,7 +95,7 @@ void sleep_led_toggle(void) {
|
|||
*/
|
||||
static const uint8_t breathing_table[64] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10, 15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252, 255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23, 15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
ISR(TIMER1_COMPA_vect) {
|
||||
ISR(TIMERx_COMPA_vect) {
|
||||
/* Software PWM
|
||||
* timer:1111 1111 1111 1111
|
||||
* \_____/\/ \_______/____ count(0-255)
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
# include <avr/pgmspace.h>
|
||||
#else
|
||||
# define PROGMEM
|
||||
# define pgm_read_byte(p) *((unsigned char*)(p))
|
||||
# define pgm_read_word(p) *((uint16_t*)(p))
|
||||
# define pgm_read_dword(p) *((uint32_t*)(p))
|
||||
# define memcpy_P(dest, src, n) memcpy(dest, src, n)
|
||||
# define pgm_read_byte(address_short) *((uint8_t*)(address_short))
|
||||
# define pgm_read_word(address_short) *((uint16_t*)(address_short))
|
||||
# define pgm_read_dword(address_short) *((uint32_t*)(address_short))
|
||||
# define pgm_read_ptr(address_short) *((void*)(address_short))
|
||||
# define strcmp_P(s1, s2) strcmp(s1, s2)
|
||||
# define strcpy_P(dest, src) strcpy(dest, src)
|
||||
# define strlen_P(src) strlen(src)
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue