summaryrefslogtreecommitdiffstats
path: root/quantum/quantum.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/quantum.h')
-rw-r--r--quantum/quantum.h153
1 files changed, 76 insertions, 77 deletions
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 2cb26d4f46..066113590e 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -16,12 +16,12 @@
#pragma once
#if defined(__AVR__)
- #include <avr/pgmspace.h>
- #include <avr/io.h>
- #include <avr/interrupt.h>
+# include <avr/pgmspace.h>
+# include <avr/io.h>
+# include <avr/interrupt.h>
#endif
#if defined(PROTOCOL_CHIBIOS)
- #include "hal.h"
+# include "hal.h"
#endif
#include "wait.h"
@@ -29,23 +29,23 @@
#include "keymap.h"
#ifdef BACKLIGHT_ENABLE
- #ifdef LED_MATRIX_ENABLE
- #include "ledmatrix.h"
- #else
- #include "backlight.h"
- #endif
+# ifdef LED_MATRIX_ENABLE
+# include "ledmatrix.h"
+# else
+# include "backlight.h"
+# endif
#endif
#if defined(RGBLIGHT_ENABLE)
- #include "rgblight.h"
+# include "rgblight.h"
#elif defined(RGB_MATRIX_ENABLE)
- // Dummy define RGBLIGHT_MODE_xxxx
- #define RGBLIGHT_H_DUMMY_DEFINE
- #include "rgblight.h"
+// Dummy define RGBLIGHT_MODE_xxxx
+# define RGBLIGHT_H_DUMMY_DEFINE
+# include "rgblight.h"
#endif
#ifdef RGB_MATRIX_ENABLE
- #include "rgb_matrix.h"
+# include "rgb_matrix.h"
#endif
#include "action_layer.h"
@@ -64,120 +64,119 @@
extern layer_state_t default_layer_state;
#ifndef NO_ACTION_LAYER
- extern layer_state_t layer_state;
+extern layer_state_t layer_state;
#endif
#if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)
- #include "process_midi.h"
+# include "process_midi.h"
#endif
#ifdef AUDIO_ENABLE
- #include "audio.h"
- #include "process_audio.h"
- #ifdef AUDIO_CLICKY
- #include "process_clicky.h"
- #endif
+# include "audio.h"
+# include "process_audio.h"
+# ifdef AUDIO_CLICKY
+# include "process_clicky.h"
+# endif
#endif
#ifdef STENO_ENABLE
- #include "process_steno.h"
+# include "process_steno.h"
#endif
#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
- #include "process_music.h"
+# include "process_music.h"
#endif
#ifdef LEADER_ENABLE
- #include "process_leader.h"
+# include "process_leader.h"
#endif
#ifdef UNICODE_ENABLE
- #include "process_unicode.h"
+# include "process_unicode.h"
#endif
#ifdef UCIS_ENABLE
- #include "process_ucis.h"
+# include "process_ucis.h"
#endif
#ifdef UNICODEMAP_ENABLE
- #include "process_unicodemap.h"
+# include "process_unicodemap.h"
#endif
#ifdef TAP_DANCE_ENABLE
- #include "process_tap_dance.h"
+# include "process_tap_dance.h"
#endif
#ifdef PRINTING_ENABLE
- #include "process_printer.h"
+# include "process_printer.h"
#endif
#ifdef AUTO_SHIFT_ENABLE
- #include "process_auto_shift.h"
+# include "process_auto_shift.h"
#endif
#ifdef COMBO_ENABLE
- #include "process_combo.h"
+# include "process_combo.h"
#endif
#ifdef KEY_LOCK_ENABLE
- #include "process_key_lock.h"
+# include "process_key_lock.h"
#endif
#ifdef TERMINAL_ENABLE
- #include "process_terminal.h"
+# include "process_terminal.h"
#else
- #include "process_terminal_nop.h"
+# include "process_terminal_nop.h"
#endif
#ifdef SPACE_CADET_ENABLE
- #include "process_space_cadet.h"
+# include "process_space_cadet.h"
#endif
#ifdef HD44780_ENABLE
- #include "hd44780.h"
+# include "hd44780.h"
#endif
#ifdef HAPTIC_ENABLE
- #include "haptic.h"
+# include "haptic.h"
#endif
#ifdef OLED_DRIVER_ENABLE
- #include "oled_driver.h"
+# include "oled_driver.h"
#endif
// Function substitutions to ease GPIO manipulation
#if defined(__AVR__)
- typedef uint8_t pin_t;
+typedef uint8_t pin_t;
- #define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF))
- #define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF), \
- PORTx_ADDRESS(pin) |= _BV((pin) & 0xF))
- #define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low")
- #define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin) & 0xF))
+# define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF))
+# define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF))
+# define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low")
+# define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF))
- #define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin) & 0xF))
- #define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin) & 0xF))
- #define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
+# define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin)&0xF))
+# define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF))
+# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
- #define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin) & 0xF)))
+# define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF)))
#elif defined(PROTOCOL_CHIBIOS)
- typedef ioline_t pin_t;
+typedef ioline_t pin_t;
- #define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT)
- #define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP)
- #define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN)
- #define setPinOutput(pin) palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL)
+# define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT)
+# define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP)
+# define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN)
+# define setPinOutput(pin) palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL)
- #define writePinHigh(pin) palSetLine(pin)
- #define writePinLow(pin) palClearLine(pin)
- #define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
+# define writePinHigh(pin) palSetLine(pin)
+# define writePinLow(pin) palClearLine(pin)
+# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
- #define readPin(pin) palReadLine(pin)
+# define readPin(pin) palReadLine(pin)
#endif
// Send string macros
#define STRINGIZE(z) #z
-#define ADD_SLASH_X(y) STRINGIZE(\x ## y)
+#define ADD_SLASH_X(y) STRINGIZE(\x##y)
#define SYMBOL_STR(x) ADD_SLASH_X(x)
#define SS_TAP_CODE 1
@@ -200,8 +199,8 @@ extern layer_state_t default_layer_state;
#define SEND_STRING(string) send_string_P(PSTR(string))
-extern const bool ascii_to_shift_lut[128];
-extern const bool ascii_to_altgr_lut[128];
+extern const bool ascii_to_shift_lut[128];
+extern const bool ascii_to_altgr_lut[128];
extern const uint8_t ascii_to_keycode_lut[128];
void send_string(const char *str);
@@ -211,31 +210,31 @@ void send_string_with_delay_P(const char *str, uint8_t interval);
void send_char(char ascii_code);
// For tri-layer
-void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
+void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3);
void set_single_persistent_default_layer(uint8_t default_layer);
void tap_random_base64(void);
-#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
+#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
#define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer)))
-void matrix_init_kb(void);
-void matrix_scan_kb(void);
-void matrix_init_user(void);
-void matrix_scan_user(void);
+void matrix_init_kb(void);
+void matrix_scan_kb(void);
+void matrix_init_user(void);
+void matrix_scan_user(void);
uint16_t get_record_keycode(keyrecord_t *record);
uint16_t get_event_keycode(keyevent_t event);
-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);
+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);
#ifndef BOOTMAGIC_LITE_COLUMN
- #define BOOTMAGIC_LITE_COLUMN 0
+# define BOOTMAGIC_LITE_COLUMN 0
#endif
#ifndef BOOTMAGIC_LITE_ROW
- #define BOOTMAGIC_LITE_ROW 0
+# define BOOTMAGIC_LITE_ROW 0
#endif
void bootmagic_lite(void);
@@ -256,7 +255,7 @@ void backlight_task_internal(void);
void backlight_on(uint8_t backlight_pin);
void backlight_off(uint8_t backlight_pin);
- #ifdef BACKLIGHT_BREATHING
+# ifdef BACKLIGHT_BREATHING
void breathing_task(void);
void breathing_enable(void);
void breathing_pulse(void);
@@ -270,13 +269,13 @@ void breathing_period_default(void);
void breathing_period_set(uint8_t value);
void breathing_period_inc(void);
void breathing_period_dec(void);
- #endif
+# endif
#endif
-void send_dword(uint32_t number);
-void send_word(uint16_t number);
-void send_byte(uint8_t number);
-void send_nibble(uint8_t number);
+void send_dword(uint32_t number);
+void send_word(uint16_t number);
+void send_byte(uint8_t number);
+void send_nibble(uint8_t number);
uint16_t hex_to_keycode(uint8_t hex);
void led_set_user(uint8_t usb_led);