1
0
Fork 0

Warning reductions (#430)

Warning reductions
This commit is contained in:
Jack Humbert 2016-06-21 17:42:29 -04:00 committed by GitHub
parent 758a8c64e9
commit 1a0bac8bcc
55 changed files with 168 additions and 160 deletions

View file

@ -4,6 +4,7 @@
#include "quantum.h"
#include <stddef.h>
#include <avr/io.h>
#include <avr/interrupt.h>
// This a shortcut to help you visually see your layout.
// The following is an example using the Planck MIT layout

View file

@ -202,7 +202,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
break;
case MACRO_PARENTHESE:
if (record->event.pressed) {
return MACRO( D(LSHIFT),T(LPRN), T(RPRN),U(LSHIFT), T(SCOLON), END);
return MACRO( D(LSHIFT),T(9), T(0),U(LSHIFT), T(SCOLON), END);
}
break;
}

View file

@ -68,7 +68,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
M(OBRACE), KC_SLSH,KC_Q, KC_J, KC_K, KC_X, KC_LGUI,
M(OBRACK), KC_HOME,KC_PGDN,KC_PGUP,KC_END,
LCAG_T(KC_F5), LT(AUX, KC_F6),
MT(MOD_LALT | MOD_LCTL, KC_F4),
MT((MOD_LALT | MOD_LCTL), KC_F4),
KC_ENT,KC_TAB,MT((MOD_LALT | MOD_LSFT), KC_F3),
// right hand
KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS,
@ -77,8 +77,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_RALT, KC_B, KC_M, KC_W, KC_V, KC_Z, M(CBRACE),
KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,M(CBRACK),
LT(AUX, KC_F7), LCAG_T(KC_F8),
MT(MOD_LALT | MOD_LCTL, KC_F11),
MT(MOD_LALT | MOD_LSFT, KC_F12),KC_BSPC, KC_SPC
MT((MOD_LALT | MOD_LCTL), KC_F11),
MT((MOD_LALT | MOD_LSFT), KC_F12),KC_BSPC, KC_SPC
),
/* Keymap 1: Aux layer
*
@ -154,7 +154,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
M(OBRACE), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LGUI,
M(OBRACK), KC_HOME,KC_PGDN,KC_PGUP,KC_END,
LCAG_T(KC_F5), KC_TRNS,
MT(MOD_LALT | MOD_LCTL, KC_F4),
MT((MOD_LALT | MOD_LCTL), KC_F4),
KC_ENT,KC_TAB,KC_TRNS,
// right hand
KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS,
@ -163,8 +163,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_RALT, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,M(CBRACE),
KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,M(CBRACK),
KC_TRNS, LCAG_T(KC_F8),
MT(MOD_LALT | MOD_LCTL, KC_F11),
MT(MOD_LALT | MOD_LSFT, KC_F12),KC_BSPC, KC_SPC
MT((MOD_LALT | MOD_LCTL), KC_F11),
MT((MOD_LALT | MOD_LSFT), KC_F12),KC_BSPC, KC_SPC
),
};

View file

@ -6,4 +6,7 @@
#define ONESHOT_TAP_TOGGLE 2
#define ONESHOT_TIMEOUT 300
#undef LEADER_TIMEOUT
#define LEADER_TIMEOUT 300
#endif

View file

@ -7,8 +7,6 @@
#define SYMB 1 // symbols
#define MDIA 2 // media keys
#define LEADER_TIMEOUT 300
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
@ -144,8 +142,6 @@ const uint16_t PROGMEM fn_actions[] = {
[3] = ACTION_MACRO_TAP(1) // Eric Tang's Famous Macro!
};
static uint16_t key_timer;
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
return MACRO_NONE;

View file

@ -3,6 +3,7 @@
#include "debug.h"
#include "action_layer.h"
#include "action_util.h"
#include "mousekey.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols layer

View file

@ -1,19 +1,7 @@
#include "ergodox_ez.h"
#include "debug.h"
#include "action_layer.h"
#include "keymap_extras/keymap_french.h"
#include "keymap_extras/keymap_neo2.h"
#include "keymap_extras/keymap_uk.h"
#include "keymap_extras/keymap_colemak.h"
#include "keymap_extras/keymap_french_osx.h"
#include "keymap_extras/keymap_nordic.h"
#include "keymap_extras/keymap_dvorak.h"
#include "keymap_extras/keymap_german.h"
#include "keymap_extras/keymap_norwegian.c"
#include "keymap_extras/keymap_fr_ch.h"
#include "keymap_extras/keymap_german_osx.h"
#include "keymap_extras/keymap_spanish.h"
#include "keymap_extras/keymap_bepo.h"
#include "keymap_german_osx.h"
#define BASE 0
#define SYMB 1

View file

@ -1,19 +1,19 @@
#include "ergodox_ez.h"
#include "debug.h"
#include "action_layer.h"
#include "keymap_extras/keymap_french.h"
#include "keymap_extras/keymap_neo2.h"
#include "keymap_extras/keymap_uk.h"
#include "keymap_extras/keymap_colemak.h"
#include "keymap_extras/keymap_french_osx.h"
#include "keymap_extras/keymap_nordic.h"
#include "keymap_extras/keymap_dvorak.h"
#include "keymap_extras/keymap_german.h"
#include "keymap_extras/keymap_norwegian.c"
#include "keymap_extras/keymap_fr_ch.h"
#include "keymap_extras/keymap_german_osx.h"
#include "keymap_extras/keymap_spanish.h"
#include "keymap_extras/keymap_bepo.h"
#include "keymap_neo2.h"
#include "keymap_uk.h"
#include "keymap_colemak.h"
#include "keymap_french_osx.h"
#include "keymap_nordic.h"
#include "keymap_dvorak.h"
#include "keymap_german.h"
#include "keymap_norwegian.c"
#include "keymap_fr_ch.h"
#include "keymap_german_osx.h"
#include "keymap_spanish.h"
#include "keymap_bepo.h"
#define BASE 0
#define SYMB 1
@ -128,7 +128,6 @@ const uint16_t PROGMEM fn_actions[] = {
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
static uint16_t start;
switch(id) {
case UNUSED:
//Macro: UNUSED//-----------------------

View file

@ -1,19 +1,17 @@
#include "ergodox_ez.h"
#include "debug.h"
#include "action_layer.h"
#include "keymap_extras/keymap_french.h"
#include "keymap_extras/keymap_neo2.h"
#include "keymap_extras/keymap_uk.h"
#include "keymap_extras/keymap_colemak.h"
#include "keymap_extras/keymap_french_osx.h"
#include "keymap_extras/keymap_nordic.h"
#include "keymap_extras/keymap_dvorak.h"
#include "keymap_extras/keymap_german.h"
#include "keymap_extras/keymap_norwegian.c"
#include "keymap_extras/keymap_fr_ch.h"
#include "keymap_extras/keymap_german_osx.h"
#include "keymap_extras/keymap_spanish.h"
#include "keymap_extras/keymap_bepo.h"
#include "keymap_neo2.h"
#include "keymap_uk.h"
#include "keymap_colemak.h"
#include "keymap_nordic.h"
#include "keymap_dvorak.h"
#include "keymap_german.h"
#include "keymap_norwegian.c"
#include "keymap_fr_ch.h"
#include "keymap_german_osx.h"
#include "keymap_spanish.h"
#include "keymap_bepo.h"
/**

View file

@ -2,7 +2,7 @@
#include "ergodox_ez.h"
#include "debug.h"
#include "action_layer.h"
#include "keymap_extras/keymap_french_osx.h"
#include "keymap_french_osx.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols

View file

@ -30,6 +30,7 @@ const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.

View file

@ -50,6 +50,7 @@ const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.

View file

@ -74,7 +74,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* disable debug print */
#define NO_DEBUG
// #define NO_DEBUG
/* disable print */
// #define NO_PRINT

View file

@ -333,7 +333,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
default:
return MACRO_NONE;
}
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.

View file

@ -1,8 +1,5 @@
# # project specific files
SRC = backlight.c
# MCU name
#MCU = at90usb1287
MCU = atmega32u4

View file

@ -1,61 +0,0 @@
#include <avr/io.h>
#include "backlight.h"
#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));
}
}

View file

@ -10,18 +10,72 @@ 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
if (matrix_init_user) {
(*matrix_init_user)();
}
matrix_init_user();
};
void matrix_scan_kb(void) {
if (matrix_scan_user) {
(*matrix_scan_user)();
}
matrix_scan_user();
};

View file

@ -5,6 +5,7 @@
#include "keymap.h"
#include "backlight.h"
#include <stddef.h>
#include <avr/io.h>
void matrix_init_user(void);
void matrix_scan_user(void);

View file

@ -19,8 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdint.h"
#include "led.h"
void led_init_ports() {
void led_init(void) {
// * Set our LED pins as output
DDRB |= (1<<6);
DDRB |= (1<<7);

View file

@ -1,4 +1,5 @@
#include "phantom.h"
#include "led.h"
__attribute__ ((weak))
void matrix_init_user(void) {
@ -13,16 +14,12 @@ void matrix_scan_user(void) {
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();
};
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
if (matrix_scan_user) {
(*matrix_scan_user)();
}
matrix_scan_user();
};

View file

@ -4,7 +4,7 @@
#include "matrix.h"
#include "keymap.h"
#include <stddef.h>
#include "action_util.h"
/* Phantom matrix layout
* ,-----------------------------------------------------------------------------.

View file

@ -0,0 +1,8 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
#define LEADER_TIMEOUT 300
#endif

View file

@ -321,8 +321,6 @@ void music_scale_user(void)
LEADER_EXTERNS();
#define LEADER_TIMEOUT 300
void matrix_scan_user(void) {
LEADER_DICTIONARY() {
leading = false;

View file

@ -12,6 +12,7 @@ If you have any question about this keymap feel free to shoot me a message on re
#include "keymap_extras/keymap_german.h"
#include "backlight.h"
#include "debug.h"
#include "action_layer.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = { /* Colemak
@ -111,7 +112,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{KC_NO, KC_NO, KC_TAB, KC_LALT, KC_NO, KC_SPC, KC_SPC, LCTL(KC_SPC), KC_LGUI, KC_LEFT, KC_DOWN, KC_RGHT}
},
[6] = { /* Gaming
/* CS:GO buy binds
* CS:GO buy binds
* ,-----------------------------------------------------------------------.
* | | | | | | | | | 7 | 8 | 9 | |
* |-----------------------------------------------------------------------|

View file

@ -2,6 +2,7 @@
#define PLANCK_H
#include "quantum.h"
#include <avr/interrupt.h>
#define PLANCK_MIT( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \

View file

@ -164,18 +164,20 @@ const uint16_t PROGMEM fn_actions[] = {
};
#ifdef AUDIO_ENABLE
float start_up[][2] = {
{440.0*pow(2.0,(14)/12.0), 20},
{440.0*pow(2.0,(26)/12.0), 8},
{440.0*pow(2.0,(18)/12.0), 20},
{440.0*pow(2.0,(26)/12.0), 8}
float tone_startup[][2] = {
{NOTE_B5, 20},
{NOTE_B6, 8},
{NOTE_DS6, 20},
{NOTE_B6, 8}
};
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float goodbye[][2] = SONG(GOODBYE_SOUND);
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
#endif
void persistant_default_layer_set(uint16_t default_layer) {
@ -242,20 +244,35 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(start_up, false, 0);
startup_user();
#endif
}
#ifdef AUDIO_ENABLE
void play_goodbye_tone()
void startup_user()
{
PLAY_NOTE_ARRAY(goodbye, false, 0);
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
}
void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
_delay_ms(150);
stop_all_notes();
}
void music_on_user(void)
{
music_scale_user();
}
void music_scale_user(void)
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
}
#endif

View file

@ -36,5 +36,6 @@
void matrix_init_user(void);
void matrix_scan_user(void);
bool process_action_kb(keyrecord_t *record);
void backlight_init_ports(void);
#endif

View file

@ -294,10 +294,10 @@ enum quantum_keycodes {
#define SFT_T(kc) MT(MOD_LSFT, kc)
#define ALT_T(kc) MT(MOD_LALT, kc)
#define GUI_T(kc) MT(MOD_LGUI, kc)
#define C_S_T(kc) MT(MOD_LCTL | MOD_LSFT, kc) // Control + Shift e.g. for gnome-terminal
#define MEH_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT, kc) // Meh is a less hyper version of the Hyper key -- doesn't include Win or Cmd, so just alt+shift+ctrl
#define LCAG_T(kc) MT(MOD_LCTL | MOD_LALT | MOD_LGUI, kc) // Left control alt and gui
#define ALL_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI, kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/
#define C_S_T(kc) MT((MOD_LCTL | MOD_LSFT), kc) // Control + Shift e.g. for gnome-terminal
#define MEH_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT), kc) // Meh is a less hyper version of the Hyper key -- doesn't include Win or Cmd, so just alt+shift+ctrl
#define LCAG_T(kc) MT((MOD_LCTL | MOD_LALT | MOD_LGUI), kc) // Left control alt and gui
#define ALL_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI), kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/
// Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap
#define KC_HYPR HYPR(KC_NO)

View file

@ -1,9 +1,6 @@
#ifndef KEYMAP_GERMAN_OSX
#define KEYMAP_GERMAN_OSX
#ifdef KEYMAP_GERMAN
#warning redefining german keys
#endif
#include "keymap.h"
// Alt gr

View file

@ -24,6 +24,12 @@ void led_set_kb(uint8_t usb_led) {
}
__attribute__ ((weak))
void led_init_ports(void)
{
}
__attribute__ ((weak))
void led_set(uint8_t usb_led)
{

View file

@ -66,7 +66,6 @@ static bool mousekey_console(uint8_t code);
static void mousekey_console_help(void);
#endif
static uint8_t numkey2num(uint8_t code);
static void switch_default_layer(uint8_t layer);
@ -763,7 +762,7 @@ static bool mousekey_console(uint8_t code)
/***********************************************************
* Utilities
***********************************************************/
static uint8_t numkey2num(uint8_t code)
uint8_t numkey2num(uint8_t code)
{
switch (code) {
case KC_1: return 1;

View file

@ -27,6 +27,7 @@ bool command_extra(uint8_t code);
bool command_console_extra(uint8_t code);
#ifdef COMMAND_ENABLE
uint8_t numkey2num(uint8_t code);
bool command_proc(uint8_t code);
#else
#define command_proc(code) false

View file

@ -37,6 +37,9 @@ 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
}
#endif

View file

@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "report.h"
#include "print.h"
#include "debug.h"
#include "../serial.h"
#include "bluetooth.h"
void bluefruit_keyboard_print_report(report_keyboard_t *report)

View file

@ -18,6 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef BLUETOOTH_H
#define BLUETOOTH_H
#include "../serial.h"
void bluefruit_serial_send(uint8_t data);
/*