diff --git a/.gitignore b/.gitignore index 1ff0f2fa98..7c1e434e31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,10 @@ -keyboards/planck/dfu-programmer.exe .dep *.o *.eep *.elf -/*.hex -/keyboards/**/*.hex -/keyboards/**/keymaps/**/*.hex -!/keyboards/**/keymaps/**/compiled.hex +*.hex +!util/bootloader.hex +!quantum/tools/eeprom_reset.hex *.log *.lss *.lst diff --git a/Makefile b/Makefile index 93e8fc4045..ffbdf742c3 100644 --- a/Makefile +++ b/Makefile @@ -81,8 +81,7 @@ SRC += $(KEYBOARD_FILE) \ $(KEYMAP_FILE) \ $(QUANTUM_DIR)/quantum.c \ $(QUANTUM_DIR)/keymap.c \ - $(QUANTUM_DIR)/keycode_config.c \ - $(QUANTUM_DIR)/led.c + $(QUANTUM_DIR)/keycode_config.c ifndef CUSTOM_MATRIX SRC += $(QUANTUM_DIR)/matrix.c diff --git a/doc/BUILD_GUIDE.md b/doc/BUILD_GUIDE.md index c9a760107e..70a4e10fa5 100644 --- a/doc/BUILD_GUIDE.md +++ b/doc/BUILD_GUIDE.md @@ -1,4 +1,4 @@ -# Build Guide +# This guide has now been included in the main readme - please reference that one instead. ## Build Environment Setup @@ -40,7 +40,7 @@ If you have any problems building the firmware, you can try using a tool called ## Verify Your Installation 1. If you haven't already, obtain this repository ([https://github.com/jackhumbert/qmk_firmware](https://github.com/jackhumbert/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application. 2. Open up a terminal or command prompt and navigate to the `qmk_firmware` folder using the `cd` command. The command prompt will typically open to your home directory. If, for example, you cloned the repository to your Documents folder, then you would type `cd Documents/qmk_firmware`. If you extracted the file from a zip, then it may be named `qmk_firmware-master` instead. -3. To confirm that you're in the correct location, you can display the contents of your current folder using the `dir` command on Windows, or the `ls` command on Linux or Mac. You should see several files, including `README.md` and a `quantum` folder. From here, you need to navigate to the appropriate folder under `keyboards/`. For example, if you're building for a Planck, run `cd keyboards/planck`. +3. To confirm that you're in the correct location, you can display the contents of your current folder using the `dir` command on Windows, or the `ls` command on Linux or Mac. You should see several files, including `readme.md` and a `quantum` folder. From here, you need to navigate to the appropriate folder under `keyboards/`. For example, if you're building for a Planck, run `cd keyboards/planck`. 4. Once you're in the correct keyboard-specific folder, run the `make` command. This should output a lot of information about the build process. More information about the `make` command can be found below. ## Customizing, Building, and Deploying Your Firmware @@ -49,7 +49,7 @@ If you have any problems building the firmware, you can try using a tool called The `make` command is how you compile the firmware into a .hex file, which can be loaded by a dfu programmer (like dfu-progammer via `make dfu`) or the [Teensy loader](https://www.pjrc.com/teensy/loader.html) (only used with Teensys). You can run `make` from the root (`/`), your keyboard folder (`/keyboards//`), or your keymap folder (`/keyboards//keymaps//`) if you have a `Makefile` there (see the example [here](/doc/keymap_makefile_example.mk)). -By default, this will generate a `_.hex` file in whichever folder you run `make` from. These files are ignored by git, so don't worry about deleting them when committing/creating pull requests. Your .hex file will also be copied into your keymap folder as `compiled.hex`, which isn't ignored by git - this is included in case first-time users are having trouble compiling, and just want to flash a layout via `make dfu-no-build` or using the Teensy loader. +By default, this will generate a `_.hex` file in whichever folder you run `make` from. These files are ignored by git, so don't worry about deleting them when committing/creating pull requests. * The "root" (`/`) folder is the qmk_firmware folder, in which are `doc`, `keyboard`, `quantum`, etc. * The "keyboard" folder is any keyboard project's folder, like `/keyboards/planck`. @@ -63,7 +63,6 @@ Below is a list of the useful `make` commands in QMK: * `make quick` - skips the clean step (cannot be used immediately after modifying config.h or Makefiles) * `make dfu` - (requires dfu-programmer) builds and flashes the keymap to your keyboard once placed in reset/dfu mode (button or press `KC_RESET`). This does not work for Teensy-based keyboards like the ErgoDox EZ. * `keyboard=` and `keymap=` are compatible with this -* `make dfu-no-build` - (requires dfu-programmer) same as `make dfu`, but doesn't build and uses the included `compiled.hex` to flash the keyboard * `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root) * `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root) * `make all-keymaps [keyboard=]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `` diff --git a/doc/HAND_WIRE.md b/doc/HAND_WIRE.md index bb3683cb9c..18cb7011ff 100644 --- a/doc/HAND_WIRE.md +++ b/doc/HAND_WIRE.md @@ -306,7 +306,7 @@ If you've done all of these things, keep in mind that sometimes you might have h Now that you have a working board, it's time to get things in their permanent positions. I've often used liberal amounts of hot glue to secure and insulate things, so if that's your style, start spreading that stuff like butter. Otherwise, double-sided tape is always an elegant solution, and electrical tape is a distant second. Due to the nature of these builds, a lot of this part is up to you and how you planned (or didn't plan) things out. -There are a lot of possibilities inside the firmware - check out the [README](https://github.com/jackhumbert/qmk_firmware/blob/master/README.md) for a full feature list, and dive into the different project (Planck, Ergodox EZ, etc) to see how people use all of them. You can always stop by [the OLKB subreddit for help!](http://reddit.com/r/olkb) +There are a lot of possibilities inside the firmware - check out the [readme](https://github.com/jackhumbert/qmk_firmware/blob/master/readme.md) for a full feature list, and dive into the different project (Planck, Ergodox EZ, etc) to see how people use all of them. You can always stop by [the OLKB subreddit for help!](http://reddit.com/r/olkb) ## Trouble-shooting compiling diff --git a/doc/TMK_README.md b/doc/TMK_README.md index 150b4f93bf..6164dacd3c 100644 --- a/doc/TMK_README.md +++ b/doc/TMK_README.md @@ -113,7 +113,7 @@ Third party libraries like LUFA, PJRC and V-USB have their own license respectiv Build Firmware and Program Controller ------------------------------------- -See [doc/build.md](tmk_core/doc/build.md), or the README in the particular keyboards/* folder. +See [doc/build.md](tmk_core/doc/build.md), or the readme in the particular keyboards/* folder. diff --git a/doc/VAGRANT_GUIDE.md b/doc/VAGRANT_GUIDE.md index 72223e8041..62044b7f72 100644 --- a/doc/VAGRANT_GUIDE.md +++ b/doc/VAGRANT_GUIDE.md @@ -12,7 +12,7 @@ Other than having Vagrant and Virtualbox installed and possibly a restart of you Build Firmware and Program Controller ------------------------------------- -See [/doc/BUIDE_GUIDE.md](/doc/BUILD_GUIDE.md), or the README in the particular keyboards/* folder. +See [/doc/BUIDE_GUIDE.md](/doc/BUILD_GUIDE.md), or the readme in the particular keyboards/* folder. Change your keymap ------------------ diff --git a/keyboards/alps64/alps64.c b/keyboards/alps64/alps64.c index dde10c11e3..472d1d445c 100644 --- a/keyboards/alps64/alps64.c +++ b/keyboards/alps64/alps64.c @@ -20,15 +20,6 @@ along with this program. If not, see . #define LED_OFF() do { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } while (0) #define LED_TGL() do { DDRC |= (1<<5); PINC |= (1<<5); } while (0) -__attribute__ ((weak)) -void matrix_init_user(void) { - -} - -__attribute__ ((weak)) -void matrix_scan_user(void) { - -} void matrix_init_kb(void) { LED_ON(); @@ -36,8 +27,4 @@ void matrix_init_kb(void) { LED_OFF(); matrix_init_user(); -} - -void matrix_scan_kb(void) { - matrix_scan_user(); -} +} \ No newline at end of file diff --git a/keyboards/alps64/keymaps/default/compiled.hex b/keyboards/alps64/keymaps/default/compiled.hex deleted file mode 100644 index ef43410f24..0000000000 Binary files a/keyboards/alps64/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/arrow_pad/arrow_pad.c b/keyboards/arrow_pad/arrow_pad.c index f29c2c53fe..381934aa88 100644 --- a/keyboards/arrow_pad/arrow_pad.c +++ b/keyboards/arrow_pad/arrow_pad.c @@ -1,114 +1 @@ -#include "arrow_pad.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 - -#ifdef BACKLIGHT_ENABLE - backlight_init_ports(); -#endif - - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_action_kb(keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_action_user(record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - - led_set_user(usb_led); -} - -#ifdef BACKLIGHT_ENABLE -#define CHANNEL OCR1C - -void backlight_init_ports() -{ - - // Setup PB7 as output and output low. - DDRB |= (1<<7); - PORTB &= ~(1<<7); - - // Use full 16-bit resolution. - ICR1 = 0xFFFF; - - // I could write a wall of text here to explain... but TL;DW - // Go read the ATmega32u4 datasheet. - // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on - - // Pin PB7 = OCR1C (Timer 1, Channel C) - // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 - // (i.e. start high, go low when counter matches.) - // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 - // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 - - TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; - TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; - - backlight_init(); -} - -void backlight_set(uint8_t level) -{ - if ( level == 0 ) - { - // Turn off PWM control on PB7, revert to output low. - TCCR1A &= ~(_BV(COM1C1)); - CHANNEL = 0x0; - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - } - else if ( level == BACKLIGHT_LEVELS ) - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF; - } - else - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); - } -} - -#endif \ No newline at end of file +#include "arrow_pad.h" \ No newline at end of file diff --git a/keyboards/arrow_pad/arrow_pad.h b/keyboards/arrow_pad/arrow_pad.h index b3fb578e8f..62882b9b54 100644 --- a/keyboards/arrow_pad/arrow_pad.h +++ b/keyboards/arrow_pad/arrow_pad.h @@ -1,6 +1,7 @@ #ifndef ARROW_PAD_H #define ARROW_PAD_H +#include "quantum.h" #include "matrix.h" #include "keymap.h" #ifdef BACKLIGHT_ENABLE @@ -9,10 +10,4 @@ #include #include -void matrix_init_user(void); -void matrix_scan_user(void); -bool process_action_user(keyrecord_t *record); -void led_set_user(uint8_t usb_led); -void backlight_init_ports(void); - #endif diff --git a/keyboards/arrow_pad/config.h b/keyboards/arrow_pad/config.h index 9e85f3ccf6..3d8d8709a5 100644 --- a/keyboards/arrow_pad/config.h +++ b/keyboards/arrow_pad/config.h @@ -46,6 +46,8 @@ along with this program. If not, see . #define MATRIX_COL_PINS { B0, B1, B2, B3 } #define UNUSED_PINS +#define BACKLIGHT_PIN B7 + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION ROW2COL diff --git a/keyboards/arrow_pad/keymaps/default/compiled.hex b/keyboards/arrow_pad/keymaps/default/compiled.hex deleted file mode 100644 index 789eb4c3fc..0000000000 Binary files a/keyboards/arrow_pad/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/arrow_pad/keymaps/pad_21/compiled.hex b/keyboards/arrow_pad/keymaps/pad_21/compiled.hex deleted file mode 100644 index 642c9e40c8..0000000000 Binary files a/keyboards/arrow_pad/keymaps/pad_21/compiled.hex and /dev/null differ diff --git a/keyboards/arrow_pad/keymaps/pad_24/compiled.hex b/keyboards/arrow_pad/keymaps/pad_24/compiled.hex deleted file mode 100644 index 77c385adca..0000000000 Binary files a/keyboards/arrow_pad/keymaps/pad_24/compiled.hex and /dev/null differ diff --git a/keyboards/arrow_pad/keymaps/pad_24/config.h b/keyboards/arrow_pad/keymaps/pad_24/config.h index 75369c047f..e940acaa0c 100644 --- a/keyboards/arrow_pad/keymaps/pad_24/config.h +++ b/keyboards/arrow_pad/keymaps/pad_24/config.h @@ -46,6 +46,8 @@ along with this program. If not, see . #define MATRIX_COL_PINS { B0, B1, B2, B3 } #define UNUSED_PINS +#define BACKLIGHT_PIN B7 + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION ROW2COL diff --git a/keyboards/arrow_pad/README.md b/keyboards/arrow_pad/readme.md similarity index 87% rename from keyboards/arrow_pad/README.md rename to keyboards/arrow_pad/readme.md index bf9a64a452..5aa44cce54 100644 --- a/keyboards/arrow_pad/README.md +++ b/keyboards/arrow_pad/readme.md @@ -3,7 +3,7 @@ arrow_pad keyboard firmware ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Building @@ -15,7 +15,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/atomic/atomic.c b/keyboards/atomic/atomic.c index fa218a48f3..6f393315ee 100644 --- a/keyboards/atomic/atomic.c +++ b/keyboards/atomic/atomic.c @@ -1,26 +1,5 @@ #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 @@ -28,298 +7,9 @@ void matrix_init_kb(void) { 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 +} \ No newline at end of file diff --git a/keyboards/atomic/atomic.h b/keyboards/atomic/atomic.h index 901761f514..88e11fadff 100644 --- a/keyboards/atomic/atomic.h +++ b/keyboards/atomic/atomic.h @@ -24,26 +24,4 @@ { K40, K41, KC_NO, K43, KC_NO, KC_NO, K46, KC_NO, KC_NO, KC_NO, K4A, K4B, K4C, K4D, K4E } \ } -void matrix_init_user(void); -void matrix_scan_user(void); -bool process_action_user(keyrecord_t *record); -void led_set_user(uint8_t usb_led); -void backlight_init_ports(void); - -void breathing_enable(void); -void breathing_pulse(void); -void breathing_disable(void); -void breathing_self_disable(void); -void breathing_toggle(void); -bool is_breathing(void); - - -void breathing_defaults(void); -void breathing_intensity_default(void); -void breathing_speed_default(void); -void breathing_speed_set(uint8_t value); -void breathing_speed_inc(uint8_t value); -void breathing_speed_dec(uint8_t value); - - #endif \ No newline at end of file diff --git a/keyboards/atomic/config.h b/keyboards/atomic/config.h index bf9550e948..9c40f54e78 100644 --- a/keyboards/atomic/config.h +++ b/keyboards/atomic/config.h @@ -46,6 +46,8 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } #define UNUSED_PINS +#define BACKLIGHT_PIN B7 + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW diff --git a/keyboards/atomic/keymaps/default/compiled.hex b/keyboards/atomic/keymaps/default/compiled.hex deleted file mode 100644 index b9bb143ea8..0000000000 Binary files a/keyboards/atomic/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/atomic/keymaps/pvc/compiled.hex b/keyboards/atomic/keymaps/pvc/compiled.hex deleted file mode 100644 index c8cc6d8c0f..0000000000 Binary files a/keyboards/atomic/keymaps/pvc/compiled.hex and /dev/null differ diff --git a/keyboards/atomic/keymaps/pvc/config.h b/keyboards/atomic/keymaps/pvc/config.h index 1473aac34f..70353323b6 100644 --- a/keyboards/atomic/keymaps/pvc/config.h +++ b/keyboards/atomic/keymaps/pvc/config.h @@ -46,6 +46,9 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } #define UNUSED_PINS +#define BACKLIGHT_PIN B7 +#define BACKLIGHT_BREATHING + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW diff --git a/keyboards/atomic/README.md b/keyboards/atomic/readme.md similarity index 88% rename from keyboards/atomic/README.md rename to keyboards/atomic/readme.md index 9fe75f572e..ab1e7ba1ff 100644 --- a/keyboards/atomic/README.md +++ b/keyboards/atomic/readme.md @@ -4,7 +4,7 @@ DIY/Assembled ortholinear 60% keyboard by [Ortholinear Keyboards](http://ortholi ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Building @@ -16,7 +16,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a file in the keymaps folder named `.c` and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a file in the keymaps folder named `.c` and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/atreus/atreus.c b/keyboards/atreus/atreus.c index 9d1de631bb..263ec87323 100644 --- a/keyboards/atreus/atreus.c +++ b/keyboards/atreus/atreus.c @@ -1,29 +1 @@ -#include "atreus.h" - -__attribute__ ((weak)) -void matrix_init_user(void) { - // leave these blank -}; - -__attribute__ ((weak)) -void matrix_scan_user(void) { - // leave these blank -}; - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - - if (matrix_init_user) { - (*matrix_init_user)(); - } -}; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - if (matrix_scan_user) { - (*matrix_scan_user)(); - } -}; +#include "atreus.h" \ No newline at end of file diff --git a/keyboards/atreus/atreus.h b/keyboards/atreus/atreus.h index 10712d26d8..2b3803bc21 100644 --- a/keyboards/atreus/atreus.h +++ b/keyboards/atreus/atreus.h @@ -1,8 +1,8 @@ #ifndef ATREUS_H #define ATREUS_H +#include "quantum.h" #include "matrix.h" -#include "keymap.h" #include "backlight.h" #include @@ -22,7 +22,4 @@ { k2a, k30, k31, k32, k33, k34, k36, k37, k38, k39, k3a } \ } -void matrix_init_user(void); -void matrix_scan_user(void); - #endif diff --git a/keyboards/atreus/keymaps/default/compiled.hex b/keyboards/atreus/keymaps/default/compiled.hex deleted file mode 100644 index a455e04de9..0000000000 Binary files a/keyboards/atreus/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/atreus/keymaps/gerb/compiled.hex b/keyboards/atreus/keymaps/gerb/compiled.hex deleted file mode 100644 index 963a83ad7c..0000000000 Binary files a/keyboards/atreus/keymaps/gerb/compiled.hex and /dev/null differ diff --git a/keyboards/atreus/README.md b/keyboards/atreus/readme.md similarity index 99% rename from keyboards/atreus/README.md rename to keyboards/atreus/readme.md index 86e6e1f0c9..734f58f0f0 100644 --- a/keyboards/atreus/README.md +++ b/keyboards/atreus/readme.md @@ -177,7 +177,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/bantam44/bantam44.c b/keyboards/bantam44/bantam44.c index 5d507adc3a..f995308ae7 100644 --- a/keyboards/bantam44/bantam44.c +++ b/keyboards/bantam44/bantam44.c @@ -1,25 +1 @@ -#include "bantam44.h" - -__attribute__ ((weak)) -void matrix_init_user(void) { - // leave these blank -} - -__attribute__ ((weak)) -void matrix_scan_user(void) { - // leave these blank -} - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} +#include "bantam44.h" \ No newline at end of file diff --git a/keyboards/bantam44/bantam44.h b/keyboards/bantam44/bantam44.h index 8e776d63b0..3c01174348 100644 --- a/keyboards/bantam44/bantam44.h +++ b/keyboards/bantam44/bantam44.h @@ -1,10 +1,7 @@ #ifndef BANTAM44_H #define BANTAM44_H -#include "matrix.h" -#include "keymap.h" -#include "backlight.h" -#include +#include "quantum.h" // This a shortcut to help you visually see your layout. // The following is an example using the Planck MIT layout @@ -23,7 +20,4 @@ { K30, K31, K32, KC_NO, K33, KC_NO, K34, KC_NO, K35, K36, K37, K38 }, \ } -void matrix_init_user(void); -void matrix_scan_user(void); - #endif diff --git a/keyboards/bantam44/keymaps/default/compiled.hex b/keyboards/bantam44/keymaps/default/compiled.hex deleted file mode 100644 index df7fc1b9c4..0000000000 Binary files a/keyboards/bantam44/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/bantam44/README.md b/keyboards/bantam44/readme.md similarity index 86% rename from keyboards/bantam44/README.md rename to keyboards/bantam44/readme.md index a571e3d447..89d7f9d053 100644 --- a/keyboards/bantam44/README.md +++ b/keyboards/bantam44/readme.md @@ -3,7 +3,7 @@ Bantam44 keyboard firmware ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Building @@ -15,7 +15,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/clueboard1/Makefile b/keyboards/clueboard1/Makefile index 98ad148c71..a2599d2143 100644 --- a/keyboards/clueboard1/Makefile +++ b/keyboards/clueboard1/Makefile @@ -1,8 +1,5 @@ -# # project specific files -SRC = led.c - # MCU name MCU = atmega32u4 diff --git a/keyboards/clueboard1/clueboard1.c b/keyboards/clueboard1/clueboard1.c index 136ddf15b5..5785f447f0 100644 --- a/keyboards/clueboard1/clueboard1.c +++ b/keyboards/clueboard1/clueboard1.c @@ -1,19 +1,12 @@ #include "clueboard1.h" -__attribute__ ((weak)) -void matrix_init_user(void) { - // leave these blank -} - -__attribute__ ((weak)) -void matrix_scan_user(void) { - // leave these blank -} - -void matrix_init_kb(void) { - matrix_init_user(); -} - -void matrix_scan_kb(void) { - matrix_scan_user(); +void led_set_kb(uint8_t usb_led) { + DDRF |= (1<<0); + if (usb_led & (1< +#include "quantum.h" /* Clueboard matrix layout @@ -46,7 +44,4 @@ { k40, k41, k42, k43, KC_NO, k45, k46, KC_NO, KC_NO, k49, k4A, k4B, k4C, k4D, k4E, k4F } \ } -void matrix_init_user(void); -void matrix_scan_user(void); - #endif diff --git a/keyboards/clueboard1/keymaps/default/compiled.hex b/keyboards/clueboard1/keymaps/default/compiled.hex deleted file mode 100644 index 31008c426e..0000000000 Binary files a/keyboards/clueboard1/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/clueboard1/led.c b/keyboards/clueboard1/led.c deleted file mode 100644 index f0dd5662d5..0000000000 --- a/keyboards/clueboard1/led.c +++ /dev/null @@ -1,32 +0,0 @@ - /* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include "stdint.h" -#include "led.h" - - -void led_set_kb(uint8_t usb_led) { - DDRF |= (1<<0); - if (usb_led & (1< -#include "backlight.h" -#include "print.h" - -/* Clueboard 2.0 LED locations: - * - * Capslock: B4, pull high to turn on - * LCtrl: Shared with Capslock, DO NOT INSTALL LED'S IN BOTH - * Page Up: B7, pull high to turn on - * Escape: D6, pull high to turn on - * Arrows: D4, pull high to turn on - */ - -void init_backlight_pin(void) { - print("init_backlight_pin()\n"); - // Set our LED pins as output - DDRD |= (1<<6); // Esc - DDRB |= (1<<7); // Page Up - DDRD |= (1<<4); // Arrows - - // Set our LED pins low - PORTD &= ~(1<<6); // Esc - PORTB &= ~(1<<7); // Page Up - PORTD &= ~(1<<4); // Arrows -} - -void backlight_set(uint8_t level) { - if ( level == 0 ) { - // Turn off light - PORTD |= (1<<6); // Esc - PORTB |= (1<<7); // Page Up - PORTD |= (1<<4); // Arrows - } else { - // Turn on light - PORTD &= ~(1<<6); // Esc - PORTB &= ~(1<<7); // Page Up - PORTD &= ~(1<<4); // Arrows - } -} - diff --git a/keyboards/clueboard2/clueboard2.c b/keyboards/clueboard2/clueboard2.c index 8493c564c8..d78ffed9ba 100644 --- a/keyboards/clueboard2/clueboard2.c +++ b/keyboards/clueboard2/clueboard2.c @@ -1,40 +1,63 @@ #include "clueboard2.h" -#ifdef BACKLIGHT_ENABLE -#include "backlight.h" -#endif - -__attribute__ ((weak)) -void matrix_init_user(void) { - // leave these blank -}; - -__attribute__ ((weak)) -void matrix_scan_user(void) { - // leave these blank -}; - void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - if (matrix_init_user) { - (*matrix_init_user)(); - } + matrix_init_user(); led_init_ports(); - #ifdef BACKLIGHT_ENABLE - init_backlight_pin(); - #endif - // JTAG disable for PORT F. write JTD bit twice within four cycles. MCUCR |= (1< +#include "quantum.h" /* Clueboard matrix layout @@ -51,7 +49,4 @@ { k90, KC_NO, k92, k93, k94, k95, k96, k97 } \ } -void matrix_init_user(void); -void matrix_scan_user(void); - #endif diff --git a/keyboards/clueboard2/keymaps/default/compiled.hex b/keyboards/clueboard2/keymaps/default/compiled.hex deleted file mode 100644 index c737eb3c67..0000000000 Binary files a/keyboards/clueboard2/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/clueboard2/keymaps/default/keymap.c b/keyboards/clueboard2/keymaps/default/keymap.c index 73179f94cd..1795e68cda 100644 --- a/keyboards/clueboard2/keymaps/default/keymap.c +++ b/keyboards/clueboard2/keymaps/default/keymap.c @@ -1,9 +1,5 @@ #include "clueboard2.h" -#ifdef RGBLIGHT_ENABLE -#include "rgblight.h" -#endif - // Used for SHIFT_ESC #define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) diff --git a/keyboards/clueboard2/keymaps/max/compiled.hex b/keyboards/clueboard2/keymaps/max/compiled.hex deleted file mode 100644 index be12cd2190..0000000000 Binary files a/keyboards/clueboard2/keymaps/max/compiled.hex and /dev/null differ diff --git a/keyboards/clueboard2/keymaps/max/keymap.c b/keyboards/clueboard2/keymaps/max/keymap.c index 714d6390d9..65a101c2b5 100644 --- a/keyboards/clueboard2/keymaps/max/keymap.c +++ b/keyboards/clueboard2/keymaps/max/keymap.c @@ -1,9 +1,5 @@ #include "clueboard2.h" -#ifdef ENABLE_RGBLIGHT -#include "rgblight.h" -#endif - // Used for SHIFT_ESC #define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) diff --git a/keyboards/clueboard2/keymaps/skully/compiled.hex b/keyboards/clueboard2/keymaps/skully/compiled.hex deleted file mode 100644 index a8423a2cce..0000000000 Binary files a/keyboards/clueboard2/keymaps/skully/compiled.hex and /dev/null differ diff --git a/keyboards/clueboard2/led.c b/keyboards/clueboard2/led.c deleted file mode 100644 index 3d074e5d20..0000000000 --- a/keyboards/clueboard2/led.c +++ /dev/null @@ -1,36 +0,0 @@ - /* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include "stdint.h" -#include "led.h" - - -void led_init_ports() { - // * Set our LED pins as output - DDRB |= (1<<4); -} - -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1< +#include "quantum.h" +#include "led.h" /* GH60 LEDs * GPIO pads @@ -73,9 +71,4 @@ inline void gh60_wasd_leds_off(void) { DDRF &= ~(1<<7); PORTF &= ~(1<<7); } K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \ ) -void matrix_init_user(void); -void matrix_scan_user(void); -bool process_action_user(keyrecord_t *record); -void led_set_user(uint8_t usb_led); - #endif diff --git a/keyboards/gh60/keymaps/default/compiled.hex b/keyboards/gh60/keymaps/default/compiled.hex deleted file mode 100644 index 5c253e970a..0000000000 Binary files a/keyboards/gh60/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/gh60/README.md b/keyboards/gh60/readme.md similarity index 89% rename from keyboards/gh60/README.md rename to keyboards/gh60/readme.md index 35c13375ce..92302d507c 100644 --- a/keyboards/gh60/README.md +++ b/keyboards/gh60/readme.md @@ -39,7 +39,7 @@ Functions to controls LED clusters ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Building @@ -51,7 +51,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/hhkb/hhkb.c b/keyboards/hhkb/hhkb.c index 6897026c6c..a9d35123ff 100644 --- a/keyboards/hhkb/hhkb.c +++ b/keyboards/hhkb/hhkb.c @@ -1,29 +1 @@ -#include "hhkb.h" - -__attribute__ ((weak)) -void matrix_init_user(void) { - // leave these blank -}; - -__attribute__ ((weak)) -void matrix_scan_user(void) { - // leave these blank -}; - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - - if (matrix_init_user) { - (*matrix_init_user)(); - } -}; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - if (matrix_scan_user) { - (*matrix_scan_user)(); - } -}; +#include "hhkb.h" \ No newline at end of file diff --git a/keyboards/hhkb/hhkb.h b/keyboards/hhkb/hhkb.h index 093d7aeabc..cc756c4565 100644 --- a/keyboards/hhkb/hhkb.h +++ b/keyboards/hhkb/hhkb.h @@ -1,10 +1,7 @@ #ifndef HHKB_H #define HHKB_H -#include "matrix.h" -#include "keymap.h" -//#include "backlight.h" -#include +#include "quantum.h" #define KEYMAP( \ K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \ @@ -24,7 +21,4 @@ { K70, K71, K72, K73, K74, K75, K76, KC_NO } \ } -void matrix_init_user(void); -void matrix_scan_user(void); - #endif diff --git a/keyboards/hhkb/keymaps/default/compiled.hex b/keyboards/hhkb/keymaps/default/compiled.hex deleted file mode 100644 index b3af695270..0000000000 Binary files a/keyboards/hhkb/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/hhkb/keymaps/lxol/compiled.hex b/keyboards/hhkb/keymaps/lxol/compiled.hex deleted file mode 100644 index 63d3691c4d..0000000000 Binary files a/keyboards/hhkb/keymaps/lxol/compiled.hex and /dev/null differ diff --git a/keyboards/hhkb/README.md b/keyboards/hhkb/readme.md similarity index 99% rename from keyboards/hhkb/README.md rename to keyboards/hhkb/readme.md index 2bfec7aa54..39d49b32a1 100644 --- a/keyboards/hhkb/README.md +++ b/keyboards/hhkb/readme.md @@ -171,7 +171,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a file in the keymaps folder named `.c` and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a file in the keymaps folder named `.c` and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/jd45/config.h b/keyboards/jd45/config.h index ffedb6a1a9..ee989b7b41 100644 --- a/keyboards/jd45/config.h +++ b/keyboards/jd45/config.h @@ -37,6 +37,8 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F4, D7, B5, B6, C6, C7, D4, D6, D5, D0, D1, D2, B0 } #define UNUSED_PINS +#define BACKLIGHT_PIN B7 + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW diff --git a/keyboards/jd45/jd45.c b/keyboards/jd45/jd45.c index 5437b2bffc..00c5810479 100644 --- a/keyboards/jd45/jd45.c +++ b/keyboards/jd45/jd45.c @@ -1,81 +1 @@ -#include "jd45.h" - -__attribute__ ((weak)) -void matrix_init_user(void) { - -}; - -__attribute__ ((weak)) -void matrix_scan_user(void) { - -}; - -#define CHANNEL OCR1C - -void backlight_init_ports(void) -{ - - // Setup PB7 as output and output low. - DDRB |= (1<<7); - PORTB &= ~(1<<7); - - // Use full 16-bit resolution. - ICR1 = 0xFFFF; - - // I could write a wall of text here to explain... but TL;DW - // Go read the ATmega32u4 datasheet. - // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on - - // Pin PB7 = OCR1C (Timer 1, Channel C) - // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 - // (i.e. start high, go low when counter matches.) - // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 - // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 - - TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; - TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; - - backlight_init(); -} - -void backlight_set(uint8_t level) -{ - if ( level == 0 ) - { - // Turn off PWM control on PB7, revert to output low. - TCCR1A &= ~(_BV(COM1C1)); - CHANNEL = 0x0; - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - } - else if ( level == BACKLIGHT_LEVELS ) - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF; - } - else - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); - } -} - -void matrix_init_kb(void) { - #ifdef BACKLIGHT_ENABLE - backlight_init_ports(); - #endif - - matrix_init_user(); -}; - -void matrix_scan_kb(void) { - matrix_scan_user(); -}; +#include "jd45.h" \ No newline at end of file diff --git a/keyboards/jd45/jd45.h b/keyboards/jd45/jd45.h index 1e9de2123b..04ac6649e7 100644 --- a/keyboards/jd45/jd45.h +++ b/keyboards/jd45/jd45.h @@ -1,13 +1,20 @@ #ifndef JD45_H #define JD45_H -#include "matrix.h" -#include "keymap.h" -#include "backlight.h" -#include -#include +#include "quantum.h" -void matrix_init_user(void); -void matrix_scan_user(void); +/* JD45 keymap definition macro + */ +#define KEYMAP( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, K13, \ + K14, K15, K16, K17, K18, K19, K20, K21, K22, K23, K24, K25, \ + K26, K27, K28, K29, K30, K31, K32, K33, K34, K35, K36, K37, \ + K38, K39, K40, K41, K42, K43, K44, K45, K46, K47 \ +) { \ + { KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K10, KC_##K11, KC_##K12, KC_##K13 }, \ + { KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_NO }, \ + { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_NO }, \ + { KC_##K38, KC_##K39, KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_##K43, KC_NO, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_NO } \ +} #endif diff --git a/keyboards/jd45/keymaps/default/compiled.hex b/keyboards/jd45/keymaps/default/compiled.hex deleted file mode 100644 index cc20ee3c53..0000000000 Binary files a/keyboards/jd45/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/jd45/keymaps/default/keymap.c b/keyboards/jd45/keymaps/default/keymap.c index 05dd46e792..95abb1505c 100644 --- a/keyboards/jd45/keymaps/default/keymap.c +++ b/keyboards/jd45/keymaps/default/keymap.c @@ -1,22 +1,8 @@ #include "jd45.h" -#include "backlight.h" /* this keymap is to provide a basic keyboard layout for testing the matrix * for more practical and complicated keymap refer to other keymaps in the same folder */ -/* JD45 keymap definition macro - */ -#define KEYMAP( \ - K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, K13, \ - K14, K15, K16, K17, K18, K19, K20, K21, K22, K23, K24, K25, \ - K26, K27, K28, K29, K30, K31, K32, K33, K34, K35, K36, K37, \ - K38, K39, K40, K41, K42, K43, K44, K45, K46, K47 \ -) { \ - { KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K10, KC_##K11, KC_##K12, KC_##K13 }, \ - { KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_NO }, \ - { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_NO }, \ - { KC_##K38, KC_##K39, KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_##K43, KC_NO, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_NO } \ -} const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = KEYMAP( diff --git a/keyboards/jd45/keymaps/justin/compiled.hex b/keyboards/jd45/keymaps/justin/compiled.hex deleted file mode 100644 index 3f0ab6524b..0000000000 Binary files a/keyboards/jd45/keymaps/justin/compiled.hex and /dev/null differ diff --git a/keyboards/jd45/keymaps/justin/keymap.c b/keyboards/jd45/keymaps/justin/keymap.c index f261b54633..c278abba55 100644 --- a/keyboards/jd45/keymaps/justin/keymap.c +++ b/keyboards/jd45/keymaps/justin/keymap.c @@ -1,19 +1,4 @@ #include "jd45.h" -#include "backlight.h" - -/* JD45 keymap definition macro - */ -#define KEYMAP( \ - K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, K13, \ - K14, K15, K16, K17, K18, K19, K20, K21, K22, K23, K24, K25, \ - K26, K27, K28, K29, K30, K31, K32, K33, K34, K35, K36, K37, \ - K38, K39, K40, K41, K42, K43, K44, K45, K46, K47 \ -) { \ - { KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K10, KC_##K11, KC_##K12, KC_##K13 }, \ - { KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_NO }, \ - { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_NO }, \ - { KC_##K38, KC_##K39, KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_##K43, KC_NO, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_NO } \ -} const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = KEYMAP( diff --git a/keyboards/kc60/config.h b/keyboards/kc60/config.h index 91d4e09c2e..c4a9b9ff82 100644 --- a/keyboards/kc60/config.h +++ b/keyboards/kc60/config.h @@ -50,6 +50,8 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3 } #define UNUSED_PINS +#define BACKLIGHT_PIN B6 + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW diff --git a/keyboards/kc60/kc60.c b/keyboards/kc60/kc60.c index 0a578b2b88..746ac634a3 100644 --- a/keyboards/kc60/kc60.c +++ b/keyboards/kc60/kc60.c @@ -1,111 +1 @@ #include "kc60.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 - -#ifdef BACKLIGHT_ENABLE - backlight_init_ports(); -#endif - - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_action_kb(keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_action_user(record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - - led_set_user(usb_led); -} - -#ifdef BACKLIGHT_ENABLE -#define CHANNEL OCR1B - -void backlight_init_ports() -{ - - // Setup PB6 as output and output low. - DDRB |= (1<<6); - PORTB &= ~(1<<6); - - // Use full 16-bit resolution. - ICR1 = 0xFFFF; - - // I could write a wall of text here to explain... but TL;DW - // Go read the ATmega32u4 datasheet. - // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on - - // Pin PB7 = OCR1C (Timer 1, Channel C) - // Compare Output Mode = Clear on compare match, Channel C = COM1B1=1 COM1C0=0 - // (i.e. start high, go low when counter matches.) - // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 - // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 - - TCCR1A = _BV(COM1B1) | _BV(WGM11); // = 0b00001010; - TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; - - backlight_init(); -} - -void backlight_set(uint8_t level) -{ - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB6)); - - if ( level == 0 ) - { - // Turn off PWM control on PB6, revert to output low. - TCCR1A &= ~(_BV(COM1B1)); - CHANNEL = 0x0; - } - else if ( level == BACKLIGHT_LEVELS) - { - // Turn on PWM control of PB6 - TCCR1A |= _BV(COM1B1); - // Set the brightness - CHANNEL = 0xFFFF; - } - else - { - // Turn on PWM control of PB6 - TCCR1A |= _BV(COM1B1); - // Set the brightness - CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); - } -} - -#endif diff --git a/keyboards/kc60/kc60.h b/keyboards/kc60/kc60.h index a54edfef47..34eab4b2a0 100644 --- a/keyboards/kc60/kc60.h +++ b/keyboards/kc60/kc60.h @@ -1,13 +1,7 @@ #ifndef KC60_H #define KC60_H -#include "matrix.h" -#include "keymap.h" -#ifdef BACKLIGHT_ENABLE -#include "backlight.h" -#endif -#include -#include +#include "quantum.h" // This a shortcut to help you visually see your layout. // The first section contains all of the arguements @@ -26,11 +20,4 @@ { K40, K41, K42, KC_NO, KC_NO, K45, KC_NO, KC_NO, KC_NO, KC_NO,K4A, K4B, K4C, K4D } \ } -void matrix_init_user(void); -void matrix_scan_user(void); -bool process_action_user(keyrecord_t *record); - -void led_set_user(uint8_t usb_led); -void backlight_init_ports(void); - #endif diff --git a/keyboards/kc60/keymaps/default/compiled.hex b/keyboards/kc60/keymaps/default/compiled.hex deleted file mode 100644 index c8233506df..0000000000 Binary files a/keyboards/kc60/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/kc60/keymaps/sgoodwin/compiled.hex b/keyboards/kc60/keymaps/sgoodwin/compiled.hex deleted file mode 100644 index 0d9a356f7d..0000000000 Binary files a/keyboards/kc60/keymaps/sgoodwin/compiled.hex and /dev/null differ diff --git a/keyboards/kc60/keymaps/stanleylai/compiled.hex b/keyboards/kc60/keymaps/stanleylai/compiled.hex deleted file mode 100644 index b65c14cd40..0000000000 Binary files a/keyboards/kc60/keymaps/stanleylai/compiled.hex and /dev/null differ diff --git a/keyboards/kc60/keymaps/stanleylai/README.md b/keyboards/kc60/keymaps/stanleylai/readme.md similarity index 92% rename from keyboards/kc60/keymaps/stanleylai/README.md rename to keyboards/kc60/keymaps/stanleylai/readme.md index a7daa6e77f..1db72610d4 100644 --- a/keyboards/kc60/keymaps/stanleylai/README.md +++ b/keyboards/kc60/keymaps/stanleylai/readme.md @@ -4,7 +4,7 @@ Stanley Lai's Split Right Shift with Dedicated Arrow Keys ![Image of KC60 with RGB Underglow](../ws2812/ws2812_example.jpg) ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Keymap Notes - Keymap setup with split Right Shift in mind. diff --git a/keyboards/kc60/keymaps/ws2812/compiled.hex b/keyboards/kc60/keymaps/ws2812/compiled.hex deleted file mode 100644 index c9580d3c67..0000000000 Binary files a/keyboards/kc60/keymaps/ws2812/compiled.hex and /dev/null differ diff --git a/keyboards/kc60/keymaps/ws2812/README.md b/keyboards/kc60/keymaps/ws2812/readme.md similarity index 89% rename from keyboards/kc60/keymaps/ws2812/README.md rename to keyboards/kc60/keymaps/ws2812/readme.md index af76f7ab18..5588fd2d97 100644 --- a/keyboards/kc60/keymaps/ws2812/README.md +++ b/keyboards/kc60/keymaps/ws2812/readme.md @@ -4,7 +4,7 @@ KC60 with WS2812 RGB Underglow ![Image of KC60 with RGB Underglow](ws2812_example.jpg) ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## WS2812 Support By default, it is now setup for 16 LEDs on the PF5 breakout pin. See [included image](ws2812_wiring.jpg) for wiring reference. diff --git a/keyboards/kc60/README.md b/keyboards/kc60/readme.md similarity index 88% rename from keyboards/kc60/README.md rename to keyboards/kc60/readme.md index 1f03e200e4..acc0df68dc 100644 --- a/keyboards/kc60/README.md +++ b/keyboards/kc60/readme.md @@ -2,7 +2,7 @@ KC60 (version 2.0) keyboard firmware ====================== ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Building Download or clone the whole firmware and navigate to the keyboards/kc60 folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file. @@ -13,7 +13,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/phantom/keymaps/default/compiled.hex b/keyboards/phantom/keymaps/default/compiled.hex deleted file mode 100644 index 5ee1e08d93..0000000000 Binary files a/keyboards/phantom/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/phantom/phantom.c b/keyboards/phantom/phantom.c index 30fef63c68..d53af491fe 100644 --- a/keyboards/phantom/phantom.c +++ b/keyboards/phantom/phantom.c @@ -1,25 +1,9 @@ #include "phantom.h" #include "led.h" -__attribute__ ((weak)) -void matrix_init_user(void) { - // leave these blank -}; - -__attribute__ ((weak)) -void matrix_scan_user(void) { - // leave these blank -}; - void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up matrix_init_user(); led_init_ports(); }; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - matrix_scan_user(); -}; diff --git a/keyboards/phantom/phantom.h b/keyboards/phantom/phantom.h index d7eb8c5a3d..420826becf 100644 --- a/keyboards/phantom/phantom.h +++ b/keyboards/phantom/phantom.h @@ -1,10 +1,7 @@ #ifndef PHANTOM_H #define PHANTOM_H -#include "matrix.h" -#include "keymap.h" -#include -#include "action_util.h" +#include "quantum.h" /* Phantom matrix layout * ,-----------------------------------------------------------------------------. @@ -40,7 +37,4 @@ {k50, k51, k52, k57, k57, k57, k57, k57, k57, k57, k5a, k5b, k5c, k5d, k5e, k5f, k5g} \ } -void matrix_init_user(void); -void matrix_scan_user(void); - #endif diff --git a/keyboards/planck/.gitignore b/keyboards/planck/.gitignore deleted file mode 100644 index 6e92f57d46..0000000000 --- a/keyboards/planck/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tags diff --git a/keyboards/planck/config.h b/keyboards/planck/config.h index b648931081..da2b000f63 100644 --- a/keyboards/planck/config.h +++ b/keyboards/planck/config.h @@ -37,6 +37,8 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } #define UNUSED_PINS +#define BACKLIGHT_PIN B7 + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -59,15 +61,6 @@ along with this program. If not, see . keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ ) -/* ws2812 RGB LED */ -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD -#define ws2812_pin PD1 -#define RGBLED_NUM 28 // Number of LEDs -#define RGBLIGHT_HUE_STEP 10 -#define RGBLIGHT_SAT_STEP 17 -#define RGBLIGHT_VAL_STEP 17 - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/planck/keymaps/.gitignore b/keyboards/planck/keymaps/.gitignore deleted file mode 100644 index 24e5b0a1ae..0000000000 --- a/keyboards/planck/keymaps/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.build diff --git a/keyboards/planck/keymaps/ab/compiled.hex b/keyboards/planck/keymaps/ab/compiled.hex deleted file mode 100644 index 1723c4612a..0000000000 Binary files a/keyboards/planck/keymaps/ab/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/ab/README.md b/keyboards/planck/keymaps/ab/readme.md similarity index 100% rename from keyboards/planck/keymaps/ab/README.md rename to keyboards/planck/keymaps/ab/readme.md diff --git a/keyboards/planck/keymaps/alexey/compiled.hex b/keyboards/planck/keymaps/alexey/compiled.hex deleted file mode 100644 index deddcea06a..0000000000 Binary files a/keyboards/planck/keymaps/alexey/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/angerthosenear/compiled.hex b/keyboards/planck/keymaps/angerthosenear/compiled.hex deleted file mode 100644 index b584d6a935..0000000000 Binary files a/keyboards/planck/keymaps/angerthosenear/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/austin/compiled.hex b/keyboards/planck/keymaps/austin/compiled.hex deleted file mode 100644 index fcd925dae0..0000000000 Binary files a/keyboards/planck/keymaps/austin/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/basic/compiled.hex b/keyboards/planck/keymaps/basic/compiled.hex deleted file mode 100644 index a4d94b6c4f..0000000000 Binary files a/keyboards/planck/keymaps/basic/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/basic/README.md b/keyboards/planck/keymaps/basic/readme.md similarity index 100% rename from keyboards/planck/keymaps/basic/README.md rename to keyboards/planck/keymaps/basic/readme.md diff --git a/keyboards/planck/keymaps/bone2planck/compiled.hex b/keyboards/planck/keymaps/bone2planck/compiled.hex deleted file mode 100644 index 0d5287b3ee..0000000000 Binary files a/keyboards/planck/keymaps/bone2planck/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/brandon/compiled.hex b/keyboards/planck/keymaps/brandon/compiled.hex deleted file mode 100644 index 2b6bb328df..0000000000 Binary files a/keyboards/planck/keymaps/brandon/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/cbbrowne/.gitignore b/keyboards/planck/keymaps/cbbrowne/.gitignore deleted file mode 100644 index 0cf0c6cc56..0000000000 --- a/keyboards/planck/keymaps/cbbrowne/.gitignore +++ /dev/null @@ -1 +0,0 @@ -compiled.hex diff --git a/keyboards/planck/keymaps/charlie/compiled.hex b/keyboards/planck/keymaps/charlie/compiled.hex deleted file mode 100644 index 335b49d898..0000000000 Binary files a/keyboards/planck/keymaps/charlie/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/daniel/compiled.hex b/keyboards/planck/keymaps/daniel/compiled.hex deleted file mode 100644 index d7e56a3e22..0000000000 Binary files a/keyboards/planck/keymaps/daniel/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/david/compiled.hex b/keyboards/planck/keymaps/david/compiled.hex deleted file mode 100644 index c78779128e..0000000000 Binary files a/keyboards/planck/keymaps/david/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/default/compiled.hex b/keyboards/planck/keymaps/default/compiled.hex deleted file mode 100644 index b7465d0998..0000000000 Binary files a/keyboards/planck/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c index 3d62898171..4bca1b5ac0 100644 --- a/keyboards/planck/keymaps/default/keymap.c +++ b/keyboards/planck/keymaps/default/keymap.c @@ -154,7 +154,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+-------------+------+------+------+------+------| * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' @@ -194,92 +194,92 @@ void persistant_default_layer_set(uint16_t default_layer) { const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - switch(id) { - case _QWERTY: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); - #endif - persistant_default_layer_set(1UL<<_QWERTY); - } - break; - case _COLEMAK: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_colemak, false, 0); - #endif - persistant_default_layer_set(1UL<<_COLEMAK); - } - break; - case _DVORAK: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dvorak, false, 0); - #endif - persistant_default_layer_set(1UL<<_DVORAK); - } - break; - case _LOWER: - if (record->event.pressed) { - layer_on(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - break; - case _RAISE: - if (record->event.pressed) { - layer_on(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - break; - case M_BL: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - } else { - unregister_code(KC_RSFT); - } - break; - case 12: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - stop_all_notes(); - PLAY_NOTE_ARRAY(tone_plover, false, 0); - #endif - layer_off(_RAISE); - layer_off(_LOWER); - layer_off(_ADJUST); - layer_on(_PLOVER); - if (!eeconfig_is_enabled()) { - eeconfig_init(); - } - keymap_config.raw = eeconfig_read_keymap(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - break; - case 13: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); - #endif - layer_off(_PLOVER); - } - break; - case 14: - if (record->event.pressed) { - return MACRO( D(E), D(R), D(F), D(V), D(O), D(L), U(E), U(R), U(F), U(V), U(O), U(L), END ); - } - break; + switch(id) { + case _QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); } - return MACRO_NONE; + break; + case _COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistant_default_layer_set(1UL<<_COLEMAK); + } + break; + case _DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + persistant_default_layer_set(1UL<<_DVORAK); + } + break; + case _LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + break; + case _RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + break; + case M_BL: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + break; + case 12: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_NOTE_ARRAY(tone_plover, false, 0); + #endif + layer_off(_RAISE); + layer_off(_LOWER); + layer_off(_ADJUST); + layer_on(_PLOVER); + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + break; + case 13: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); + #endif + layer_off(_PLOVER); + } + break; + case 14: + if (record->event.pressed) { + return MACRO( D(E), D(R), D(F), D(V), D(O), D(L), U(E), U(R), U(F), U(V), U(O), U(L), END ); + } + break; + } + return MACRO_NONE; }; void matrix_init_user(void) { diff --git a/keyboards/planck/keymaps/default/README.md b/keyboards/planck/keymaps/default/readme.md similarity index 100% rename from keyboards/planck/keymaps/default/README.md rename to keyboards/planck/keymaps/default/readme.md diff --git a/keyboards/planck/keymaps/dzobert/compiled.hex b/keyboards/planck/keymaps/dzobert/compiled.hex deleted file mode 100644 index cb3972bc01..0000000000 Binary files a/keyboards/planck/keymaps/dzobert/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/experimental/compiled.hex b/keyboards/planck/keymaps/experimental/compiled.hex deleted file mode 100644 index 8400506996..0000000000 Binary files a/keyboards/planck/keymaps/experimental/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/experimental/README.md b/keyboards/planck/keymaps/experimental/readme.md similarity index 100% rename from keyboards/planck/keymaps/experimental/README.md rename to keyboards/planck/keymaps/experimental/readme.md diff --git a/keyboards/planck/keymaps/gabriel/compiled.hex b/keyboards/planck/keymaps/gabriel/compiled.hex deleted file mode 100644 index 93d8502845..0000000000 Binary files a/keyboards/planck/keymaps/gabriel/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/jacob/compiled.hex b/keyboards/planck/keymaps/jacob/compiled.hex deleted file mode 100644 index b823d6da9e..0000000000 Binary files a/keyboards/planck/keymaps/jacob/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/joe/compiled.hex b/keyboards/planck/keymaps/joe/compiled.hex deleted file mode 100644 index 865ed2ce99..0000000000 Binary files a/keyboards/planck/keymaps/joe/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/kyle/compiled.hex b/keyboards/planck/keymaps/kyle/compiled.hex deleted file mode 100644 index 9226d4c19b..0000000000 Binary files a/keyboards/planck/keymaps/kyle/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/leo/compiled.hex b/keyboards/planck/keymaps/leo/compiled.hex deleted file mode 100644 index 4bfe15bd09..0000000000 Binary files a/keyboards/planck/keymaps/leo/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/lucas/compiled.hex b/keyboards/planck/keymaps/lucas/compiled.hex deleted file mode 100644 index 13e872aa6d..0000000000 Binary files a/keyboards/planck/keymaps/lucas/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/lukas/compiled.hex b/keyboards/planck/keymaps/lukas/compiled.hex deleted file mode 100644 index 2cd3bc5228..0000000000 Binary files a/keyboards/planck/keymaps/lukas/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/max/compiled.hex b/keyboards/planck/keymaps/max/compiled.hex deleted file mode 100644 index d9594415fb..0000000000 Binary files a/keyboards/planck/keymaps/max/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/mollat/compiled.hex b/keyboards/planck/keymaps/mollat/compiled.hex deleted file mode 100644 index 549b7a8dfa..0000000000 Binary files a/keyboards/planck/keymaps/mollat/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/nico/compiled.hex b/keyboards/planck/keymaps/nico/compiled.hex deleted file mode 100644 index 61527c5307..0000000000 Binary files a/keyboards/planck/keymaps/nico/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/pete/compiled.hex b/keyboards/planck/keymaps/pete/compiled.hex deleted file mode 100644 index c1fa436ba4..0000000000 Binary files a/keyboards/planck/keymaps/pete/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/pete/README.md b/keyboards/planck/keymaps/pete/readme.md similarity index 100% rename from keyboards/planck/keymaps/pete/README.md rename to keyboards/planck/keymaps/pete/readme.md diff --git a/keyboards/planck/keymaps/pvc/compiled.hex b/keyboards/planck/keymaps/pvc/compiled.hex deleted file mode 100644 index 9e6f0ffe20..0000000000 Binary files a/keyboards/planck/keymaps/pvc/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/README.md b/keyboards/planck/keymaps/readme.md similarity index 100% rename from keyboards/planck/keymaps/README.md rename to keyboards/planck/keymaps/readme.md diff --git a/keyboards/planck/keymaps/tak3over/compiled.hex b/keyboards/planck/keymaps/tak3over/compiled.hex deleted file mode 100644 index 0eec0b65c7..0000000000 Binary files a/keyboards/planck/keymaps/tak3over/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/unicode/compiled.hex b/keyboards/planck/keymaps/unicode/compiled.hex deleted file mode 100644 index ad95012764..0000000000 Binary files a/keyboards/planck/keymaps/unicode/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/yang/compiled.hex b/keyboards/planck/keymaps/yang/compiled.hex deleted file mode 100644 index da6b0017a1..0000000000 Binary files a/keyboards/planck/keymaps/yang/compiled.hex and /dev/null differ diff --git a/keyboards/planck/keymaps/yang/config.h b/keyboards/planck/keymaps/yang/config.h new file mode 100644 index 0000000000..5921e9377c --- /dev/null +++ b/keyboards/planck/keymaps/yang/config.h @@ -0,0 +1,15 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* ws2812 RGB LED */ +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD +#define ws2812_pin PD1 +#define RGBLED_NUM 28 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +#endif diff --git a/keyboards/planck/planck.c b/keyboards/planck/planck.c index f1a76266ec..8d70bb4e5a 100644 --- a/keyboards/planck/planck.c +++ b/keyboards/planck/planck.c @@ -1,302 +1,9 @@ #include "planck.h" -__attribute__ ((weak)) -void matrix_init_user(void) {} - -__attribute__ ((weak)) -void matrix_scan_user(void) {} - -__attribute__ ((weak)) -bool process_action_user(keyrecord_t *record) { - return true; -} - -__attribute__ ((weak)) -void led_set_user(uint8_t usb_led) {} - void matrix_init_kb(void) { -#ifdef BACKLIGHT_ENABLE - backlight_init_ports(); -#endif - // Turn status LED on DDRE |= (1<<6); PORTE |= (1<<6); matrix_init_user(); -} - -void matrix_scan_kb(void) { - matrix_scan_user(); -} - -bool process_action_kb(keyrecord_t *record) { - return process_action_user(record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - - led_set_user(usb_led); -} - -#ifdef BACKLIGHT_ENABLE -#define CHANNEL OCR1C -#define BREATHING_NO_HALT 0 -#define BREATHING_HALT_OFF 1 -#define BREATHING_HALT_ON 2 - -static uint8_t breath_intensity; -static uint8_t breath_speed; -static uint16_t breathing_index; -static uint8_t breathing_halt; - -void backlight_init_ports() -{ - - // Setup PB7 as output and output low. - DDRB |= (1<<7); - PORTB &= ~(1<<7); - - // Use full 16-bit resolution. - ICR1 = 0xFFFF; - - // I could write a wall of text here to explain... but TL;DW - // Go read the ATmega32u4 datasheet. - // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on - - // Pin PB7 = OCR1C (Timer 1, Channel C) - // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 - // (i.e. start high, go low when counter matches.) - // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 - // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 - - TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; - TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; - - backlight_init(); - breathing_defaults(); -} - -void backlight_set(uint8_t level) -{ - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - - if ( level == 0 ) - { - // Turn off PWM control on PB7, revert to output low. - TCCR1A &= ~(_BV(COM1C1)); - CHANNEL = 0x0; - } - else if ( level == BACKLIGHT_LEVELS ) - { - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - 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 diff --git a/keyboards/planck/planck.h b/keyboards/planck/planck.h index 0e641c27ee..81c0e8cb44 100644 --- a/keyboards/planck/planck.h +++ b/keyboards/planck/planck.h @@ -2,7 +2,6 @@ #define PLANCK_H #include "quantum.h" -#include #define PLANCK_MIT( \ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ @@ -30,26 +29,4 @@ { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b } \ } -void matrix_init_user(void); -void matrix_scan_user(void); -bool process_action_user(keyrecord_t *record); - -void led_set_user(uint8_t usb_led); -void backlight_init_ports(void); - -void breathing_enable(void); -void breathing_pulse(void); -void breathing_disable(void); -void breathing_self_disable(void); -void breathing_toggle(void); -bool is_breathing(void); - - -void breathing_defaults(void); -void breathing_intensity_default(void); -void breathing_speed_default(void); -void breathing_speed_set(uint8_t value); -void breathing_speed_inc(uint8_t value); -void breathing_speed_dec(uint8_t value); - #endif diff --git a/keyboards/planck/README.md b/keyboards/planck/readme.md similarity index 91% rename from keyboards/planck/README.md rename to keyboards/planck/readme.md index 47cfec0328..f89fdeb931 100644 --- a/keyboards/planck/README.md +++ b/keyboards/planck/readme.md @@ -4,7 +4,7 @@ DIY/Assembled compact ortholinear 40% keyboard by [Ortholinear Keyboards](http:/ ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Building @@ -16,7 +16,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/preonic/config.h b/keyboards/preonic/config.h index e8d0e82fc9..04946f7fbb 100644 --- a/keyboards/preonic/config.h +++ b/keyboards/preonic/config.h @@ -37,6 +37,8 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } #define UNUSED_PINS +#define BACKLIGHT_PIN B7 + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW diff --git a/keyboards/preonic/keymaps/default/compiled.hex b/keyboards/preonic/keymaps/default/compiled.hex deleted file mode 100644 index a988ab756c..0000000000 Binary files a/keyboards/preonic/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/preonic/keymaps/default/README.md b/keyboards/preonic/keymaps/default/readme.md similarity index 100% rename from keyboards/preonic/keymaps/default/README.md rename to keyboards/preonic/keymaps/default/readme.md diff --git a/keyboards/preonic/preonic.c b/keyboards/preonic/preonic.c index 773451bf0c..889c3fc8fd 100644 --- a/keyboards/preonic/preonic.c +++ b/keyboards/preonic/preonic.c @@ -1,97 +1,10 @@ #include "preonic.h" -__attribute__ ((weak)) -void matrix_init_user(void) { - -}; - -__attribute__ ((weak)) -void matrix_scan_user(void) { - -}; - -__attribute__ ((weak)) -bool process_action_user(keyrecord_t *record) { - return true; -}; - void matrix_init_kb(void) { - #ifdef BACKLIGHT_ENABLE - backlight_init_ports(); - #endif // Turn status LED on DDRE |= (1<<6); PORTE |= (1<<6); matrix_init_user(); -}; - -void matrix_scan_kb(void) { - matrix_scan_user(); -}; - -bool process_action_kb(keyrecord_t *record) { - return process_action_user(record); -} - -#ifdef BACKLIGHT_ENABLE -#define CHANNEL OCR1C - -void backlight_init_ports() -{ - - // Setup PB7 as output and output low. - DDRB |= (1<<7); - PORTB &= ~(1<<7); - - // Use full 16-bit resolution. - ICR1 = 0xFFFF; - - // I could write a wall of text here to explain... but TL;DW - // Go read the ATmega32u4 datasheet. - // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on - - // Pin PB7 = OCR1C (Timer 1, Channel C) - // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 - // (i.e. start high, go low when counter matches.) - // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 - // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 - - TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; - TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; - - backlight_init(); -} - -void backlight_set(uint8_t level) -{ - if ( level == 0 ) - { - // Turn off PWM control on PB7, revert to output low. - TCCR1A &= ~(_BV(COM1C1)); - CHANNEL = 0x0; - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - } - else if ( level == BACKLIGHT_LEVELS ) - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF; - } - else - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); - } -} - -#endif +}; \ No newline at end of file diff --git a/keyboards/preonic/preonic.h b/keyboards/preonic/preonic.h index 2b605f3742..0e0b101e45 100644 --- a/keyboards/preonic/preonic.h +++ b/keyboards/preonic/preonic.h @@ -33,9 +33,4 @@ { k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b } \ } -void matrix_init_user(void); -void matrix_scan_user(void); -bool process_action_kb(keyrecord_t *record); -void backlight_init_ports(void); - #endif diff --git a/keyboards/preonic/README.md b/keyboards/preonic/readme.md similarity index 88% rename from keyboards/preonic/README.md rename to keyboards/preonic/readme.md index f99856fdd8..f0be255a09 100644 --- a/keyboards/preonic/README.md +++ b/keyboards/preonic/readme.md @@ -4,7 +4,7 @@ DIY/Assembled compact ortholinear 50% keyboard by [Ortholinear Keyboards](http:/ ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Building @@ -16,7 +16,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap, create a file in the keymaps folder named `.c` and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap, create a file in the keymaps folder named `.c` and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/readme.md b/keyboards/readme.md index b2173f6ebb..5574619dbd 100644 --- a/keyboards/readme.md +++ b/keyboards/readme.md @@ -5,27 +5,27 @@ QMK runs on a diverse range of keyboards. Some of these keyboards are officially These keyboards are manufactured by the maintainers of QMK. -### [Ortholinear Keyboards](http://olkb.com) — Jack Humbert +### Ortholinear Keyboards - Jack Humbert What makes OLKB keyboards shine is a combo of lean aesthetics, compact size, and killer tactile feel. These are available through [olkb.com](http://olkb.com) as well as through [Massdrop](http://massdrop.com) from time to time, as easy to assemble kits. -* [Planck](/keyboards/planck/) — A 40% DIY powerhouse of customizability and modification capability. It's a lean, mean, typing machine. -* [Preonic](/keyboards/preonic/) — Like the Planck, but bigger. 50%. -* [Atomic](/keyboards/atomic/) — Imagine the size of the Planck. Now imagine the size of the Preonic. Now imagine _bigger_. That is the Atomic. A 60% keyboard. +* [Planck](/keyboards/planck/) - A 40% DIY powerhouse of customizability and modification capability. It's a lean, mean, typing machine. +* [Preonic](/keyboards/preonic/) - Like the Planck, but bigger. 50%. +* [Atomic](/keyboards/atomic/) - Imagine the size of the Planck. Now imagine the size of the Preonic. Now imagine _bigger_. That is the Atomic. A 60% keyboard. -### [ErgoDox EZ](https://ergodox-ez.com) — Erez Zukerman +### ErgoDox EZ - Erez Zukerman -Made in Taiwan using advanced robotic manufacturing, the ErgoDox EZ is a fully-assembled, premium ergonomic keyboard. Its split design allows you to place both halves shoulder width, and its custom-made wrist rests and tilt/tent kit make for incredibly comfortable typing. +Made in Taiwan using advanced robotic manufacturing, the ErgoDox EZ is a fully-assembled, premium ergonomic keyboard. Its split design allows you to place both halves shoulder width, and its custom-made wrist rests and tilt/tent kit make for incredibly comfortable typing. Available on [ergodox-ez.com](https://ergodox-ez.com). -* [ErgoDox EZ](/keyboards/ergodox_ez/) — Our one and only product. Yes, it's that awesome. Comes with either printed or blank keycaps, and 7 different keyswitch types. +* [ErgoDox EZ](/keyboards/ergodox_ez/) - Our one and only product. Yes, it's that awesome. Comes with either printed or blank keycaps, and 7 different keyswitch types. -### [Clueboard](http://clueboard.co) — Zach White +### Clueboard - Zach White -Designed and built in Felton, CA, Clueboards keyboard emphasize quality and locally sourced components. +Designed and built in Felton, CA, Clueboards keyboard emphasize quality and locally sourced components, available on [clueboard.co](http://clueboard.co) -* [Clueboard rev.1](/keyboards/clueboard1/) — The old Clueboard. -* [Clueboard rev.2](/keyboards/clueboard2/) — New and improved! The Clueboard, revision 2. -* [Cluepad](/keyboards/cluepad/) — A mechanical numpad with QMK superpowers. +* [Clueboard rev.1](/keyboards/clueboard1/) - The old Clueboard. +* [Clueboard rev.2](/keyboards/clueboard2/) - New and improved! The Clueboard, revision 2. +* [Cluepad](/keyboards/cluepad/) - A mechanical numpad with QMK superpowers. ## Community-supported QMK Keyboards diff --git a/keyboards/retro_refit/keymaps/default/compiled.hex b/keyboards/retro_refit/keymaps/default/compiled.hex deleted file mode 100644 index 870787585c..0000000000 Binary files a/keyboards/retro_refit/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/retro_refit/README.md b/keyboards/retro_refit/readme.md similarity index 87% rename from keyboards/retro_refit/README.md rename to keyboards/retro_refit/readme.md index c64e1b8066..b01a1a9ca9 100644 --- a/keyboards/retro_refit/README.md +++ b/keyboards/retro_refit/readme.md @@ -3,7 +3,7 @@ retro_refit keyboard firmware ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/README.md). +For the full Quantum feature list, see [the parent readme.md](/readme.md). ## Building @@ -15,7 +15,7 @@ Depending on which keymap you would like to use, you will have to compile slight To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` and see keymap document (you can find in top README.md) and existent keymap files. +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` and see keymap document (you can find in top readme.md) and existent keymap files. To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: ``` diff --git a/keyboards/retro_refit/retro_refit.c b/keyboards/retro_refit/retro_refit.c index 78b6edca75..3d610eba34 100644 --- a/keyboards/retro_refit/retro_refit.c +++ b/keyboards/retro_refit/retro_refit.c @@ -1,19 +1,5 @@ #include "retro_refit.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)) -void led_set_user(uint8_t usb_led) { - // leave this function blank - it can be defined in a keymap file -}; +#include "led.h" void matrix_init_kb(void) { // put your keyboard start-up code here @@ -26,13 +12,6 @@ void matrix_init_kb(void) { matrix_init_user(); }; -void amatrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -}; - void led_set_kb(uint8_t usb_led) { // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here diff --git a/keyboards/retro_refit/retro_refit.h b/keyboards/retro_refit/retro_refit.h index 77d354703a..109acdc399 100644 --- a/keyboards/retro_refit/retro_refit.h +++ b/keyboards/retro_refit/retro_refit.h @@ -1,10 +1,7 @@ #ifndef RETRO_REFIT_H #define RETRO_REFIT_H -#include "matrix.h" -#include "keymap.h" -#include "led.h" -#include +#include "quantum.h" // This macro is an example of using a non-standard row-column matrix. The // keyboard in question had 11 rows and 8 columns, but the rows were not all @@ -38,8 +35,4 @@ { KC_##KA0, KC_##KA1, KC_##KA2, KC_##KA3, KC_##KA4, KC_##KA5, KC_##KA6, KC_##KA7, } \ } -void matrix_init_user(void); -void matrix_scan_user(void); -void led_set_user(uint8_t usb_led); - #endif \ No newline at end of file diff --git a/keyboards/satan/Makefile b/keyboards/satan/Makefile index 0ad71007e1..184b5ac372 100644 --- a/keyboards/satan/Makefile +++ b/keyboards/satan/Makefile @@ -1,7 +1,4 @@ - -SRC = led.c - # MCU name #MCU = at90usb1287 MCU = atmega32u4 diff --git a/keyboards/satan/backlight.c b/keyboards/satan/backlight.c deleted file mode 100644 index 4240b09164..0000000000 --- a/keyboards/satan/backlight.c +++ /dev/null @@ -1,24 +0,0 @@ - -#include -#include "backlight.h" -#include "print.h" - -void init_backlight_pin(void) { - print("init_backlight_pin()\n"); - // Set our LED pins as output - DDRB |= (1<<6); - - // Set our LED pins low - PORTB &= ~(1<<6); -} - -void backlight_set(uint8_t level) { - if ( level == 0 ) { - // Turn off light - PORTB |= (1<<6); - } else { - // Turn on light - PORTB &= ~(1<<6); - } -} - diff --git a/keyboards/satan/config.h b/keyboards/satan/config.h index aa2dca1a6a..a7ea8f904c 100644 --- a/keyboards/satan/config.h +++ b/keyboards/satan/config.h @@ -38,6 +38,8 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3 } #define UNUSED_PINS +#define BACKLIGHT_PIN B6 + /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW diff --git a/keyboards/satan/keymaps/default/compiled.hex b/keyboards/satan/keymaps/default/compiled.hex deleted file mode 100644 index cd680d64dd..0000000000 Binary files a/keyboards/satan/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/satan/led.c b/keyboards/satan/led.c deleted file mode 100644 index 94606e8959..0000000000 --- a/keyboards/satan/led.c +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include "stdint.h" -#include "led.h" - - -void led_init_ports(void) { - // * Set our LED pins as output - DDRB |= (1<<2); -} - -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); - } -} - -#endif +#include "led.h" void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - if (matrix_init_user) { - (*matrix_init_user)(); - } + matrix_init_user(); led_init_ports(); - - #ifdef BACKLIGHT_ENABLE - backlight_init_ports(); - #endif }; void matrix_scan_kb(void) { // put your looping keyboard code here // runs every cycle (a lot) - if (matrix_scan_user) { - (*matrix_scan_user)(); - } -}; \ No newline at end of file + matrix_scan_user(); +}; + +void led_init_ports(void) { + // * Set our LED pins as output + DDRB |= (1<<2); +} + +void led_set_kb(uint8_t usb_led) { + if (usb_led & (1< -#include "action_util.h" +#include "quantum.h" /* Clueboard matrix layout * ,-----------------------------------------------------------. diff --git a/keyboards/sixkeyboard/keymaps/default/compiled.hex b/keyboards/sixkeyboard/keymaps/default/compiled.hex deleted file mode 100644 index 588aca1083..0000000000 Binary files a/keyboards/sixkeyboard/keymaps/default/compiled.hex and /dev/null differ diff --git a/keyboards/sixkeyboard/matrix.c b/keyboards/sixkeyboard/matrix.c index 6dc93cda1b..c279986487 100644 --- a/keyboards/sixkeyboard/matrix.c +++ b/keyboards/sixkeyboard/matrix.c @@ -40,10 +40,20 @@ static matrix_row_t matrix[MATRIX_ROWS]; __attribute__ ((weak)) void matrix_init_kb(void) { + matrix_init_user(); } __attribute__ ((weak)) void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { } inline diff --git a/keyboards/sixkeyboard/README.md b/keyboards/sixkeyboard/readme.md similarity index 100% rename from keyboards/sixkeyboard/README.md rename to keyboards/sixkeyboard/readme.md diff --git a/keyboards/sixkeyboard/sixkeyboard.c b/keyboards/sixkeyboard/sixkeyboard.c index 7c15e64990..85190f6167 100644 --- a/keyboards/sixkeyboard/sixkeyboard.c +++ b/keyboards/sixkeyboard/sixkeyboard.c @@ -1,20 +1,5 @@ #include "sixkeyboard.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)) -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 @@ -42,11 +27,4 @@ void matrix_init_kb(void) { PORTD &= ~(1<<3); matrix_init_user(); -}; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); }; \ No newline at end of file diff --git a/keyboards/sixkeyboard/sixkeyboard.h b/keyboards/sixkeyboard/sixkeyboard.h index 5c0820d7d6..66f53bf7e1 100644 --- a/keyboards/sixkeyboard/sixkeyboard.h +++ b/keyboards/sixkeyboard/sixkeyboard.h @@ -15,8 +15,4 @@ // instead of the obtuse 11x8 matrix. -void matrix_init_user(void); -void matrix_scan_user(void); -void led_set_user(uint8_t usb_led); - #endif \ No newline at end of file diff --git a/quantum/config_common.h b/quantum/config_common.h index 02f11d979c..09a4fe7010 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -5,46 +5,46 @@ #define COL2ROW 0 #define ROW2COL 1 /* I/O pins */ -#define B0 { .input_addr = 3, .bit = 0 } -#define B1 { .input_addr = 3, .bit = 1 } -#define B2 { .input_addr = 3, .bit = 2 } -#define B3 { .input_addr = 3, .bit = 3 } -#define B4 { .input_addr = 3, .bit = 4 } -#define B5 { .input_addr = 3, .bit = 5 } -#define B6 { .input_addr = 3, .bit = 6 } -#define B7 { .input_addr = 3, .bit = 7 } -#define C0 { .input_addr = 6, .bit = 0 } -#define C1 { .input_addr = 6, .bit = 1 } -#define C2 { .input_addr = 6, .bit = 2 } -#define C3 { .input_addr = 6, .bit = 3 } -#define C4 { .input_addr = 6, .bit = 4 } -#define C5 { .input_addr = 6, .bit = 5 } -#define C6 { .input_addr = 6, .bit = 6 } -#define C7 { .input_addr = 6, .bit = 7 } -#define D0 { .input_addr = 9, .bit = 0 } -#define D1 { .input_addr = 9, .bit = 1 } -#define D2 { .input_addr = 9, .bit = 2 } -#define D3 { .input_addr = 9, .bit = 3 } -#define D4 { .input_addr = 9, .bit = 4 } -#define D5 { .input_addr = 9, .bit = 5 } -#define D6 { .input_addr = 9, .bit = 6 } -#define D7 { .input_addr = 9, .bit = 7 } -#define E0 { .input_addr = 0xC, .bit = 0 } -#define E1 { .input_addr = 0xC, .bit = 1 } -#define E2 { .input_addr = 0xC, .bit = 2 } -#define E3 { .input_addr = 0xC, .bit = 3 } -#define E4 { .input_addr = 0xC, .bit = 4 } -#define E5 { .input_addr = 0xC, .bit = 5 } -#define E6 { .input_addr = 0xC, .bit = 6 } -#define E7 { .input_addr = 0xC, .bit = 7 } -#define F0 { .input_addr = 0xF, .bit = 0 } -#define F1 { .input_addr = 0xF, .bit = 1 } -#define F2 { .input_addr = 0xF, .bit = 2 } -#define F3 { .input_addr = 0xF, .bit = 3 } -#define F4 { .input_addr = 0xF, .bit = 4 } -#define F5 { .input_addr = 0xF, .bit = 5 } -#define F6 { .input_addr = 0xF, .bit = 6 } -#define F7 { .input_addr = 0xF, .bit = 7 } +#define B0 0x30 +#define B1 0x31 +#define B2 0x32 +#define B3 0x33 +#define B4 0x34 +#define B5 0x35 +#define B6 0x36 +#define B7 0x37 +#define C0 0x60 +#define C1 0x61 +#define C2 0x62 +#define C3 0x63 +#define C4 0x64 +#define C5 0x65 +#define C6 0x66 +#define C7 0x67 +#define D0 0x90 +#define D1 0x91 +#define D2 0x92 +#define D3 0x93 +#define D4 0x94 +#define D5 0x95 +#define D6 0x96 +#define D7 0x97 +#define E0 0xC0 +#define E1 0xC1 +#define E2 0xC2 +#define E3 0xC3 +#define E4 0xC4 +#define E5 0xC5 +#define E6 0xC6 +#define E7 0xC7 +#define F0 0xF0 +#define F1 0xF1 +#define F2 0xF2 +#define F3 0xF3 +#define F4 0xF4 +#define F5 0xF5 +#define F6 0xF6 +#define F7 0xF7 /* USART configuration */ #ifdef BLUETOOTH_ENABLE diff --git a/quantum/keymap.h b/quantum/keymap.h index 6ac3d2ace6..41fa394ab6 100644 --- a/quantum/keymap.h +++ b/quantum/keymap.h @@ -125,8 +125,8 @@ enum quantum_keycodes { MUV_DE, // Midi mode on/off - MI_ON, - MI_OFF, + MIDI_ON, + MIDI_OFF, // Backlight functionality BL_0, @@ -154,7 +154,10 @@ enum quantum_keycodes { KC_LSPO, // Right shift, close paren - KC_RSPC + KC_RSPC, + + // always leave at the end + SAFE_RANGE }; // Ability to use mods in layouts @@ -266,6 +269,9 @@ enum quantum_keycodes { #define BL_ON BL_9 #define BL_OFF BL_0 +#define MI_ON MIDI_ON +#define MI_OFF MIDI_OFF + // GOTO layer - 16 layers max // when: // ON_PRESS = 1 diff --git a/quantum/led.c b/quantum/led.c deleted file mode 100644 index 2634ab2f61..0000000000 --- a/quantum/led.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include "stdint.h" -#include "led.h" - -__attribute__ ((weak)) -void led_set_kb(uint8_t usb_led) { - -} - -__attribute__ ((weak)) -void led_init_ports(void) -{ - -} - -__attribute__ ((weak)) -void led_set(uint8_t usb_led) -{ - - // Example LED Code - // - // // Using PE6 Caps Lock LED - // if (usb_led & (1<. # define DEBOUNCING_DELAY 5 #endif -static const io_pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -static const io_pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; /* matrix state */ #if DIODE_DIRECTION == COL2ROW static matrix_row_t matrix[MATRIX_ROWS]; @@ -52,10 +52,30 @@ static matrix_col_t read_rows(void); __attribute__ ((weak)) void matrix_init_quantum(void) { + matrix_init_kb(); } __attribute__ ((weak)) void matrix_scan_quantum(void) { + matrix_scan_kb(); +} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { } uint8_t matrix_rows(void) { @@ -70,22 +90,22 @@ void matrix_power_up(void) { #if DIODE_DIRECTION == COL2ROW for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { /* DDRxn */ - _SFR_IO8(row_pins[r].input_addr + 1) |= _BV(row_pins[r].bit); + _SFR_IO8((row_pins[r] >> 4) + 1) |= _BV(row_pins[r] & 0xF); toggle_row(r); } for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { /* PORTxn */ - _SFR_IO8(col_pins[c].input_addr + 2) |= _BV(col_pins[c].bit); + _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF); } #else for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { /* DDRxn */ - _SFR_IO8(col_pins[c].input_addr + 1) |= _BV(col_pins[c].bit); + _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF); toggle_col(c); } for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { /* PORTxn */ - _SFR_IO8(row_pins[r].input_addr + 2) |= _BV(row_pins[r].bit); + _SFR_IO8((row_pins[r] >> 4) + 2) |= _BV(row_pins[r] & 0xF); } #endif } @@ -100,22 +120,22 @@ void matrix_init(void) { #if DIODE_DIRECTION == COL2ROW for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { /* DDRxn */ - _SFR_IO8(row_pins[r].input_addr + 1) |= _BV(row_pins[r].bit); + _SFR_IO8((row_pins[r] >> 4) + 1) |= _BV(row_pins[r] & 0xF); toggle_row(r); } for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { /* PORTxn */ - _SFR_IO8(col_pins[c].input_addr + 2) |= _BV(col_pins[c].bit); + _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF); } #else for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { /* DDRxn */ - _SFR_IO8(col_pins[c].input_addr + 1) |= _BV(col_pins[c].bit); + _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF); toggle_col(c); } for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { /* PORTxn */ - _SFR_IO8(row_pins[r].input_addr + 2) |= _BV(row_pins[r].bit); + _SFR_IO8((row_pins[r] >> 4) + 2) |= _BV(row_pins[r] & 0xF); } #endif matrix_init_quantum(); @@ -151,14 +171,14 @@ uint8_t matrix_scan(void) { static void toggle_row(uint8_t row) { /* PINxn */ - _SFR_IO8(row_pins[row].input_addr) = _BV(row_pins[row].bit); + _SFR_IO8((row_pins[row] >> 4)) = _BV(row_pins[row] & 0xF); } static matrix_row_t read_cols(void) { matrix_row_t state = 0; for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) { /* PINxn */ - if (!(_SFR_IO8(col_pins[c].input_addr) & _BV(col_pins[c].bit))) { + if (!(_SFR_IO8((col_pins[c] >> 4)) & _BV(col_pins[c] & 0xF))) { state |= (matrix_row_t)1 << c; } } @@ -199,14 +219,14 @@ uint8_t matrix_scan(void) { static void toggle_col(uint8_t col) { /* PINxn */ - _SFR_IO8(col_pins[col].input_addr) = _BV(col_pins[col].bit); + _SFR_IO8((col_pins[col] >> 4)) = _BV(col_pins[col] & 0xF); } static matrix_col_t read_rows(void) { matrix_col_t state = 0; for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { /* PINxn */ - if (!(_SFR_IO8(row_pins[r].input_addr) & _BV(row_pins[r].bit))) { + if (!(_SFR_IO8((row_pins[r] >> 4)) & _BV(row_pins[r] & 0xF))) { state |= (matrix_col_t)1 << r; } } diff --git a/quantum/quantum.c b/quantum/quantum.c index 006464e5a8..3f2edfc92c 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -655,6 +655,9 @@ void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { } void matrix_init_quantum() { + #ifdef BACKLIGHT_ENABLE + backlight_init_ports(); + #endif matrix_init_kb(); } @@ -673,6 +676,7 @@ void matrix_scan_quantum() { matrix_scan_kb(); } + #ifdef AUDIO_ENABLE bool is_music_on(void) { return (music_activated != 0); @@ -698,6 +702,348 @@ void matrix_scan_quantum() { #endif + +#if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN) + +static const uint8_t backlight_pin = BACKLIGHT_PIN; + +#if BACKLIGHT_PIN == B7 +# define COM1x1 COM1C1 +# define OCR1x OCR1C +#elif BACKLIGHT_PIN == B6 +# define COM1x1 COM1B1 +# define OCR1x OCR1B +#elif BACKLIGHT_PIN == B5 +# define COM1x1 COM1A1 +# define OCR1x OCR1A +#else +# error "Backlight pin not supported - use B5, B6, or B7" +#endif + +__attribute__ ((weak)) +void backlight_init_ports(void) +{ + + // Setup backlight pin as output and output low. + // DDRx |= n + _SFR_IO8((backlight_pin >> 4) + 1) |= _BV(backlight_pin & 0xF); + // PORTx &= ~n + _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); + + // Use full 16-bit resolution. + ICR1 = 0xFFFF; + + // I could write a wall of text here to explain... but TL;DW + // Go read the ATmega32u4 datasheet. + // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on + + // Pin PB7 = OCR1C (Timer 1, Channel C) + // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 + // (i.e. start high, go low when counter matches.) + // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 + // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 + + TCCR1A = _BV(COM1x1) | _BV(WGM11); // = 0b00001010; + TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; + + backlight_init(); + #ifdef BACKLIGHT_BREATHING + breathing_defaults(); + #endif +} + +__attribute__ ((weak)) +void backlight_set(uint8_t level) +{ + // Prevent backlight blink on lowest level + // PORTx &= ~n + _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); + + if ( level == 0 ) { + // Turn off PWM control on backlight pin, revert to output low. + TCCR1A &= ~(_BV(COM1x1)); + OCR1x = 0x0; + } else if ( level == BACKLIGHT_LEVELS ) { + // Turn on PWM control of backlight pin + TCCR1A |= _BV(COM1x1); + // Set the brightness + OCR1x = 0xFFFF; + } else { + // Turn on PWM control of backlight pin + TCCR1A |= _BV(COM1x1); + // Set the brightness + OCR1x = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); + } + + #ifdef BACKLIGHT_BREATHING + breathing_intensity_default(); + #endif +} + + +#ifdef BACKLIGHT_BREATHING + +#define BREATHING_NO_HALT 0 +#define BREATHING_HALT_OFF 1 +#define BREATHING_HALT_ON 2 + +static uint8_t breath_intensity; +static uint8_t breath_speed; +static uint16_t breathing_index; +static uint8_t breathing_halt; + +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) +{ + // OCR1x = (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); + } + + OCR1x = (uint16_t)(((uint16_t)pgm_read_byte(&breathing_table[local_index]) * 257)) >> breath_intensity; + +} + + + +#endif // breathing + +#else // backlight + +__attribute__ ((weak)) +void backlight_init_ports(void) +{ + +} + +__attribute__ ((weak)) +void backlight_set(uint8_t level) +{ + +} + +#endif // backlight + + + +__attribute__ ((weak)) +void led_set_user(uint8_t usb_led) { + +} + +__attribute__ ((weak)) +void led_set_kb(uint8_t usb_led) { + led_set_user(usb_led); +} + +__attribute__ ((weak)) +void led_init_ports(void) +{ + +} + +__attribute__ ((weak)) +void led_set(uint8_t usb_led) +{ + + // Example LED Code + // + // // Using PE6 Caps Lock LED + // if (usb_led & (1< #include "bootloader.h" #include "timer.h" +#include "config_common.h" +#include +#include "led.h" +#include "action_util.h" extern uint32_t default_layer_state; @@ -74,6 +78,8 @@ void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); void matrix_init_kb(void); void matrix_scan_kb(void); +void matrix_init_user(void); +void matrix_scan_user(void); bool process_action_kb(keyrecord_t *record); bool process_record_kb(uint16_t keycode, keyrecord_t *record); bool process_record_user(uint16_t keycode, keyrecord_t *record); @@ -89,4 +95,28 @@ void audio_on_user(void); void music_on_user(void); void music_scale_user(void); +#ifdef BACKLIGHT_ENABLE +void backlight_init_ports(void); + +#ifdef BACKLIGHT_BREATHING +void breathing_enable(void); +void breathing_pulse(void); +void breathing_disable(void); +void breathing_self_disable(void); +void breathing_toggle(void); +bool is_breathing(void); + +void breathing_defaults(void); +void breathing_intensity_default(void); +void breathing_speed_default(void); +void breathing_speed_set(uint8_t value); +void breathing_speed_inc(uint8_t value); +void breathing_speed_dec(uint8_t value); +#endif + +#endif + +void led_set_user(uint8_t usb_led); +void led_set_kb(uint8_t usb_led); + #endif diff --git a/quantum/template/Makefile b/quantum/template/Makefile index 87e4c2d2bb..3f6d133c9b 100644 --- a/quantum/template/Makefile +++ b/quantum/template/Makefile @@ -53,20 +53,20 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512 # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -NKRO_ENABLE = no # USB Nkey Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default -MIDI_ENABLE = no # MIDI controls -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -AUDIO_ENABLE = no # Audio output on port C6 +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 ifndef QUANTUM_DIR include ../../Makefile diff --git a/quantum/template/config.h b/quantum/template/config.h index cad3e3260a..b02f0c7ebc 100644 --- a/quantum/template/config.h +++ b/quantum/template/config.h @@ -48,6 +48,11 @@ along with this program. If not, see . /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCING_DELAY 5 @@ -56,7 +61,6 @@ along with this program. If not, see . //#define MATRIX_HAS_GHOST /* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/quantum/template/keymaps/default/Makefile b/quantum/template/keymaps/default/Makefile new file mode 100644 index 0000000000..f4671a9d11 --- /dev/null +++ b/quantum/template/keymaps/default/Makefile @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif \ No newline at end of file diff --git a/quantum/template/keymaps/default/config.h b/quantum/template/keymaps/default/config.h new file mode 100644 index 0000000000..df06a26206 --- /dev/null +++ b/quantum/template/keymaps/default/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// place overrides here + +#endif \ No newline at end of file diff --git a/quantum/template/keymaps/default/keymap.c b/quantum/template/keymaps/default/keymap.c index 4121fd860c..e28a4723e9 100644 --- a/quantum/template/keymaps/default/keymap.c +++ b/quantum/template/keymaps/default/keymap.c @@ -1,6 +1,3 @@ -// This is the canonical layout file for the Quantum project. If you want to add another keyboard, -// this is the style you want to emulate. - #include "%KEYBOARD%.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -28,3 +25,20 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } return MACRO_NONE; }; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} \ No newline at end of file diff --git a/quantum/template/keymaps/default/readme.md b/quantum/template/keymaps/default/readme.md new file mode 100644 index 0000000000..21aa663d55 --- /dev/null +++ b/quantum/template/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for %KEYBOARD% \ No newline at end of file diff --git a/quantum/template/README.md b/quantum/template/readme.md similarity index 61% rename from quantum/template/README.md rename to quantum/template/readme.md index d6b0ac936c..b2fb4dd98d 100644 --- a/quantum/template/README.md +++ b/quantum/template/readme.md @@ -3,7 +3,7 @@ ## Quantum MK Firmware -For the full Quantum feature list, see [the parent README.md](/doc/README.md). +For the full Quantum feature list, see [the parent readme.md](/doc/readme.md). ## Building @@ -12,13 +12,17 @@ Download or clone the whole firmware and navigate to the keyboards/%KEYBOARD% fo Depending on which keymap you would like to use, you will have to compile slightly differently. ### Default + To build with the default keymap, simply run `make`. ### Other Keymaps -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` in the keymaps folder, and see keymap document (you can find in top README.md) and existent keymap files. -To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files. + +To build the firmware binary hex file with a keymap just do `make` with `keymap` option like: + ``` -$ make KEYMAP=[default|jack|] +$ make keymap=[default|jack|] ``` -Keymaps follow the format **__\.c__** and are stored in the `keymaps` folder. \ No newline at end of file + +Keymaps follow the format **__keymap.c__** and are stored in folders in the `keymaps` folder, eg `keymaps/my_keymap/` \ No newline at end of file diff --git a/quantum/template/template.c b/quantum/template/template.c index 649072eb2e..dcc4b0a221 100644 --- a/quantum/template/template.c +++ b/quantum/template/template.c @@ -1,26 +1,5 @@ #include "%KEYBOARD%.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 @@ -35,7 +14,7 @@ void matrix_scan_kb(void) { matrix_scan_user(); } -bool process_action_kb(keyrecord_t *record) { +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { // put your per-action keyboard code here // runs for every action, just before processing by the firmware @@ -47,64 +26,3 @@ void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); } - -#ifdef BACKLIGHT_ENABLE -#define CHANNEL OCR1C - -void backlight_init_ports() -{ - - // Setup PB7 as output and output low. - DDRB |= (1<<7); - PORTB &= ~(1<<7); - - // Use full 16-bit resolution. - ICR1 = 0xFFFF; - - // I could write a wall of text here to explain... but TL;DW - // Go read the ATmega32u4 datasheet. - // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on - - // Pin PB7 = OCR1C (Timer 1, Channel C) - // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 - // (i.e. start high, go low when counter matches.) - // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 - // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 - - TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; - TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; - - backlight_init(); -} - -void backlight_set(uint8_t level) -{ - if ( level == 0 ) - { - // Turn off PWM control on PB7, revert to output low. - TCCR1A &= ~(_BV(COM1C1)); - CHANNEL = 0x0; - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - } - else if ( level == BACKLIGHT_LEVELS ) - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF; - } - else - { - // Prevent backlight blink on lowest level - PORTB &= ~(_BV(PORTB7)); - // Turn on PWM control of PB7 - TCCR1A |= _BV(COM1C1); - // Set the brightness - CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); - } -} - -#endif \ No newline at end of file diff --git a/quantum/template/template.h b/quantum/template/template.h index b8e7a0456b..cd78a54e3e 100644 --- a/quantum/template/template.h +++ b/quantum/template/template.h @@ -1,13 +1,7 @@ #ifndef %KEYBOARD_UPPERCASE%_H #define %KEYBOARD_UPPERCASE%_H -#include "matrix.h" -#include "keymap.h" -#ifdef BACKLIGHT_ENABLE - #include "backlight.h" -#endif -#include -#include +#include "quantum.h" // This a shortcut to help you visually see your layout. // The following is an example using the Planck MIT layout @@ -22,9 +16,4 @@ { k10, KC_NO, k11 }, \ } -void matrix_init_user(void); -void matrix_scan_user(void); -bool process_action_user(keyrecord_t *record); -void led_set_user(uint8_t usb_led); - #endif diff --git a/quantum/tools/README.md b/quantum/tools/readme.md similarity index 100% rename from quantum/tools/README.md rename to quantum/tools/readme.md diff --git a/README.md b/readme.md similarity index 56% rename from README.md rename to readme.md index 8ecae68d32..fbd9203a57 100644 --- a/README.md +++ b/readme.md @@ -2,11 +2,11 @@ [![Build Status](https://travis-ci.org/jackhumbert/qmk_firmware.svg?branch=master)](https://travis-ci.org/jackhumbert/qmk_firmware) -This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.co), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). +This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). ## Official website -For an easy-to-read version of this document and the repository, check out [http://qmk.fm](http://qmk.fm). +For an easy-to-read version of this document and the repository, check out [http://qmk.fm](http://qmk.fm). Nicely formatted keyboard and keymap listings are also available there, along with the ability to download .hex files instead of having to setup a build environment and compile them. ## Included Keyboards @@ -22,52 +22,202 @@ The project also includes community support for [lots of other keyboards](/keybo ## Maintainers -QMK is developed and maintained by Jack Humbert of OLKB with contributions from the community, and of course, TMK. In fact, this repo used to be a fork of TMK, and we are incredibly grateful for his founding contributions to the firmware. We've had to break the fork due to purely technical reasons -- it simply became too different over time, and we've had to start refactoring some of the basic bits and pieces. We are huge fans of TMK, both the firmware and the person. :) +QMK is developed and maintained by Jack Humbert of OLKB with contributions from the community, and of course, [Hasu](https://github.com/tmk). This repo used to be a fork of [TMK](https://github.com/tmk/tmk_keyboard), and we are incredibly grateful for his founding contributions to the firmware. We've had to break the fork due to purely technical reasons - it simply became too different over time, and we've had to start refactoring some of the basic bits and pieces. We are huge fans of TMK and Hasu :) This documentation is edited and maintained by Erez Zukerman of ErgoDox EZ. If you spot any typos or inaccuracies, please [open an issue](https://github.com/jackhumbert/qmk_firmware/issues/new). -The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and the Clueboard by [Zach White](https://github.com/skullydazed). +The OLKB product firmwares are maintained by [Jack Humbert](https://github.com/jackhumbert), the Ergodox EZ by [Erez Zukerman](https://github.com/ezuk), and the Clueboard by [Zach White](https://github.com/skullydazed). ## Documentation roadmap -This is not a tiny project. While this is the main Readme, there are many other files you might want to consult. Here are some points of interest: +This is not a tiny project. While this is the main readme, there are many other files you might want to consult. Here are some points of interest: -* The Readme for your own keyboard: This is found under `keyboards//`. So for the ErgoDox EZ, it's [here](keyboards/ergodox_ez/); for the Atomic, it's [here](keyboards/atomic/) and so on. -* The [build guide](doc/BUILD_GUIDE.md), also mentioned in the next section. This is how you put your development environment together so you can compile the firmware. +* The readme for your own keyboard: This is found under `keyboards//`. So for the ErgoDox EZ, it's [here](keyboards/ergodox_ez/); for the Planck, it's [here](keyboards/planck/) and so on. * The list of possible keycodes you can use in your keymap is actually spread out in a few different places: - * [tmk_core/common/keycode.h](tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file. * [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes. - * [quantum/keymap_common.h](quantum/keymap_common.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap_common.h` is where they're actually defined. -* The [TMK documentation](doc/TMK_README.md). QMK is based on TMK, and this explains how it works internally. + * [quantum/keymap.h](quantum/keymap.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap.h` is where they're actually defined. +* The [TMK documentation](doc/TMK_readme.md). QMK is based on TMK, and this explains how it works internally. -## Getting started +# Getting started -* [BUILD_GUIDE.md](doc/BUILD_GUIDE.md) contains instructions to set up a build environment, build the firmware, and deploy it to a keyboard. Once your build environment has been set up, all `make` commands to actually build the firmware must be run from a folder in `keyboards/`. -* If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboards/` and run the make commands from there. -* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `util/new_project.sh `, which will create `/keyboards/` with all the necessary components for a Quantum project. +Before you are able to compile, you'll need to install an environment for AVR development. You'll find the instructions for any OS below. If you find another/better way to set things up from scratch, please consider [making a pull request](https://github.com/jackhumbert/qmk_firmware/pulls) with your changes! -### Makefile Options +## Build Environment Setup -You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you. +### Windows (Vista and later) +1. If you have ever installed WinAVR, uninstall it. +2. Install [MHV AVR Tools](https://infernoembedded.com/sites/default/files/project/MHV_AVR_Tools_20131101.exe). Disable smatch, but **be sure to leave the option to add the tools to the PATH checked**. +3. Install [MinGW](https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download). During installation, uncheck the option to install a graphical user interface. **DO NOT change the default installation folder.** The scripts depend on the default location. +4. Clone this repository. [This link will download it as a zip file, which you'll need to extract.](https://github.com/jackhumbert/qmk_firmware/archive/master.zip) Open the extracted folder in Windows Explorer. +5. Double-click on the 1-setup-path-win batch script to run it. You'll need to accept a User Account Control prompt. Press the spacebar to dismiss the success message in the command prompt that pops up. +6. Right-click on the 2-setup-environment-win batch script, select "Run as administrator", and accept the User Account Control prompt. This part may take a couple of minutes, and you'll need to approve a driver installation, but once it finishes, your environment is complete! +7. Future build commands should be run from the standard Windows command prompt, which you can find by searching for "command prompt" from the start menu or start screen. Ignore the "MHV AVR Shell". - BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality - MIDI_ENABLE = yes # MIDI controls - UNICODE_ENABLE = no # <-- This is how you disable an option, just set it to "no" - BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID +### Mac +If you're using [homebrew,](http://brew.sh/) you can use the following commands: + + brew tap osx-cross/avr + brew install avr-libc + brew install dfu-programmer + +This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. + +You can also try these instructions: + +1. Install Xcode from the App Store. +2. Install the Command Line Tools from `Xcode->Preferences->Downloads`. +3. Install [DFU-Programmer][dfu-prog]. + +### Linux +Install AVR GCC, AVR libc, and dfu-progammer with your favorite package manager. + +Debian/Ubuntu example: + + sudo apt-get update + sudo apt-get install gcc-avr avr-libc dfu-programmer + +### Vagrant +If you have any problems building the firmware, you can try using a tool called Vagrant. It will set up a virtual computer with a known configuration that's ready-to-go for firmware building. OLKB does NOT host the files for this virtual computer. Details on how to set up Vagrant are in the [VAGRANT_GUIDE file](VAGRANT_GUIDE.md). + +## Verify Your Installation +1. If you haven't already, obtain this repository ([https://github.com/jackhumbert/qmk_firmware](https://github.com/jackhumbert/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application. +2. Open up a terminal or command prompt and navigate to the `qmk_firmware` folder using the `cd` command. The command prompt will typically open to your home directory. If, for example, you cloned the repository to your Documents folder, then you would type `cd Documents/qmk_firmware`. If you extracted the file from a zip, then it may be named `qmk_firmware-master` instead. +3. To confirm that you're in the correct location, you can display the contents of your current folder using the `dir` command on Windows, or the `ls` command on Linux or Mac. You should see several files, including `readme.md` and a `quantum` folder. From here, you need to navigate to the appropriate folder under `keyboards/`. For example, if you're building for a Planck, run `cd keyboards/planck`. +4. Once you're in the correct keyboard-specific folder, run the `make` command. This should output a lot of information about the build process. More information about the `make` command can be found below. + +# Customizing, building, and flashing your keymap + +In every keymap folder, the following files are recommended: + +* `config.h` - the options to configure your keymap +* `keymap.c` - all of your keymap code, required +* `Makefile` - the features of QMK that are enabled, required to run `make` in your keymap folder +* `readme.md` - a description of your keymap, how others might use it, and explanations of features + +## The `make` command + +The `make` command is how you compile the firmware into a .hex file, which can be loaded by a dfu programmer (like dfu-progammer via `make dfu`) or the [Teensy loader](https://www.pjrc.com/teensy/loader.html) (only used with Teensys). You can run `make` from the root (`/`), your keyboard folder (`/keyboards//`), or your keymap folder (`/keyboards//keymaps//`) if you have a `Makefile` there (see the example [here](/doc/keymap_makefile_example.mk)). + +By default, this will generate a `_.hex` file in whichever folder you run `make` from. These files are ignored by git, so don't worry about deleting them when committing/creating pull requests. Your .hex file will also be available on qmk.fm/keyboards//keymaps//. + +Below are some definitions that will be useful: + +* The "root" (`/`) folder is the qmk_firmware folder, in which are `doc`, `keyboard`, `quantum`, etc. +* The "keyboard" folder is any keyboard project's folder, like `/keyboards/planck`. +* The "keymap" folder is any keymap's folder, like `/keyboards/planck/keymaps/default`. + +Below is a list of the useful `make` commands in QMK: + +* `make` - cleans automatically and builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder + * `make keyboard=` - specifies the keyboard (only to be used in root) + * `make keymap=` - specifies the keymap (only to be used in root and keyboard folder - not needed when in keymap folder) +* `make quick` - skips the clean step (cannot be used immediately after modifying config.h or Makefiles) +* `make dfu` - (requires dfu-programmer) builds and flashes the keymap to your keyboard once placed in reset/dfu mode (button or press `KC_RESET`). This does not work for Teensy-based keyboards like the ErgoDox EZ. + * `keyboard=` and `keymap=` are compatible with this +* `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root) +* `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root) +* `make all-keymaps [keyboard=]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `` +* `make all-keyboards-quick`, `make all-keyboards-default-quick` and `make all-keymaps-quick [keyboard=]` - like the normal "make-all-*" commands, but they skip the clean steps + +Other, less useful functionality: + +* `make COLOR=false` - turns off color output +* `make SILENT=true` - turns off output besides errors/warnings +* `make VERBOSE=true` - outputs all of the avr-gcc stuff (not interesting) + +## The `Makefile` + +There are 3 different `make` and `Makefile` locations: + +* root (`/`) +* keyboard (`/keyboards//`) +* keymap (`/keyboards//keymaps//`) + +The root contains the code used to automatically figure out which keymap or keymaps to compile based on your current directory and commandline arguments. It's considered stable, and shouldn't be modified. The keyboard one will contain the MCU set-up and default settings for your keyboard, and shouldn't be modified unless you are the producer of that keyboard. The keymap Makefile can be modified by users, and is optional. It is included automatically if it exists. You can see an example [here](/doc/keymap_makefile_example.mk) - the last few lines are the most important. The settings you set here will override any defaults set in the keyboard Makefile. **It is required if you want to run `make` in the keymap folder.** + +### Makefile options + +Set the variables to `no` to disable them, and `yes` to enable them. + +`BOOTMAGIC_ENABLE` + +This allows you to hold a key and the salt key (space by default) and have access to a various EEPROM settings that persist over power loss. It's advised you keep this disabled, as the settings are often changed by accident, and produce confusing results that makes it difficult to debug. It's one of the more common problems encountered in help sessions. + +`MOUSEKEY_ENABLE` + +This gives you control over cursor movements and clicks via keycodes/custom functions. + +`EXTRAKEY_ENABLE` + +This allows you to use the system and audio control key codes. + +`CONSOLE_ENABLE` + +TODO + +`COMMAND_ENABLE` + +TODO + +`SLEEP_LED_ENABLE` + +Enables your LED to breath while your computer is sleeping. Timer1 is being used here. This feature is largely unused and untested, and needs updating/abstracting. + +`NKRO_ENABLE` + +This allows for n-key rollover (default is 6) to be enabled. It is off by default, but can be forced by adding `#define FORCE_NKRO` to your config.h. + +`BACKLIGHT_ENABLE` + +This enables your backlight on Timer1 and ports B5, B6, or B7 (for now). You can specify your port by putting this in your `config.h`: + + #define BACKLIGHT_PIN B7 + +`MIDI_ENABLE` + +This enables MIDI sending and receiving with your keyboard. To enter MIDI send mode, you can use the keycode `MI_ON`, and `MI_OFF` to turn it off. This is a largely untested feature, but more information can be found in the `quantum/quantum.c` file. + +`UNICODE_ENABLE` + +This allows you to send unicode symbols via `UC()` in your keymap. Only codes up to 0x7FFF are currently supported. + +`BLUETOOTH_ENABLE` + +This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly. It uses the D2 and D3 pins. + +`AUDIO_ENABLE` + +This allows you output audio on the C6 pin (needs abstracting). See the [audio section](#driving-a-speaker---audio-support) for more information. ### Customizing Makefile options on a per-keymap basis -If your keymap directory has a file called `Makefile` (note the filename), any Makefile options you set in that file will take precedence over other Makefile options (those set for Quantum as a whole or for your particular keyboard). +If your keymap directory has a file called `Makefile` (note the filename), any Makefile options you set in that file will take precedence over other Makefile options for your particular keyboard. -So let's say your keyboard's makefile has `CONSOLE_ENABLE = yes` (or maybe doesn't even list the `CONSOLE_ENABLE` option, which would cause it to revert to the global Quantum default). You want your particular keymap to not have the debug console, so you make a file called `Makefile` and specify `CONSOLE_ENABLE = no`. +So let's say your keyboard's makefile has `BACKLIGHT_ENABLE = yes` (or maybe doesn't even list the `BACKLIGHT_ENABLE` option, which would cause it to be off). You want your particular keymap to not have the debug console, so you make a file called `Makefile` and specify `BACKLIGHT_ENABLE = no`. -### Customizing config.h on a per-keymap basis +You can use the `doc/keymap_makefile_example.md` as a template/starting point. -You can also make a `config.h` file in your keymap directory and use it to override any `config.h` settings you don't like. Anything you set there will take precedence over the global `config.h` for the ErgoDox EZ. To see an example of this, check out `keymaps/erez_experimental`. +## The `config.h` file -## Quick aliases to common actions +There are 2 `config.h` locations: -Your keymap can include shortcuts to common operations (called "function actions" in tmk). +* keyboard (`/keyboards//`) +* keymap (`/keyboards//keymaps//`) + +The keyboard `config.h` is included only if the keymap one doesn't exist. The format to use for your custom one [is here](/doc/keymap_config_h_example.h). If you want to override a setting from the parent `config.h` file, you need to do this: + +```c +#undef MY_SETTING +#define MY_SETTING 4 +``` + +For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it. + +You can then override any settings, rather than having to copy and paste the whole thing. + +## Editing your keymap + +Aside from the [basic keycodes](doc/keycode.txt), your keymap can include shortcuts to common operations. ### Switching and toggling layers @@ -134,7 +284,6 @@ These are the values you can use for the `mod` in `MT()` and `OSM()` (right-hand * MOD_HYPR * MOD_MEH - These can also be combined like `MOD_LCTL | MOD_LSFT` e.g. `MT(MOD_LCTL | MOD_LSFT, KC_ESC)` which would activate Control and Shift when held, and send Escape when tapped. We've added shortcuts to make common modifier/tap (mod-tap) mappings more compact: @@ -415,9 +564,59 @@ You can currently send 4 hex digits with your OS-specific modifier key (RALT for Enable the backlight from the Makefile. -## Driving a speaker - audio support +# Custom Quantum functions for keyboards and keymaps -Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any keyboard that allows access to the C6 port, you can hook up a simple speaker and have it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes. +All of these functions are available in the `*_kb()` or `*_user()` variety. `kb` ones should only be used in the `/.c` file, and `user` ones should only be used in the `keymap.c`. The keyboard ones call the user ones - it's necessary to keep these calls to allow the keymap functions to work correctly. + +## `void martix_init_*(void)` + +This function gets called when the matrix is initiated, and can contain start-up code for your keyboard/keymap. + +## `void matrix_scan_*(void)` + +This function gets called at every matrix scan, which is basically as often as the MCU can handle. Be careful what you put here, as it will get run a lot. + +## `bool process_record_*(uint16_t keycode, keyrecord_t *record)` + +This function gets called on every keypress/release, and is where you can define custom functionality. The return value is whether or not QMK should continue processing the keycode - returning `false` stops the execution. + +The `keycode` variable is whatever is defined in your keymap, eg `MO(1)`, `KC_L`, etc. and can be switch-cased to execute code whenever a particular code is pressed. + +The `record` variable contains infomation about the actual press: + +``` +keyrecord_t record { + keyevent_t event { + keypos_t key { + uint8_t col + uint8_t row + } + bool pressed + uint16_t time + } +} +``` + +The conditional `if (record->event.pressed)` can tell if the key is being pressed or released, and you can execute code based on that. + +## `void led_set_*(uint8_t usb_led)` + +This gets called whenever there is a state change on your host LEDs (eg caps lock, scroll lock, etc). The LEDs are defined as: + +``` +#define USB_LED_NUM_LOCK 0 +#define USB_LED_CAPS_LOCK 1 +#define USB_LED_SCROLL_LOCK 2 +#define USB_LED_COMPOSE 3 +#define USB_LED_KANA 4 +``` + +and can be tested against the `usb_led` with a conditional like `if (usb_led & (1<` script to help get you started - you can simply pass your keyboard's name into the script, and all of the necessary files will be created. The components of each are described below. + +## `/keyboards//config.h` + +The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine. + +Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward. + +The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly. + +For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect. + +`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported. + +`BACKLIGHT_BREATHING` is a fancier backlight feature, and uses one of the timers. + +`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number. + +## `/keyboards//Makefile` + +The values at the top likely won't need to be changed, since most boards use the `atmega32u4` chip. The `BOOTLOADER_SIZE` will need to be adjusted based on your MCU type. It's defaulted to the Teensy, since that's the most common controller. Below is quoted from the `Makefile`. + +``` +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=512 +``` + +At the bottom of the file, you'll find lots of features to turn on and off - all of these options should be set with `?=` to allow for the keymap overrides. `?=` only assigns if the variable was previously undefined. For the full documenation of these features, see the [Makefile options](#makefile-options). + +## `/keyboards//readme.md` + +This is where you'll describe your keyboard - please write as much as you can about it! Talking about default functionality/features is useful here. Feel free to link to external pages/sites if necessary. Images can be included here as well. This file will be rendered into a webpage at qmk.fm/keyboards//. + +## `/keyboards//.c` + +This is where all of the custom logic for your keyboard goes - you may not need to put anything in this file, since a lot of things are configured automatically. All of the `*_kb()` functions are defined here. If you modify them, remember to keep the calls to `*_user()`, or things in the keymaps might not work. You can read more about the functions [here](#custom-quantum-functions-for-keyboards-and-keymaps) + +## `/keyboards//.h` + +Here is where you can (optionally) define your `KEYMAP` function to remap your matrix into a more readable format. With ortholinear boards, this isn't always necessary, but it can help to accomodate the dead spots on your matrix, where there are keys that take up more than one space (2u, staggering, 6.25u, etc). The example shows the difference between the physical keys, and the matrix design: + +``` +#define KEYMAP( \ + k00, k01, k02, \ + k10, k11 \ +) \ +{ \ + { k00, k01, k02 }, \ + { k10, KC_NO, k11 }, \ +} +``` + +Each of the `kxx` variables needs to be unique, and usually follows the format `k`. You can place `KC_NO` where your dead keys are in your matrix. diff --git a/tmk_core/common/led.h b/tmk_core/common/led.h index 9dc8987802..61c971c107 100644 --- a/tmk_core/common/led.h +++ b/tmk_core/common/led.h @@ -34,10 +34,6 @@ extern "C" { void led_set(uint8_t usb_led); -/* keyboard-specific LED functionality */ -void led_set_kb(uint8_t usb_led); - - void led_init_ports(void); #ifdef __cplusplus diff --git a/tmk_core/common/matrix.h b/tmk_core/common/matrix.h index 5f380aaaba..5f2f831b45 100644 --- a/tmk_core/common/matrix.h +++ b/tmk_core/common/matrix.h @@ -76,6 +76,13 @@ void matrix_power_down(void); /* executes code for Quantum */ void matrix_init_quantum(void); void matrix_scan_quantum(void); + +void matrix_init_kb(void); +void matrix_scan_kb(void); + +void matrix_init_user(void); +void matrix_scan_user(void); + #ifdef __cplusplus } #endif diff --git a/tmk_core/protocol/lufa/LUFA-git/LUFA/StudioIntegration/makefile b/tmk_core/protocol/lufa/LUFA-git/LUFA/StudioIntegration/makefile index 2649598d9f..9d6329b5fe 100644 --- a/tmk_core/protocol/lufa/LUFA-git/LUFA/StudioIntegration/makefile +++ b/tmk_core/protocol/lufa/LUFA-git/LUFA/StudioIntegration/makefile @@ -109,7 +109,7 @@ generate_vsix: $(EXTENSION_OUTPUT_XML) $(MODULE_OUTPUT_XML) $(MSHELP_OUTPUT_XML) @echo Archiving XDK content... @rm -f contents.zip - @cd $(LUFA_ROOT)/../ && zip contents.zip -q -0 -r --exclude=*Documentation* --exclude=*StudioIntegration* LUFA Bootloaders Demos Projects README.txt + @cd $(LUFA_ROOT)/../ && zip contents.zip -q -0 -r --exclude=*Documentation* --exclude=*StudioIntegration* LUFA Bootloaders Demos Projects readme.txt @echo Creating VSIX dependencies... @cp $(VSIX_ASSETS) $(LUFA_ROOT)/.. diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md similarity index 100% rename from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md rename to tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md similarity index 100% rename from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md rename to tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md diff --git a/tmk_core/protocol/vusb/usbdrv/Changelog.txt b/tmk_core/protocol/vusb/usbdrv/Changelog.txt index 5c6354ab1e..1e74180a9e 100644 --- a/tmk_core/protocol/vusb/usbdrv/Changelog.txt +++ b/tmk_core/protocol/vusb/usbdrv/Changelog.txt @@ -28,7 +28,7 @@ Scroll down to the bottom to see the most recent changes. - Added (free) default Vendor- and Product-IDs bought from voti.nl. - Added USBID-License.txt file which defines the rules for using the free shared VID/PID pair. - - Added Readme.txt to the usbdrv directory which clarifies administrative + - Added readme.txt to the usbdrv directory which clarifies administrative issues. 2006-01-25: diff --git a/tmk_core/protocol/vusb/usbdrv/License.txt b/tmk_core/protocol/vusb/usbdrv/License.txt index 4460cfbae0..ce4c3aed45 100644 --- a/tmk_core/protocol/vusb/usbdrv/License.txt +++ b/tmk_core/protocol/vusb/usbdrv/License.txt @@ -10,7 +10,7 @@ Use the form at http://www.obdev.at/vusb/feedback.html for your submission. (2) Adhere to minimum publication standards. Please include AT LEAST: - a circuit diagram in PDF, PNG or GIF format - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the + - a readme.txt file in ASCII format which describes the purpose of the project and what can be found in which directories and which files - a reference to http://www.obdev.at/vusb/ diff --git a/tmk_core/protocol/vusb/usbdrv/Readme.txt b/tmk_core/protocol/vusb/usbdrv/Readme.txt index 970dc66b2f..3cff49f6fa 100644 --- a/tmk_core/protocol/vusb/usbdrv/Readme.txt +++ b/tmk_core/protocol/vusb/usbdrv/Readme.txt @@ -1,4 +1,4 @@ -This is the Readme file to Objective Development's firmware-only USB driver +This is the readme file to Objective Development's firmware-only USB driver for Atmel AVR microcontrollers. For more information please visit http://www.obdev.at/vusb/ @@ -15,7 +15,7 @@ file "usbdrv.h". Please read all of it carefully! Configuration options are documented in "usbconfig-prototype.h". The driver consists of the following files: - Readme.txt ............. The file you are currently reading. + readme.txt ............. The file you are currently reading. Changelog.txt .......... Release notes for all versions of the driver. usbdrv.h ............... Driver interface definitions and technical docs. * usbdrv.c ............... High level language part of the driver. Link this @@ -155,7 +155,7 @@ http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects. (2) Adhere to minimum publication standards. Please include AT LEAST: - a circuit diagram in PDF, PNG or GIF format - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the + - a readme.txt file in ASCII format which describes the purpose of the project and what can be found in which directories and which files - a reference to http://www.obdev.at/vusb/ diff --git a/tmk_core/README.md b/tmk_core/readme.md similarity index 100% rename from tmk_core/README.md rename to tmk_core/readme.md diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 07700283e7..aaaba1c2c9 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -40,7 +40,7 @@ OPT = s # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. DEBUG = dwarf-2 -COLOR?=true +COLOR ?= true ifeq ($(COLOR),true) NO_COLOR=\033[0m @@ -129,10 +129,8 @@ CFLAGS += -fshort-enums CFLAGS += -fno-strict-aliasing # add color ifeq ($(COLOR),true) -ifeq ("$(echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "") +ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "") CFLAGS+= -fdiagnostics-color -else ifeq ("$(echo "int main(){}" | $(CC) -fcolor-diagnostics -x c - -o /dev/null 2>&1)", "") - CFLAGS+= -fcolor-diagnostics endif endif CFLAGS += -Wall @@ -450,15 +448,6 @@ endif dfu-programmer $(MCU) flash $(BUILD_DIR)/$(TARGET).hex dfu-programmer $(MCU) reset -dfu-no-build: -ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1))) - dfu-programmer $(MCU) erase --force -else - dfu-programmer $(MCU) erase -endif - dfu-programmer $(MCU) flash $(KEYMAP_PATH)/compiled.hex - dfu-programmer $(MCU) reset - dfu-start: dfu-programmer $(MCU) reset dfu-programmer $(MCU) start @@ -536,9 +525,6 @@ extcoff: $(BUILD_DIR)/$(TARGET).elf $(eval CMD=$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@) @$(BUILD_CMD) @$(COPY) $@ $(TARGET).hex - $(SILENT) || printf "Copying $(TARGET).hex to keymaps/$(KEYMAP)/compiled.hex" | $(AWK_CMD) - $(eval CMD=$(COPY) $@ $(KEYMAP_PATH)/compiled.hex) - @$(BUILD_CMD) %.eep: %.elf @$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_CMD) diff --git a/util/new_project.sh b/util/new_project.sh index 9ab8d6fbbc..b3535f449e 100755 --- a/util/new_project.sh +++ b/util/new_project.sh @@ -7,6 +7,8 @@ if [ -z "$1" ]; then exit 1 fi +cd "$(dirname "$0")/.." + KEYBOARD=$1 KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}') @@ -16,12 +18,14 @@ mkdir keyboards/$1/keymaps/default sed -e "s;%KEYBOARD%;$KEYBOARD;g" -e "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" quantum/template/template.h > keyboards/$KEYBOARD/$KEYBOARD.h sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/template.c > keyboards/$KEYBOARD/$KEYBOARD.c sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/config.h > keyboards/$KEYBOARD/config.h -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/README.md > keyboards/$KEYBOARD/README.md +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/readme.md > keyboards/$KEYBOARD/readme.md sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/Makefile > keyboards/$KEYBOARD/Makefile +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/config.h > keyboards/$KEYBOARD/keymaps/default/config.h sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/keymap.c > keyboards/$KEYBOARD/keymaps/default/keymap.c +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/Makefile > keyboards/$KEYBOARD/keymaps/default/Makefile +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/readme.md > keyboards/$KEYBOARD/keymaps/default/readme.md echo "######################################################" -echo "# keyboards/$KEYBOARD project created. To start" -echo "# working on things, use the following command:" -echo "# cd keyboards/$KEYBOARD" +echo "# /keyboards/$KEYBOARD project created. To start" +echo "# working on things, cd into keyboards/$KEYBOARD" echo "######################################################"