From 649b33d7783cf3021928534b7ae127e0a89e8807 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 21 Jun 2016 22:39:54 -0400 Subject: Renames keyboard folder to keyboards, adds couple of tmk's fixes (#432) * fixes from tmk's repo * rename keyboard to keyboards --- keyboard/atomic/atomic.c | 325 ----------------------------------------------- 1 file changed, 325 deletions(-) delete mode 100644 keyboard/atomic/atomic.c (limited to 'keyboard/atomic/atomic.c') diff --git a/keyboard/atomic/atomic.c b/keyboard/atomic/atomic.c deleted file mode 100644 index fa218a48f..000000000 --- a/keyboard/atomic/atomic.c +++ /dev/null @@ -1,325 +0,0 @@ -#include "atomic.h" - -__attribute__ ((weak)) -void matrix_init_user(void) { - // leave this function blank - it can be defined in a keymap file -}; - -__attribute__ ((weak)) -void matrix_scan_user(void) { - // leave this function blank - it can be defined in a keymap file -} - -__attribute__ ((weak)) -bool process_action_user(keyrecord_t *record) { - // leave this function blank - it can be defined in a keymap file - return true; -} - -__attribute__ ((weak)) -void led_set_user(uint8_t usb_led) { - // leave this function blank - it can be defined in a keymap file -} - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - - MCUCR |= (1<= BACKLIGHT_LEVELS ) - { - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - - // Set the brightness to max - CHANNEL = 0xFFFF; - } - else - { - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - - // Set the brightness - CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); - } - breathing_intensity_default(); -} - - -void breathing_enable(void) -{ - if (get_backlight_level() == 0) - { - breathing_index = 0; - } - else - { - // Set breathing_index to be at the midpoint (brightest point) - breathing_index = 0x20 << breath_speed; - } - - breathing_halt = BREATHING_NO_HALT; - - // Enable breathing interrupt - TIMSK1 |= _BV(OCIE1A); -} - -void breathing_pulse(void) -{ - if (get_backlight_level() == 0) - { - breathing_index = 0; - } - else - { - // Set breathing_index to be at the midpoint + 1 (brightest point) - breathing_index = 0x21 << breath_speed; - } - - breathing_halt = BREATHING_HALT_ON; - - // Enable breathing interrupt - TIMSK1 |= _BV(OCIE1A); -} - -void breathing_disable(void) -{ - // Disable breathing interrupt - TIMSK1 &= ~_BV(OCIE1A); - backlight_set(get_backlight_level()); -} - -void breathing_self_disable(void) -{ - if (get_backlight_level() == 0) - { - breathing_halt = BREATHING_HALT_OFF; - } - else - { - breathing_halt = BREATHING_HALT_ON; - } - - //backlight_set(get_backlight_level()); -} - -void breathing_toggle(void) -{ - if (!is_breathing()) - { - if (get_backlight_level() == 0) - { - breathing_index = 0; - } - else - { - // Set breathing_index to be at the midpoint + 1 (brightest point) - breathing_index = 0x21 << breath_speed; - } - - breathing_halt = BREATHING_NO_HALT; - } - - // Toggle breathing interrupt - TIMSK1 ^= _BV(OCIE1A); - - // Restore backlight level - if (!is_breathing()) - { - backlight_set(get_backlight_level()); - } -} - -bool is_breathing(void) -{ - return (TIMSK1 && _BV(OCIE1A)); -} - -void breathing_intensity_default(void) -{ - //breath_intensity = (uint8_t)((uint16_t)100 * (uint16_t)get_backlight_level() / (uint16_t)BACKLIGHT_LEVELS); - breath_intensity = ((BACKLIGHT_LEVELS - get_backlight_level()) * ((BACKLIGHT_LEVELS + 1) / 2)); -} - -void breathing_intensity_set(uint8_t value) -{ - breath_intensity = value; -} - -void breathing_speed_default(void) -{ - breath_speed = 4; -} - -void breathing_speed_set(uint8_t value) -{ - bool is_breathing_now = is_breathing(); - uint8_t old_breath_speed = breath_speed; - - if (is_breathing_now) - { - // Disable breathing interrupt - TIMSK1 &= ~_BV(OCIE1A); - } - - breath_speed = value; - - if (is_breathing_now) - { - // Adjust index to account for new speed - breathing_index = (( (uint8_t)( (breathing_index) >> old_breath_speed ) ) & 0x3F) << breath_speed; - - // Enable breathing interrupt - TIMSK1 |= _BV(OCIE1A); - } - -} - -void breathing_speed_inc(uint8_t value) -{ - if ((uint16_t)(breath_speed - value) > 10 ) - { - breathing_speed_set(0); - } - else - { - breathing_speed_set(breath_speed - value); - } -} - -void breathing_speed_dec(uint8_t value) -{ - if ((uint16_t)(breath_speed + value) > 10 ) - { - breathing_speed_set(10); - } - else - { - breathing_speed_set(breath_speed + value); - } -} - -void breathing_defaults(void) -{ - breathing_intensity_default(); - breathing_speed_default(); - breathing_halt = BREATHING_NO_HALT; -} - -/* Breathing Sleep LED brighness(PWM On period) table - * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle - * - * http://www.wolframalpha.com/input/?i=%28sin%28+x%2F64*pi%29**8+*+255%2C+x%3D0+to+63 - * (0..63).each {|x| p ((sin(x/64.0*PI)**8)*255).to_i } - */ -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) -{ - // CHANNEL = (pgm_read_byte(&breathing_table[ ( (uint8_t)( (breathing_index++) >> breath_speed ) ) & 0x3F ] )) * breath_intensity; - - - uint8_t local_index = ( (uint8_t)( (breathing_index++) >> breath_speed ) ) & 0x3F; - - if (((breathing_halt == BREATHING_HALT_ON) && (local_index == 0x20)) || ((breathing_halt == BREATHING_HALT_OFF) && (local_index == 0x3F))) - { - // Disable breathing interrupt - TIMSK1 &= ~_BV(OCIE1A); - } - - CHANNEL = (uint16_t)(((uint16_t)pgm_read_byte(&breathing_table[local_index]) * 257)) >> breath_intensity; - -} - - - -#endif \ No newline at end of file -- cgit v1.2.3-24-g4f1b