diff options
| author | ishtob <ishtob@gmail.com> | 2018-12-04 11:04:57 -0500 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-12-04 08:04:57 -0800 |
| commit | 4099536c0e7a099b181a80e483b4b95f389b5a7e (patch) | |
| tree | 311c8a15013cce5ee9275fe8654c9b52dc9ca1e2 | |
| parent | 4bb28d2df092408a7a0e32a8d8ab47b7f4008fcd (diff) | |
| download | qmk_firmware-4099536c0e7a099b181a80e483b4b95f389b5a7e.tar.gz qmk_firmware-4099536c0e7a099b181a80e483b4b95f389b5a7e.zip | |
adding Hadron v3 keyboard, QWIIC devices support, haptic feedback support (#4462)
* add initial support for hadron ver3
* add initial support for hadron ver3
* pull qwiic support for micro_led to be modified for use in hadron's 64x24 ssd1306 oled display
* initial work on OLED using qwiic driver
* early work to get 128x32 oled working by redefining qwiic micro oled parameters. Currently working, but would affect qwiic's micro oled functionality
* moved oled defines to config.h and added ifndef to micro_oled driver
* WORKING :D - note, still work in progress to get the start location correct on the 128x32 display.
* added equation to automatically calculate display offset based on screen width
* adding time-out timer to oled display
* changed read lock staus via read_led_state
* lock indications fixes
* Added scroll lock indication to oled
* add support for DRV2605 haptic driver
* Improve readabiity of DRV2605 driver.
-added typedef for waveform library
-added unions for registers
* Update keyboards/hadron/ver2/keymaps/default/config.h
Co-Authored-By: ishtob <ishtob@gmail.com>
* Update keyboards/hadron/ver2/keymaps/default/config.h
Co-Authored-By: ishtob <ishtob@gmail.com>
* Update keyboards/hadron/ver2/keymaps/default/config.h
Co-Authored-By: ishtob <ishtob@gmail.com>
* Update keyboards/hadron/ver2/keymaps/default/config.h
Co-Authored-By: ishtob <ishtob@gmail.com>
* Fixes for PR
* PR fixes
* fix old persistent layer function to use new set_single_persistent_default_layer
* fix issues with changing makefile defines that broken per-key haptic pulse
* Comment fixes
* Add definable parameter and auto-calibration based on motor choice
51 files changed, 5532 insertions, 296 deletions
diff --git a/common_features.mk b/common_features.mk index 8f53a82aa..bd88e04d6 100644 --- a/common_features.mk +++ b/common_features.mk | |||
| @@ -225,6 +225,13 @@ ifeq ($(strip $(ENCODER_ENABLE)), yes) | |||
| 225 | OPT_DEFS += -DENCODER_ENABLE | 225 | OPT_DEFS += -DENCODER_ENABLE |
| 226 | endif | 226 | endif |
| 227 | 227 | ||
| 228 | ifeq ($(strip $(HAPTIC_ENABLE)), DRV2605L) | ||
| 229 | COMMON_VPATH += $(DRIVER_PATH)/haptic | ||
| 230 | SRC += DRV2605L.c | ||
| 231 | SRC += i2c_master.c | ||
| 232 | OPT_DEFS += -DDRV2605L | ||
| 233 | endif | ||
| 234 | |||
| 228 | ifeq ($(strip $(HD44780_ENABLE)), yes) | 235 | ifeq ($(strip $(HD44780_ENABLE)), yes) |
| 229 | SRC += drivers/avr/hd44780.c | 236 | SRC += drivers/avr/hd44780.c |
| 230 | OPT_DEFS += -DHD44780_ENABLE | 237 | OPT_DEFS += -DHD44780_ENABLE |
| @@ -240,6 +247,8 @@ ifeq ($(strip $(LEADER_ENABLE)), yes) | |||
| 240 | OPT_DEFS += -DLEADER_ENABLE | 247 | OPT_DEFS += -DLEADER_ENABLE |
| 241 | endif | 248 | endif |
| 242 | 249 | ||
| 250 | include $(DRIVER_PATH)/qwiic/qwiic.mk | ||
| 251 | |||
| 243 | QUANTUM_SRC:= \ | 252 | QUANTUM_SRC:= \ |
| 244 | $(QUANTUM_DIR)/quantum.c \ | 253 | $(QUANTUM_DIR)/quantum.c \ |
| 245 | $(QUANTUM_DIR)/keymap_common.c \ | 254 | $(QUANTUM_DIR)/keymap_common.c \ |
diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c index de5843839..ab962ea95 100644 --- a/drivers/arm/i2c_master.c +++ b/drivers/arm/i2c_master.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | static uint8_t i2c_address; | 33 | static uint8_t i2c_address; |
| 34 | 34 | ||
| 35 | // This configures the I2C clock to 400Mhz assuming a 72Mhz clock | 35 | // This configures the I2C clock to 400khz assuming a 72Mhz clock |
| 36 | // For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html | 36 | // For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html |
| 37 | static const I2CConfig i2cconfig = { | 37 | static const I2CConfig i2cconfig = { |
| 38 | STM32_TIMINGR_PRESC(15U) | | 38 | STM32_TIMINGR_PRESC(15U) | |
| @@ -45,10 +45,14 @@ static const I2CConfig i2cconfig = { | |||
| 45 | __attribute__ ((weak)) | 45 | __attribute__ ((weak)) |
| 46 | void i2c_init(void) | 46 | void i2c_init(void) |
| 47 | { | 47 | { |
| 48 | setPinInput(B6); // Try releasing special pins for a short time | 48 | //palSetGroupMode(GPIOB, GPIOB_PIN6 | GPIOB_PIN7, 0, PAL_MODE_INPUT); |
| 49 | setPinInput(B7); | 49 | |
| 50 | chThdSleepMilliseconds(10); | 50 | // Try releasing special pins for a short time |
| 51 | palSetPadMode(GPIOB, 6, PAL_MODE_INPUT); | ||
| 52 | palSetPadMode(GPIOB, 7, PAL_MODE_INPUT); | ||
| 51 | 53 | ||
| 54 | chThdSleepMilliseconds(10); | ||
| 55 | |||
| 52 | palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); | 56 | palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); |
| 53 | palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); | 57 | palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); |
| 54 | 58 | ||
diff --git a/drivers/arm/i2c_master.h b/drivers/arm/i2c_master.h index 591fa7f77..392760328 100644 --- a/drivers/arm/i2c_master.h +++ b/drivers/arm/i2c_master.h | |||
| @@ -34,6 +34,7 @@ void i2c_init(void); | |||
| 34 | uint8_t i2c_start(uint8_t address); | 34 | uint8_t i2c_start(uint8_t address); |
| 35 | uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); | 35 | uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); |
| 36 | uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); | 36 | uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); |
| 37 | uint8_t i2c_transmit_receive(uint8_t address, uint8_t * tx_body, uint16_t tx_length, uint8_t * rx_body, uint16_t rx_length); | ||
| 37 | uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); | 38 | uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); |
| 38 | uint8_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout); | 39 | uint8_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout); |
| 39 | uint8_t i2c_stop(uint16_t timeout); | 40 | uint8_t i2c_stop(uint16_t timeout); |
diff --git a/drivers/haptic/DRV2605L.c b/drivers/haptic/DRV2605L.c new file mode 100644 index 000000000..97ca292b9 --- /dev/null +++ b/drivers/haptic/DRV2605L.c | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | /* Copyright 2018 ishtob | ||
| 2 | * Driver for DRV2605L written for QMK | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #include "DRV2605L.h" | ||
| 18 | #include "print.h" | ||
| 19 | #include <stdlib.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <math.h> | ||
| 22 | |||
| 23 | |||
| 24 | uint8_t DRV2605L_transfer_buffer[20]; | ||
| 25 | uint8_t DRV2605L_tx_register[0]; | ||
| 26 | uint8_t DRV2605L_read_buffer[0]; | ||
| 27 | uint8_t DRV2605L_read_register; | ||
| 28 | |||
| 29 | |||
| 30 | void DRV_write(uint8_t drv_register, uint8_t settings) { | ||
| 31 | DRV2605L_transfer_buffer[0] = drv_register; | ||
| 32 | DRV2605L_transfer_buffer[1] = settings; | ||
| 33 | i2c_transmit(DRV2605L_BASE_ADDRESS << 1, DRV2605L_transfer_buffer, 2, 100); | ||
| 34 | } | ||
| 35 | |||
| 36 | uint8_t DRV_read(uint8_t regaddress) { | ||
| 37 | DRV2605L_tx_register[0] = regaddress; | ||
| 38 | if (MSG_OK != i2c_transmit_receive(DRV2605L_BASE_ADDRESS << 1, | ||
| 39 | DRV2605L_tx_register, 1, | ||
| 40 | DRV2605L_read_buffer, 1 | ||
| 41 | )){ | ||
| 42 | printf("err reading reg \n"); | ||
| 43 | } | ||
| 44 | DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0]; | ||
| 45 | return DRV2605L_read_register; | ||
| 46 | } | ||
| 47 | |||
| 48 | void DRV_init(void) | ||
| 49 | { | ||
| 50 | i2c_init(); | ||
| 51 | i2c_start(DRV2605L_BASE_ADDRESS); | ||
| 52 | |||
| 53 | /* 0x07 sets DRV2605 into calibration mode */ | ||
| 54 | DRV_write(DRV_MODE,0x07); | ||
| 55 | |||
| 56 | // DRV_write(DRV_FEEDBACK_CTRL,0xB6); | ||
| 57 | |||
| 58 | #if FB_ERM_LRA == 0 | ||
| 59 | /* ERM settings */ | ||
| 60 | DRV_write(DRV_RATED_VOLT, (RATED_VOLTAGE/21.33)*1000); | ||
| 61 | #if ERM_OPEN_LOOP == 0 | ||
| 62 | DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (((V_PEAK*(DRIVE_TIME+BLANKING_TIME+IDISS_TIME))/0.02133)/(DRIVE_TIME-0.0003))); | ||
| 63 | #elif ERM_OPEN_LOOP == 1 | ||
| 64 | DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK/0.02196)); | ||
| 65 | #endif | ||
| 66 | #elif FB_ERM_LRA == 1 | ||
| 67 | DRV_write(DRV_RATED_VOLT, ((V_RMS * sqrt(1 - ((4 * ((150+(SAMPLE_TIME*50))*0.000001)) + 0.0003)* F_LRA)/0.02071))); | ||
| 68 | #if LRA_OPEN_LOOP == 0 | ||
| 69 | DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, ((V_PEAK/sqrt(1-(F_LRA*0.0008))/0.02133))); | ||
| 70 | #elif LRA_OPEN_LOOP == 1 | ||
| 71 | DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK/0.02196)); | ||
| 72 | #endif | ||
| 73 | #endif | ||
| 74 | |||
| 75 | DRVREG_FBR FB_SET; | ||
| 76 | FB_SET.Bits.ERM_LRA = FB_ERM_LRA; | ||
| 77 | FB_SET.Bits.BRAKE_FACTOR = FB_BRAKEFACTOR; | ||
| 78 | FB_SET.Bits.LOOP_GAIN =FB_LOOPGAIN; | ||
| 79 | FB_SET.Bits.BEMF_GAIN = 0; /* auto-calibration populates this field*/ | ||
| 80 | DRV_write(DRV_FEEDBACK_CTRL, (uint8_t) FB_SET.Byte); | ||
| 81 | DRVREG_CTRL1 C1_SET; | ||
| 82 | C1_SET.Bits.C1_DRIVE_TIME = DRIVE_TIME; | ||
| 83 | C1_SET.Bits.C1_AC_COUPLE = AC_COUPLE; | ||
| 84 | C1_SET.Bits.C1_STARTUP_BOOST = STARTUP_BOOST; | ||
| 85 | DRV_write(DRV_CTRL_1, (uint8_t) C1_SET.Byte); | ||
| 86 | DRVREG_CTRL2 C2_SET; | ||
| 87 | C2_SET.Bits.C2_BIDIR_INPUT = BIDIR_INPUT; | ||
| 88 | C2_SET.Bits.C2_BRAKE_STAB = BRAKE_STAB; | ||
| 89 | C2_SET.Bits.C2_SAMPLE_TIME = SAMPLE_TIME; | ||
| 90 | C2_SET.Bits.C2_BLANKING_TIME = BLANKING_TIME; | ||
| 91 | C2_SET.Bits.C2_IDISS_TIME = IDISS_TIME; | ||
| 92 | DRV_write(DRV_CTRL_2, (uint8_t) C2_SET.Byte); | ||
| 93 | DRVREG_CTRL3 C3_SET; | ||
| 94 | C3_SET.Bits.C3_LRA_OPEN_LOOP = LRA_OPEN_LOOP; | ||
| 95 | C3_SET.Bits.C3_N_PWM_ANALOG = N_PWM_ANALOG; | ||
| 96 | C3_SET.Bits.C3_LRA_DRIVE_MODE = LRA_DRIVE_MODE; | ||
| 97 | C3_SET.Bits.C3_DATA_FORMAT_RTO = DATA_FORMAT_RTO; | ||
| 98 | C3_SET.Bits.C3_SUPPLY_COMP_DIS = SUPPLY_COMP_DIS; | ||
| 99 | C3_SET.Bits.C3_ERM_OPEN_LOOP = ERM_OPEN_LOOP; | ||
| 100 | C3_SET.Bits.C3_NG_THRESH = NG_THRESH; | ||
| 101 | DRV_write(DRV_CTRL_3, (uint8_t) C3_SET.Byte); | ||
| 102 | DRVREG_CTRL4 C4_SET; | ||
| 103 | C4_SET.Bits.C4_ZC_DET_TIME = ZC_DET_TIME; | ||
| 104 | C4_SET.Bits.C4_AUTO_CAL_TIME = AUTO_CAL_TIME; | ||
| 105 | DRV_write(DRV_CTRL_4, (uint8_t) C4_SET.Byte); | ||
| 106 | DRV_write(DRV_LIB_SELECTION,LIB_SELECTION); | ||
| 107 | //start autocalibration | ||
| 108 | DRV_write(DRV_GO, 0x01); | ||
| 109 | |||
| 110 | /* 0x00 sets DRV2605 out of standby and to use internal trigger | ||
| 111 | * 0x01 sets DRV2605 out of standby and to use external trigger */ | ||
| 112 | DRV_write(DRV_MODE,0x00); | ||
| 113 | |||
| 114 | /* 0x06: LRA library */ | ||
| 115 | DRV_write(DRV_WAVEFORM_SEQ_1, 0x01); | ||
| 116 | |||
| 117 | /* 0xB9: LRA, 4x brake factor, medium gain, 7.5x back EMF | ||
| 118 | * 0x39: ERM, 4x brake factor, medium gain, 1.365x back EMF */ | ||
| 119 | |||
| 120 | /* TODO: setup auto-calibration as part of initiation */ | ||
| 121 | |||
| 122 | } | ||
| 123 | |||
| 124 | void DRV_pulse(uint8_t sequence) | ||
| 125 | { | ||
| 126 | DRV_write(DRV_GO, 0x00); | ||
| 127 | DRV_write(DRV_WAVEFORM_SEQ_1, sequence); | ||
| 128 | DRV_write(DRV_GO, 0x01); | ||
| 129 | } \ No newline at end of file | ||
diff --git a/drivers/haptic/DRV2605L.h b/drivers/haptic/DRV2605L.h new file mode 100644 index 000000000..de9d294e9 --- /dev/null +++ b/drivers/haptic/DRV2605L.h | |||
| @@ -0,0 +1,394 @@ | |||
| 1 | /* Copyright 2018 ishtob | ||
| 2 | * Driver for DRV2605L written for QMK | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | #include "i2c_master.h" | ||
| 20 | |||
| 21 | /* Initialization settings | ||
| 22 | |||
| 23 | * Feedback Control Settings */ | ||
| 24 | #ifndef FB_ERM_LRA | ||
| 25 | #define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/ | ||
| 26 | #endif | ||
| 27 | #ifndef FB_BRAKEFACTOR | ||
| 28 | #define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ | ||
| 29 | #endif | ||
| 30 | #ifndef FB_LOOPGAIN | ||
| 31 | #define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #ifndef RATED_VOLTAGE | ||
| 35 | #define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */ | ||
| 36 | #ifndef V_PEAK | ||
| 37 | #define V_PEAK 2.8 | ||
| 38 | #endif | ||
| 39 | #endif | ||
| 40 | |||
| 41 | /* LRA specific settings */ | ||
| 42 | #if FB_ERM_LRA == 1 | ||
| 43 | #ifndef V_RMS | ||
| 44 | #define V_RMS 2.0 | ||
| 45 | #endif | ||
| 46 | #ifndef V_PEAK | ||
| 47 | #define V_PEAK 2.1 | ||
| 48 | #endif | ||
| 49 | #ifndef F_LRA | ||
| 50 | #define F_LRA 205 | ||
| 51 | #endif | ||
| 52 | #endif | ||
| 53 | |||
| 54 | /* Library Selection */ | ||
| 55 | #ifndef LIB_SELECTION | ||
| 56 | #if FB_ERM_LRA == 1 | ||
| 57 | #define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | ||
| 58 | #else | ||
| 59 | #define LIB_SELECTION 1 | ||
| 60 | #endif | ||
| 61 | #endif | ||
| 62 | |||
| 63 | /* Control 1 register settings */ | ||
| 64 | #ifndef DRIVE_TIME | ||
| 65 | #define DRIVE_TIME 25 | ||
| 66 | #endif | ||
| 67 | #ifndef AC_COUPLE | ||
| 68 | #define AC_COUPLE 0 | ||
| 69 | #endif | ||
| 70 | #ifndef STARTUP_BOOST | ||
| 71 | #define STARTUP_BOOST 1 | ||
| 72 | #endif | ||
| 73 | |||
| 74 | /* Control 2 Settings */ | ||
| 75 | #ifndef BIDIR_INPUT | ||
| 76 | #define BIDIR_INPUT 1 | ||
| 77 | #endif | ||
| 78 | #ifndef BRAKE_STAB | ||
| 79 | #define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */ | ||
| 80 | #endif | ||
| 81 | #ifndef SAMPLE_TIME | ||
| 82 | #define SAMPLE_TIME 3 | ||
| 83 | #endif | ||
| 84 | #ifndef BLANKING_TIME | ||
| 85 | #define BLANKING_TIME 1 | ||
| 86 | #endif | ||
| 87 | #ifndef IDISS_TIME | ||
| 88 | #define IDISS_TIME 1 | ||
| 89 | #endif | ||
| 90 | |||
| 91 | /* Control 3 settings */ | ||
| 92 | #ifndef NG_THRESH | ||
| 93 | #define NG_THRESH 2 | ||
| 94 | #endif | ||
| 95 | #ifndef ERM_OPEN_LOOP | ||
| 96 | #define ERM_OPEN_LOOP 1 | ||
| 97 | #endif | ||
| 98 | #ifndef SUPPLY_COMP_DIS | ||
| 99 | #define SUPPLY_COMP_DIS 0 | ||
| 100 | #endif | ||
| 101 | #ifndef DATA_FORMAT_RTO | ||
| 102 | #define DATA_FORMAT_RTO 0 | ||
| 103 | #endif | ||
| 104 | #ifndef LRA_DRIVE_MODE | ||
| 105 | #define LRA_DRIVE_MODE 0 | ||
| 106 | #endif | ||
| 107 | #ifndef N_PWM_ANALOG | ||
| 108 | #define N_PWM_ANALOG 0 | ||
| 109 | #endif | ||
| 110 | #ifndef LRA_OPEN_LOOP | ||
| 111 | #define LRA_OPEN_LOOP 0 | ||
| 112 | #endif | ||
| 113 | |||
| 114 | /* Control 4 settings */ | ||
| 115 | #ifndef ZC_DET_TIME | ||
| 116 | #define ZC_DET_TIME 0 | ||
| 117 | #endif | ||
| 118 | #ifndef AUTO_CAL_TIME | ||
| 119 | #define AUTO_CAL_TIME 3 | ||
| 120 | #endif | ||
| 121 | |||
| 122 | /* register defines -------------------------------------------------------- */ | ||
| 123 | #define DRV2605L_BASE_ADDRESS 0x5A /* DRV2605L Base address */ | ||
| 124 | #define DRV_STATUS 0x00 | ||
| 125 | #define DRV_MODE 0x01 | ||
| 126 | #define DRV_RTP_INPUT 0x02 | ||
| 127 | #define DRV_LIB_SELECTION 0x03 | ||
| 128 | #define DRV_WAVEFORM_SEQ_1 0x04 | ||
| 129 | #define DRV_WAVEFORM_SEQ_2 0x05 | ||
| 130 | #define DRV_WAVEFORM_SEQ_3 0x06 | ||
| 131 | #define DRV_WAVEFORM_SEQ_4 0x07 | ||
| 132 | #define DRV_WAVEFORM_SEQ_5 0x08 | ||
| 133 | #define DRV_WAVEFORM_SEQ_6 0x09 | ||
| 134 | #define DRV_WAVEFORM_SEQ_7 0x0A | ||
| 135 | #define DRV_WAVEFORM_SEQ_8 0x0B | ||
| 136 | #define DRV_GO 0x0C | ||
| 137 | #define DRV_OVERDRIVE_TIME_OFFSET 0x0D | ||
| 138 | #define DRV_SUSTAIN_TIME_OFFSET_P 0x0E | ||
| 139 | #define DRV_SUSTAIN_TIME_OFFSET_N 0x0F | ||
| 140 | #define DRV_BRAKE_TIME_OFFSET 0x10 | ||
| 141 | #define DRV_AUDIO_2_VIBE_CTRL 0x11 | ||
| 142 | #define DRV_AUDIO_2_VIBE_MIN_IN 0x12 | ||
| 143 | #define DRV_AUDIO_2_VIBE_MAX_IN 0x13 | ||
| 144 | #define DRV_AUDIO_2_VIBE_MIN_OUTDRV 0x14 | ||
| 145 | #define DRV_AUDIO_2_VIBE_MAX_OUTDRV 0x15 | ||
| 146 | #define DRV_RATED_VOLT 0x16 | ||
| 147 | #define DRV_OVERDRIVE_CLAMP_VOLT 0x17 | ||
| 148 | #define DRV_AUTO_CALIB_COMP_RESULT 0x18 | ||
| 149 | #define DRV_AUTO_CALIB_BEMF_RESULT 0x19 | ||
| 150 | #define DRV_FEEDBACK_CTRL 0x1A | ||
| 151 | #define DRV_CTRL_1 0x1B | ||
| 152 | #define DRV_CTRL_2 0x1C | ||
| 153 | #define DRV_CTRL_3 0x1D | ||
| 154 | #define DRV_CTRL_4 0x1E | ||
| 155 | #define DRV_CTRL_5 0x1F | ||
| 156 | #define DRV_OPEN_LOOP_PERIOD 0x20 | ||
| 157 | #define DRV_VBAT_VOLT_MONITOR 0x21 | ||
| 158 | #define DRV_LRA_RESONANCE_PERIOD 0x22 | ||
| 159 | |||
| 160 | void DRV_init(void); | ||
| 161 | void DRV_write(const uint8_t drv_register, const uint8_t settings); | ||
| 162 | uint8_t DRV_read(const uint8_t regaddress); | ||
| 163 | void DRV_pulse(const uint8_t sequence); | ||
| 164 | |||
| 165 | |||
| 166 | typedef enum DRV_EFFECT{ | ||
| 167 | clear_sequence = 0, | ||
| 168 | strong_click = 1, | ||
| 169 | strong_click_60 = 2, | ||
| 170 | strong_click_30 = 3, | ||
| 171 | sharp_click = 4, | ||
| 172 | sharp_click_60 = 5, | ||
| 173 | sharp_click_30 = 6, | ||
| 174 | soft_bump = 7, | ||
| 175 | soft_bump_60 = 8, | ||
| 176 | soft_bump_30 = 9, | ||
| 177 | dbl_click = 10, | ||
| 178 | dbl_click_60 = 11, | ||
| 179 | trp_click = 12, | ||
| 180 | soft_fuzz = 13, | ||
| 181 | strong_buzz = 14, | ||
| 182 | alert_750ms = 15, | ||
| 183 | alert_1000ms = 16, | ||
| 184 | strong_click1 = 17, | ||
| 185 | strong_click2_80 = 18, | ||
| 186 | strong_click3_60 = 19, | ||
| 187 | strong_click4_30 = 20, | ||
| 188 | medium_click1 = 21, | ||
| 189 | medium_click2_80 = 22, | ||
| 190 | medium_click3_60 = 23, | ||
| 191 | sharp_tick1 = 24, | ||
| 192 | sharp_tick2_80 = 25, | ||
| 193 | sharp_tick3_60 = 26, | ||
| 194 | sh_dblclick_str = 27, | ||
| 195 | sh_dblclick_str_80 = 28, | ||
| 196 | sh_dblclick_str_60 = 29, | ||
| 197 | sh_dblclick_str_30 = 30, | ||
| 198 | sh_dblclick_med = 31, | ||
| 199 | sh_dblclick_med_80 = 32, | ||
| 200 | sh_dblclick_med_60 = 33, | ||
| 201 | sh_dblsharp_tick = 34, | ||
| 202 | sh_dblsharp_tick_80 = 35, | ||
| 203 | sh_dblsharp_tick_60 = 36, | ||
| 204 | lg_dblclick_str = 37, | ||
| 205 | lg_dblclick_str_80 = 38, | ||
| 206 | lg_dblclick_str_60 = 39, | ||
| 207 | lg_dblclick_str_30 = 40, | ||
| 208 | lg_dblclick_med = 41, | ||
| 209 | lg_dblclick_med_80 = 42, | ||
| 210 | lg_dblclick_med_60 = 43, | ||
| 211 | lg_dblsharp_tick = 44, | ||
| 212 | lg_dblsharp_tick_80 = 45, | ||
| 213 | lg_dblsharp_tick_60 = 46, | ||
| 214 | buzz = 47, | ||
| 215 | buzz_80 = 48, | ||
| 216 | buzz_60 = 49, | ||
| 217 | buzz_40 = 50, | ||
| 218 | buzz_20 = 51, | ||
| 219 | pulsing_strong = 52, | ||
| 220 | pulsing_strong_80 = 53, | ||
| 221 | pulsing_medium = 54, | ||
| 222 | pulsing_medium_80 = 55, | ||
| 223 | pulsing_sharp = 56, | ||
| 224 | pulsing_sharp_80 = 57, | ||
| 225 | transition_click = 58, | ||
| 226 | transition_click_80 = 59, | ||
| 227 | transition_click_60 = 60, | ||
| 228 | transition_click_40 = 61, | ||
| 229 | transition_click_20 = 62, | ||
| 230 | transition_click_10 = 63, | ||
| 231 | transition_hum = 64, | ||
| 232 | transition_hum_80 = 65, | ||
| 233 | transition_hum_60 = 66, | ||
| 234 | transition_hum_40 = 67, | ||
| 235 | transition_hum_20 = 68, | ||
| 236 | transition_hum_10 = 69, | ||
| 237 | transition_rampdown_long_smooth1 = 70, | ||
| 238 | transition_rampdown_long_smooth2 = 71, | ||
| 239 | transition_rampdown_med_smooth1 = 72, | ||
| 240 | transition_rampdown_med_smooth2 = 73, | ||
| 241 | transition_rampdown_short_smooth1 = 74, | ||
| 242 | transition_rampdown_short_smooth2 = 75, | ||
| 243 | transition_rampdown_long_sharp1 = 76, | ||
| 244 | transition_rampdown_long_sharp2 = 77, | ||
| 245 | transition_rampdown_med_sharp1 = 78, | ||
| 246 | transition_rampdown_med_sharp2 = 79, | ||
| 247 | transition_rampdown_short_sharp1 = 80, | ||
| 248 | transition_rampdown_short_sharp2 = 81, | ||
| 249 | transition_rampup_long_smooth1 = 82, | ||
| 250 | transition_rampup_long_smooth2 = 83, | ||
| 251 | transition_rampup_med_smooth1 = 84, | ||
| 252 | transition_rampup_med_smooth2 = 85, | ||
| 253 | transition_rampup_short_smooth1 = 86, | ||
| 254 | transition_rampup_short_smooth2 = 87, | ||
| 255 | transition_rampup_long_sharp1 = 88, | ||
| 256 | transition_rampup_long_sharp2 = 89, | ||
| 257 | transition_rampup_med_sharp1 = 90, | ||
| 258 | transition_rampup_med_sharp2 = 91, | ||
| 259 | transition_rampup_short_sharp1 = 92, | ||
| 260 | transition_rampup_short_sharp2 = 93, | ||
| 261 | transition_rampdown_long_smooth1_50 = 94, | ||
| 262 | transition_rampdown_long_smooth2_50 = 95, | ||
| 263 | transition_rampdown_med_smooth1_50 = 96, | ||
| 264 | transition_rampdown_med_smooth2_50 = 97, | ||
| 265 | transition_rampdown_short_smooth1_50 = 98, | ||
| 266 | transition_rampdown_short_smooth2_50 = 99, | ||
| 267 | transition_rampdown_long_sharp1_50 = 100, | ||
| 268 | transition_rampdown_long_sharp2_50 = 101, | ||
| 269 | transition_rampdown_med_sharp1_50 = 102, | ||
| 270 | transition_rampdown_med_sharp2_50 = 103, | ||
| 271 | transition_rampdown_short_sharp1_50 = 104, | ||
| 272 | transition_rampdown_short_sharp2_50 = 105, | ||
| 273 | transition_rampup_long_smooth1_50 = 106, | ||
| 274 | transition_rampup_long_smooth2_50 = 107, | ||
| 275 | transition_rampup_med_smooth1_50 = 108, | ||
| 276 | transition_rampup_med_smooth2_50 = 109, | ||
| 277 | transition_rampup_short_smooth1_50 = 110, | ||
| 278 | transition_rampup_short_smooth2_50 = 111, | ||
| 279 | transition_rampup_long_sharp1_50 = 112, | ||
| 280 | transition_rampup_long_sharp2_50 = 113, | ||
| 281 | transition_rampup_med_sharp1_50 = 114, | ||
| 282 | transition_rampup_med_sharp2_50 = 115, | ||
| 283 | transition_rampup_short_sharp1_50 = 116, | ||
| 284 | transition_rampup_short_sharp2_50 = 117, | ||
| 285 | long_buzz_for_programmatic_stopping = 118, | ||
| 286 | smooth_hum1_50 = 119, | ||
| 287 | smooth_hum2_40 = 120, | ||
| 288 | smooth_hum3_30 = 121, | ||
| 289 | smooth_hum4_20 = 122, | ||
| 290 | smooth_hum5_10 = 123, | ||
| 291 | } DRV_EFFECT; | ||
| 292 | |||
| 293 | /* Register bit array unions */ | ||
| 294 | |||
| 295 | typedef union DRVREG_STATUS { /* register 0x00 */ | ||
| 296 | uint8_t Byte; | ||
| 297 | struct { | ||
| 298 | uint8_t OC_DETECT :1; /* set to 1 when overcurrent event is detected */ | ||
| 299 | uint8_t OVER_TEMP :1; /* set to 1 when device exceeds temp threshold */ | ||
| 300 | uint8_t FB_STS :1; /* set to 1 when feedback controller has timed out */ | ||
| 301 | /* auto-calibration routine and diagnostic result | ||
| 302 | * result | auto-calibation | diagnostic | | ||
| 303 | * 0 | passed | actuator func normal | | ||
| 304 | * 1 | failed | actuator func fault* | | ||
| 305 | * * actuator is not present or is shorted, timing out, or giving out–of-range back-EMF */ | ||
| 306 | uint8_t DIAG_RESULT :1; | ||
| 307 | uint8_t :1; | ||
| 308 | uint8_t DEVICE_ID :3; /* Device IDs 3: DRV2605 4: DRV2604 5: DRV2604L 6: DRV2605L */ | ||
| 309 | } Bits; | ||
| 310 | } DRVREG_STATUS; | ||
| 311 | |||
| 312 | typedef union DRVREG_MODE { /* register 0x01 */ | ||
| 313 | uint8_t Byte; | ||
| 314 | struct { | ||
| 315 | uint8_t MODE :3; /* Mode setting */ | ||
| 316 | uint8_t :3; | ||
| 317 | uint8_t STANDBY :1; /* 0:standby 1:ready */ | ||
| 318 | } Bits; | ||
| 319 | } DRVREG_MODE; | ||
| 320 | |||
| 321 | typedef union DRVREG_WAIT { | ||
| 322 | uint8_t Byte; | ||
| 323 | struct { | ||
| 324 | uint8_t WAIT_MODE :1; /* Set to 1 to interpret as wait for next 7 bits x10ms */ | ||
| 325 | uint8_t WAIT_TIME :7; | ||
| 326 | } Bits; | ||
| 327 | } DRVREG_WAIT; | ||
| 328 | |||
| 329 | typedef union DRVREG_FBR{ /* register 0x1A */ | ||
| 330 | uint8_t Byte; | ||
| 331 | struct { | ||
| 332 | uint8_t BEMF_GAIN :2; | ||
| 333 | uint8_t LOOP_GAIN :2; | ||
| 334 | uint8_t BRAKE_FACTOR :3; | ||
| 335 | uint8_t ERM_LRA :1; | ||
| 336 | } Bits; | ||
| 337 | } DRVREG_FBR; | ||
| 338 | |||
| 339 | typedef union DRVREG_CTRL1{ /* register 0x1B */ | ||
| 340 | uint8_t Byte; | ||
| 341 | struct { | ||
| 342 | uint8_t C1_DRIVE_TIME :5; | ||
| 343 | uint8_t C1_AC_COUPLE :1; | ||
| 344 | uint8_t :1; | ||
| 345 | uint8_t C1_STARTUP_BOOST :1; | ||
| 346 | } Bits; | ||
| 347 | } DRVREG_CTRL1; | ||
| 348 | |||
| 349 | typedef union DRVREG_CTRL2{ /* register 0x1C */ | ||
| 350 | uint8_t Byte; | ||
| 351 | struct { | ||
| 352 | uint8_t C2_IDISS_TIME :2; | ||
| 353 | uint8_t C2_BLANKING_TIME :2; | ||
| 354 | uint8_t C2_SAMPLE_TIME :2; | ||
| 355 | uint8_t C2_BRAKE_STAB :1; | ||
| 356 | uint8_t C2_BIDIR_INPUT :1; | ||
| 357 | } Bits; | ||
| 358 | } DRVREG_CTRL2; | ||
| 359 | |||
| 360 | typedef union DRVREG_CTRL3{ /* register 0x1D */ | ||
| 361 | uint8_t Byte; | ||
| 362 | struct { | ||
| 363 | uint8_t C3_LRA_OPEN_LOOP :1; | ||
| 364 | uint8_t C3_N_PWM_ANALOG :1; | ||
| 365 | uint8_t C3_LRA_DRIVE_MODE :1; | ||
| 366 | uint8_t C3_DATA_FORMAT_RTO :1; | ||
| 367 | uint8_t C3_SUPPLY_COMP_DIS :1; | ||
| 368 | uint8_t C3_ERM_OPEN_LOOP :1; | ||
| 369 | uint8_t C3_NG_THRESH :2; | ||
| 370 | } Bits; | ||
| 371 | } DRVREG_CTRL3; | ||
| 372 | |||
| 373 | typedef union DRVREG_CTRL4{ /* register 0x1E */ | ||
| 374 | uint8_t Byte; | ||
| 375 | struct { | ||
| 376 | uint8_t C4_OTP_PROGRAM :1; | ||
| 377 | uint8_t :1; | ||
| 378 | uint8_t C4_OTP_STATUS :1; | ||
| 379 | uint8_t :1; | ||
| 380 | uint8_t C4_AUTO_CAL_TIME :2; | ||
| 381 | uint8_t C4_ZC_DET_TIME :2; | ||
| 382 | } Bits; | ||
| 383 | } DRVREG_CTRL4; | ||
| 384 | |||
| 385 | typedef union DRVREG_CTRL5{ /* register 0x1F */ | ||
| 386 | uint8_t Byte; | ||
| 387 | struct { | ||
| 388 | uint8_t C5_IDISS_TIME :2; | ||
| 389 | uint8_t C5_BLANKING_TIME :2; | ||
| 390 | uint8_t C5_PLAYBACK_INTERVAL :1; | ||
| 391 | uint8_t C5_LRA_AUTO_OPEN_LOOP :1; | ||
| 392 | uint8_t C5_AUTO_OL_CNT :2; | ||
| 393 | } Bits; | ||
| 394 | } DRVREG_CTRL5; \ No newline at end of file | ||
diff --git a/drivers/qwiic/micro_oled.c b/drivers/qwiic/micro_oled.c new file mode 100644 index 000000000..35c5d6ee1 --- /dev/null +++ b/drivers/qwiic/micro_oled.c | |||
| @@ -0,0 +1,691 @@ | |||
| 1 | /* Jim Lindblom @ SparkFun Electronics | ||
| 2 | * October 26, 2014 | ||
| 3 | * https://github.com/sparkfun/Micro_OLED_Breakout/tree/master/Firmware/Arduino/libraries/SFE_MicroOLED | ||
| 4 | * | ||
| 5 | * Modified by: | ||
| 6 | * Emil Varughese @ Edwin Robotics Pvt. Ltd. | ||
| 7 | * July 27, 2015 | ||
| 8 | * https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/ | ||
| 9 | * | ||
| 10 | * This code was heavily based around the MicroView library, written by GeekAmmo | ||
| 11 | * (https://github.com/geekammo/MicroView-Arduino-Library). | ||
| 12 | * | ||
| 13 | * Adapted for QMK by: | ||
| 14 | * Jack Humbert <jack.humb@gmail.com> | ||
| 15 | * October 11, 2018 | ||
| 16 | * | ||
| 17 | * This program is free software: you can redistribute it and/or modify | ||
| 18 | * it under the terms of the GNU General Public License as published by | ||
| 19 | * the Free Software Foundation, either version 3 of the License, or | ||
| 20 | * (at your option) any later version. | ||
| 21 | * | ||
| 22 | * This program is distributed in the hope that it will be useful, | ||
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 25 | * GNU General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU General Public License | ||
| 28 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 29 | */ | ||
| 30 | #include "micro_oled.h" | ||
| 31 | #include <stdlib.h> | ||
| 32 | #include "util/font5x7.h" | ||
| 33 | #include "util/font8x16.h" | ||
| 34 | #include "string.h" | ||
| 35 | |||
| 36 | #define TOTALFONTS 2 | ||
| 37 | const unsigned char * fonts_pointer[]= { font5x7, font8x16 }; | ||
| 38 | |||
| 39 | uint8_t foreColor,drawMode,fontWidth, fontHeight, fontType, fontStartChar, fontTotalChar, cursorX, cursorY; | ||
| 40 | uint16_t fontMapWidth; | ||
| 41 | |||
| 42 | #define _BV(x) (1 << (x)) | ||
| 43 | #define swap(a, b) { uint8_t t = a; a = b; b = t; } | ||
| 44 | |||
| 45 | uint8_t micro_oled_transfer_buffer[20]; | ||
| 46 | static uint8_t micro_oled_screen_current[LCDWIDTH*LCDWIDTH/8] = { 0 }; | ||
| 47 | |||
| 48 | /* LCD Memory organised in 64 horizontal pixel and 6 rows of byte | ||
| 49 | B B .............B ----- | ||
| 50 | y y .............y \ | ||
| 51 | t t .............t \ | ||
| 52 | e e .............e \ | ||
| 53 | 0 1 .............63 \ | ||
| 54 | \ | ||
| 55 | D0 D0.............D0 \ | ||
| 56 | D1 D1.............D1 / ROW 0 | ||
| 57 | D2 D2.............D2 / | ||
| 58 | D3 D3.............D3 / | ||
| 59 | D4 D4.............D4 / | ||
| 60 | D5 D5.............D5 / | ||
| 61 | D6 D6.............D6 / | ||
| 62 | D7 D7.............D7 ---- | ||
| 63 | */ | ||
| 64 | |||
| 65 | #if LCDWIDTH == 64 | ||
| 66 | #if LCDWIDTH == 48 | ||
| 67 | static uint8_t micro_oled_screen_buffer[] = { | ||
| 68 | // QMK Logo - generated at http://www.majer.ch/lcd/adf_bitmap.php | ||
| 69 | //64x48 image | ||
| 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 72 | 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, | ||
| 73 | 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, | ||
| 74 | 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 75 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, | ||
| 78 | 0xF8, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, | ||
| 79 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, | ||
| 80 | 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFE, | ||
| 81 | 0xFE, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, | ||
| 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 84 | 0x8C, 0x8C, 0x8C, 0x8C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 85 | 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, | ||
| 86 | 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, | ||
| 87 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0x8C, 0x8C, 0x8C, | ||
| 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 90 | 0x00, 0x00, 0x00, 0x00, 0x31, 0x31, 0x31, 0x31, 0xFF, 0xFF, | ||
| 91 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF1, 0xE3, 0xE7, 0xCF, | ||
| 92 | 0xCF, 0xCF, 0xCF, 0x00, 0x00, 0xCF, 0xCF, 0xCF, 0xC7, 0xE7, | ||
| 93 | 0xE3, 0xF1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 94 | 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 96 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, | ||
| 97 | 0x06, 0x06, 0x1F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 98 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF, | ||
| 99 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 100 | 0xFF, 0x7F, 0x7F, 0x1F, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, | ||
| 101 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 102 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 103 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 104 | 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, | ||
| 105 | 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, | ||
| 106 | 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 107 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 108 | 0x00, 0x00, 0x00, 0x00 | ||
| 109 | }; | ||
| 110 | #endif | ||
| 111 | #elif LCDWIDTH == 128 | ||
| 112 | #if LCDHEIGHT == 32 | ||
| 113 | static uint8_t micro_oled_screen_buffer[LCDWIDTH*LCDWIDTH/8] = { | ||
| 114 | //128x32 qmk image | ||
| 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 116 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 117 | 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xFC, 0xFC, | ||
| 118 | 0xE0, 0xF0, 0xFC, 0xE0, 0xE0, 0xFC, 0xE0, 0xE0, 0xFC, 0xFC, | ||
| 119 | 0xE0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 120 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 121 | 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x30, 0xE0, 0x00, 0x00, | ||
| 122 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, | ||
| 123 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, | ||
| 124 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, | ||
| 125 | 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, | ||
| 126 | 0x80, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 127 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 128 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 129 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xB2, 0xB2, 0xFF, | ||
| 130 | 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0x03, | ||
| 131 | 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, | ||
| 132 | 0xFF, 0xB7, 0xB2, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 133 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 134 | 0x00, 0x1F, 0x02, 0x02, 0x03, 0x01, 0x00, 0x06, 0x1F, 0x10, | ||
| 135 | 0x10, 0x10, 0x1F, 0x06, 0x00, 0x03, 0x1E, 0x18, 0x0F, 0x01, | ||
| 136 | 0x0F, 0x18, 0x1E, 0x01, 0x00, 0x0F, 0x1F, 0x12, 0x02, 0x12, | ||
| 137 | 0x13, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0x12, | ||
| 138 | 0x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x1F, | ||
| 139 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 140 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 141 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 142 | 0x00, 0x00, 0x00, 0x00, 0x48, 0x4D, 0x4D, 0xFF, 0xFF, 0xFF, | ||
| 143 | 0xFF, 0xFF, 0xFE, 0xF8, 0xF9, 0xF3, 0xF3, 0xC0, 0x80, 0xF3, | ||
| 144 | 0xF3, 0xF3, 0xF9, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, | ||
| 145 | 0x4D, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 147 | 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0xC0, 0x00, 0x70, 0xC0, | ||
| 148 | 0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0C, | ||
| 149 | 0x04, 0x04, 0x04, 0x04, 0x1C, 0xF0, 0x00, 0x00, 0xFC, 0x0C, | ||
| 150 | 0x38, 0xE0, 0x00, 0x00, 0xC0, 0x38, 0x0C, 0xFC, 0x00, 0x00, | ||
| 151 | 0xFC, 0xFC, 0x60, 0x90, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, | ||
| 152 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 153 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 154 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 155 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x3F, | ||
| 156 | 0x3F, 0x07, 0x3F, 0x3F, 0x07, 0x0F, 0x3F, 0x07, 0x07, 0x3F, | ||
| 157 | 0x07, 0x07, 0x3F, 0x3F, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, | ||
| 158 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 159 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, | ||
| 160 | 0x06, 0x04, 0x04, 0x07, 0x01, 0x00, 0x00, 0x13, 0x1E, 0x03, | ||
| 161 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x04, 0x04, | ||
| 162 | 0x04, 0x04, 0x07, 0x0D, 0x08, 0x00, 0x07, 0x00, 0x00, 0x01, | ||
| 163 | 0x07, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x07, | ||
| 164 | 0x00, 0x01, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 165 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 166 | 0x00, 0x00 | ||
| 167 | }; | ||
| 168 | #elif LCDHEIGHT == 64 | ||
| 169 | static uint8_t micro_oled_screen_buffer[LCDWIDTH*LCDWIDTH/8] = { | ||
| 170 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 171 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 172 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 173 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 174 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 175 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 176 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 177 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, | ||
| 178 | 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, | ||
| 179 | 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, | ||
| 180 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 181 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 183 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 184 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 185 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 186 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 187 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 188 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 189 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 190 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 191 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 192 | 0xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFF, | ||
| 193 | 0x7F, 0x7E, 0xFE, 0xFF, 0xFF, 0xFE, 0xFE, 0x7F, 0x7F, 0xFE, | ||
| 194 | 0xFE, 0xFF, 0xFF, 0xFE, 0x7E, 0x7F, 0xFF, 0xFE, 0xFE, 0xFC, | ||
| 195 | 0xFC, 0xF8, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, | ||
| 196 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 197 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 198 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 200 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 201 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 202 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 203 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 204 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 205 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 206 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 207 | 0x00, 0x88, 0x88, 0x88, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 208 | 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, | ||
| 209 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, | ||
| 210 | 0xFF, 0xFF, 0xFF, 0xDD, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, | ||
| 211 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 212 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 213 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 214 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 215 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 216 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 217 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 218 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 219 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 220 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 221 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 222 | 0x00, 0x00, 0x99, 0x99, 0x99, 0x99, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 223 | 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, 0xF3, 0xF3, 0xE7, 0xE7, 0x00, | ||
| 224 | 0x00, 0xE7, 0xE7, 0xF3, 0xF3, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF, | ||
| 225 | 0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0x99, 0x99, 0x99, 0x00, 0x00, | ||
| 226 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 227 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 228 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 229 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 230 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 231 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 232 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 234 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 235 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 236 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 237 | 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x1F, 0x3F, | ||
| 238 | 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, | ||
| 239 | 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, 0x3F, 0x3F, 0xFF, 0xFF, | ||
| 240 | 0x3F, 0x3F, 0x3F, 0x1F, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x00, | ||
| 241 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 242 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 244 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 245 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 246 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 247 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 248 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 249 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 250 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 251 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 252 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 253 | 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x03, 0x01, 0x00, | ||
| 254 | 0x80, 0x03, 0x03, 0x00, 0x00, 0x01, 0x03, 0x00, 0x80, 0x01, | ||
| 255 | 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 256 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 257 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 258 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 259 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 260 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 261 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 262 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 263 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 264 | 0x00, 0x00, 0x00, 0xFF, 0x11, 0x11, 0x11, 0x0E, 0x00, 0x70, | ||
| 265 | 0x88, 0x04, 0x04, 0x04, 0xF8, 0x00, 0x00, 0x3C, 0xE0, 0xC0, | ||
| 266 | 0x38, 0x1C, 0xE0, 0x80, 0x70, 0x0C, 0x00, 0xF8, 0xAC, 0x24, | ||
| 267 | 0x24, 0x3C, 0x30, 0x00, 0x00, 0xFC, 0x0C, 0x04, 0x00, 0xF8, | ||
| 268 | 0xAC, 0x24, 0x24, 0x2C, 0x30, 0x00, 0x70, 0xDC, 0x04, 0x04, | ||
| 269 | 0x88, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, | ||
| 270 | 0x8C, 0x04, 0x04, 0xF8, 0x00, 0x04, 0x3C, 0xE0, 0x80, 0xF0, | ||
| 271 | 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x83, 0x01, 0x01, | ||
| 272 | 0x01, 0x81, 0xFE, 0x3C, 0x00, 0x00, 0xFF, 0x03, 0x0E, 0x70, | ||
| 273 | 0xC0, 0xE0, 0x38, 0x06, 0x03, 0xFF, 0x00, 0x00, 0xFF, 0x18, | ||
| 274 | 0x38, 0x66, 0xC3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 275 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 276 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 277 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 278 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 279 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 280 | 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
| 281 | 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
| 282 | 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, | ||
| 283 | 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, | ||
| 284 | 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 285 | 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, | ||
| 286 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
| 287 | 0x01, 0x01, 0x01, 0x01, 0x03, 0x02, 0x00, 0x01, 0x00, 0x00, | ||
| 288 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, | ||
| 289 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 290 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 291 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 292 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 293 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 294 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 295 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 296 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 297 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 298 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 299 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 300 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 302 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 303 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 304 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 305 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 306 | }; | ||
| 307 | //TODO: generate bitmap of QMK logo here | ||
| 308 | #endif | ||
| 309 | #else | ||
| 310 | //catchall for custom screen szies | ||
| 311 | static uint8_t micro_oled_screen_buffer[LCDWIDTH*LCDWIDTH/8] = {0}; | ||
| 312 | #endif | ||
| 313 | |||
| 314 | |||
| 315 | |||
| 316 | void micro_oled_init(void) { | ||
| 317 | |||
| 318 | i2c_init(); | ||
| 319 | i2c_start(I2C_ADDRESS_SA0_1); | ||
| 320 | |||
| 321 | // Display Init sequence for 64x48 OLED module | ||
| 322 | send_command(DISPLAYOFF); // 0xAE | ||
| 323 | |||
| 324 | send_command(SETDISPLAYCLOCKDIV); // 0xD5 | ||
| 325 | send_command(0x80); // the suggested ratio 0x80 | ||
| 326 | |||
| 327 | send_command(SETMULTIPLEX); // 0xA8 | ||
| 328 | send_command(LCDHEIGHT - 1); | ||
| 329 | |||
| 330 | send_command(SETDISPLAYOFFSET); // 0xD3 | ||
| 331 | send_command(0x00); // no offset | ||
| 332 | |||
| 333 | send_command(SETSTARTLINE | 0x00); // line #0 | ||
| 334 | |||
| 335 | send_command(CHARGEPUMP); // enable charge pump | ||
| 336 | send_command(0x14); | ||
| 337 | |||
| 338 | send_command(NORMALDISPLAY); // 0xA6 | ||
| 339 | send_command(DISPLAYALLONRESUME); // 0xA4 | ||
| 340 | |||
| 341 | //display at regular orientation | ||
| 342 | send_command(SEGREMAP | 0x1); | ||
| 343 | send_command(COMSCANDEC); | ||
| 344 | |||
| 345 | //rotate display 180 | ||
| 346 | #ifdef micro_oled_rotate_180 | ||
| 347 | send_command(SEGREMAP); | ||
| 348 | send_command(COMSCANINC); | ||
| 349 | #endif | ||
| 350 | |||
| 351 | send_command(MEMORYMODE); | ||
| 352 | send_command(0x10); | ||
| 353 | |||
| 354 | send_command(SETCOMPINS); // 0xDA | ||
| 355 | if (LCDHEIGHT > 32) { | ||
| 356 | send_command(0x12); | ||
| 357 | } else { | ||
| 358 | send_command(0x02); | ||
| 359 | } | ||
| 360 | send_command(SETCONTRAST); // 0x81 | ||
| 361 | send_command(0x8F); | ||
| 362 | |||
| 363 | send_command(SETPRECHARGE); // 0xd9 | ||
| 364 | send_command(0xF1); | ||
| 365 | |||
| 366 | send_command(SETVCOMDESELECT); // 0xDB | ||
| 367 | send_command(0x40); | ||
| 368 | |||
| 369 | send_command(DISPLAYON); //--turn on oled panel | ||
| 370 | clear_screen(); // Erase hardware memory inside the OLED controller to avoid random data in memory. | ||
| 371 | send_buffer(); | ||
| 372 | } | ||
| 373 | |||
| 374 | void send_command(uint8_t command) { | ||
| 375 | micro_oled_transfer_buffer[0] = I2C_COMMAND; | ||
| 376 | micro_oled_transfer_buffer[1] = command; | ||
| 377 | i2c_transmit(I2C_ADDRESS_SA0_1 << 1, micro_oled_transfer_buffer, 2, 100); | ||
| 378 | } | ||
| 379 | |||
| 380 | void send_data(uint8_t data) { | ||
| 381 | micro_oled_transfer_buffer[0] = I2C_DATA; | ||
| 382 | micro_oled_transfer_buffer[1] = data; | ||
| 383 | i2c_transmit(I2C_ADDRESS_SA0_1 << 1, micro_oled_transfer_buffer, 2, 100); | ||
| 384 | } | ||
| 385 | |||
| 386 | /** \brief Set SSD1306 page address. | ||
| 387 | Send page address command and address to the SSD1306 OLED controller. | ||
| 388 | */ | ||
| 389 | void set_page_address(uint8_t address) { | ||
| 390 | address = (0xB0 | address); | ||
| 391 | send_command(address); | ||
| 392 | } | ||
| 393 | |||
| 394 | /** \brief Set SSD1306 column address. | ||
| 395 | Send column address command and address to the SSD1306 OLED controller. | ||
| 396 | */ | ||
| 397 | void set_column_address(uint8_t address) { | ||
| 398 | send_command( ( 0x10 | (address >> 4) ) + ((128 - LCDWIDTH) >> 8) ); | ||
| 399 | send_command( 0x0F & address ); | ||
| 400 | } | ||
| 401 | |||
| 402 | /** \brief Clear SSD1306's memory. | ||
| 403 | To clear GDRAM inside the LCD controller. | ||
| 404 | */ | ||
| 405 | void clear_screen(void) { | ||
| 406 | for (int i=0;i<8; i++) { | ||
| 407 | set_page_address(i); | ||
| 408 | set_column_address(0); | ||
| 409 | for (int j=0; j<0x80; j++) { | ||
| 410 | send_data(0); | ||
| 411 | } | ||
| 412 | } | ||
| 413 | } | ||
| 414 | |||
| 415 | /** \brief Clear SSD1306's memory. | ||
| 416 | To clear GDRAM inside the LCD controller. | ||
| 417 | */ | ||
| 418 | void clear_buffer(void) { | ||
| 419 | //384 | ||
| 420 | memset(micro_oled_screen_buffer, 0, LCDWIDTH*LCDWIDTH/8); | ||
| 421 | } | ||
| 422 | |||
| 423 | /** \brief Invert display. | ||
| 424 | The PIXEL_ON color of the display will turn to PIXEL_OFF and the PIXEL_OFF will turn to PIXEL_ON. | ||
| 425 | */ | ||
| 426 | void invert_screen(bool invert) { | ||
| 427 | if (invert) { | ||
| 428 | send_command(INVERTDISPLAY); | ||
| 429 | } else { | ||
| 430 | send_command(NORMALDISPLAY); | ||
| 431 | } | ||
| 432 | } | ||
| 433 | |||
| 434 | /** \brief Set contrast. | ||
| 435 | OLED contract value from 0 to 255. Note: Contrast level is not very obvious. | ||
| 436 | */ | ||
| 437 | void set_contrast(uint8_t contrast) { | ||
| 438 | send_command(SETCONTRAST); // 0x81 | ||
| 439 | send_command(contrast); | ||
| 440 | } | ||
| 441 | |||
| 442 | /** \brief Transfer display buffer. | ||
| 443 | Sends the updated buffer to the controller - the current status is checked before to save i2c exectution time | ||
| 444 | */ | ||
| 445 | void send_buffer(void) { | ||
| 446 | uint8_t i, j; | ||
| 447 | |||
| 448 | uint8_t page_addr = 0xFF; | ||
| 449 | for (i = 0; i < LCDHEIGHT/8; i++) { | ||
| 450 | uint8_t col_addr = 0xFF; | ||
| 451 | for (j = 0; j < LCDWIDTH; j++) { | ||
| 452 | if (micro_oled_screen_buffer[i*LCDWIDTH+j] != micro_oled_screen_current[i*LCDWIDTH+j]) { | ||
| 453 | if (page_addr != i) { | ||
| 454 | set_page_address(i); | ||
| 455 | } | ||
| 456 | if (col_addr != j) { | ||
| 457 | set_column_address(j); | ||
| 458 | } | ||
| 459 | send_data(micro_oled_screen_buffer[i*LCDWIDTH+j]); | ||
| 460 | micro_oled_screen_current[i*LCDWIDTH+j] = micro_oled_screen_buffer[i*LCDWIDTH+j]; | ||
| 461 | col_addr = j + 1; | ||
| 462 | } | ||
| 463 | } | ||
| 464 | } | ||
| 465 | } | ||
| 466 | |||
| 467 | /** \brief Draw pixel with color and mode. | ||
| 468 | Draw color pixel in the screen buffer's x,y position with NORM or XOR draw mode. | ||
| 469 | */ | ||
| 470 | void draw_pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode) { | ||
| 471 | if ((x<0) || (x>=LCDWIDTH) || (y<0) || (y>=LCDHEIGHT)) | ||
| 472 | return; | ||
| 473 | |||
| 474 | if (mode == XOR) { | ||
| 475 | if (color == PIXEL_ON) | ||
| 476 | micro_oled_screen_buffer[x + (y/8)*LCDWIDTH] ^= _BV((y%8)); | ||
| 477 | } else { | ||
| 478 | if (color == PIXEL_ON) | ||
| 479 | micro_oled_screen_buffer[x + (y/8)*LCDWIDTH] |= _BV((y%8)); | ||
| 480 | else | ||
| 481 | micro_oled_screen_buffer[x + (y/8)*LCDWIDTH] &= ~_BV((y%8)); | ||
| 482 | } | ||
| 483 | } | ||
| 484 | |||
| 485 | /** \brief Draw line with color and mode. | ||
| 486 | Draw line using color and mode from x0,y0 to x1,y1 of the screen buffer. | ||
| 487 | */ | ||
| 488 | void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, uint8_t mode) { | ||
| 489 | uint8_t steep = abs(y1 - y0) > abs(x1 - x0); | ||
| 490 | if (steep) { | ||
| 491 | swap(x0, y0); | ||
| 492 | swap(x1, y1); | ||
| 493 | } | ||
| 494 | |||
| 495 | if (x0 > x1) { | ||
| 496 | swap(x0, x1); | ||
| 497 | swap(y0, y1); | ||
| 498 | } | ||
| 499 | |||
| 500 | uint8_t dx, dy; | ||
| 501 | dx = x1 - x0; | ||
| 502 | dy = abs(y1 - y0); | ||
| 503 | |||
| 504 | int8_t err = dx / 2; | ||
| 505 | int8_t ystep; | ||
| 506 | |||
| 507 | if (y0 < y1) { | ||
| 508 | ystep = 1; | ||
| 509 | } else { | ||
| 510 | ystep = -1;} | ||
| 511 | |||
| 512 | for (; x0<x1; x0++) { | ||
| 513 | if (steep) { | ||
| 514 | draw_pixel(y0, x0, color, mode); | ||
| 515 | } else { | ||
| 516 | draw_pixel(x0, y0, color, mode); | ||
| 517 | } | ||
| 518 | err -= dy; | ||
| 519 | if (err < 0) { | ||
| 520 | y0 += ystep; | ||
| 521 | err += dx; | ||
| 522 | } | ||
| 523 | } | ||
| 524 | } | ||
| 525 | |||
| 526 | /** \brief Draw horizontal line with color and mode. | ||
| 527 | Draw horizontal line using color and mode from x,y to x+width,y of the screen buffer. | ||
| 528 | */ | ||
| 529 | void draw_line_hori(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode) { | ||
| 530 | draw_line(x,y,x+width,y,color,mode); | ||
| 531 | } | ||
| 532 | |||
| 533 | /** \brief Draw vertical line. | ||
| 534 | Draw vertical line using current fore color and current draw mode from x,y to x,y+height of the screen buffer. | ||
| 535 | */ | ||
| 536 | void draw_line_vert(uint8_t x, uint8_t y, uint8_t height, bool color, uint8_t mode) { | ||
| 537 | draw_line(x,y,x,y+height,color,mode); | ||
| 538 | } | ||
| 539 | |||
| 540 | /** \brief Draw rectangle with color and mode. | ||
| 541 | Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer. | ||
| 542 | */ | ||
| 543 | void draw_rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) { | ||
| 544 | uint8_t tempHeight; | ||
| 545 | |||
| 546 | draw_line_hori(x,y, width, color, mode); | ||
| 547 | draw_line_hori(x,y+height-1, width, color, mode); | ||
| 548 | |||
| 549 | tempHeight=height-2; | ||
| 550 | |||
| 551 | // skip drawing vertical lines to avoid overlapping of pixel that will | ||
| 552 | // affect XOR plot if no pixel in between horizontal lines | ||
| 553 | if (tempHeight<1) return; | ||
| 554 | |||
| 555 | draw_line_vert(x,y+1, tempHeight, color, mode); | ||
| 556 | draw_line_vert(x+width-1, y+1, tempHeight, color, mode); | ||
| 557 | } | ||
| 558 | |||
| 559 | /** \brief Draw rectangle with color and mode. | ||
| 560 | Draw rectangle using color and mode from x,y to x+width,y+height of the screen buffer. | ||
| 561 | */ | ||
| 562 | void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) { | ||
| 563 | uint8_t tempHeight; | ||
| 564 | |||
| 565 | draw_line_hori(x+1,y, width-2, color, mode); | ||
| 566 | draw_line_hori(x+1,y+height-1, width-2, color, mode); | ||
| 567 | |||
| 568 | tempHeight=height-2; | ||
| 569 | |||
| 570 | // skip drawing vertical lines to avoid overlapping of pixel that will | ||
| 571 | // affect XOR plot if no pixel in between horizontal lines | ||
| 572 | if (tempHeight<1) return; | ||
| 573 | |||
| 574 | draw_line_vert(x,y+1, tempHeight, color, mode); | ||
| 575 | draw_line_vert(x+width-1, y+1, tempHeight, color, mode); | ||
| 576 | } | ||
| 577 | |||
| 578 | /** \brief Draw filled rectangle with color and mode. | ||
| 579 | Draw filled rectangle using color and mode from x,y to x+width,y+height of the screen buffer. | ||
| 580 | */ | ||
| 581 | void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) { | ||
| 582 | // TODO - need to optimise the memory map draw so that this function will not call pixel one by one | ||
| 583 | for (int i=x; i<x+width;i++) { | ||
| 584 | draw_line_vert(i,y, height, color, mode); | ||
| 585 | } | ||
| 586 | } | ||
| 587 | |||
| 588 | /** \brief Draw filled rectangle with color and mode. | ||
| 589 | Draw filled rectangle using color and mode from x,y to x+width,y+height of the screen buffer. | ||
| 590 | */ | ||
| 591 | void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode) { | ||
| 592 | // TODO - need to optimise the memory map draw so that this function will not call pixel one by one | ||
| 593 | for (int i=x; i<x+width;i++) { | ||
| 594 | if (i == x || i == (x + width - 1)) | ||
| 595 | draw_line_vert(i, y+1, height-2, color, mode); | ||
| 596 | else | ||
| 597 | draw_line_vert(i, y, height, color, mode); | ||
| 598 | } | ||
| 599 | } | ||
| 600 | |||
| 601 | /** \brief Draw character with color and mode. | ||
| 602 | Draw character c using color and draw mode at x,y. | ||
| 603 | */ | ||
| 604 | void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font) { | ||
| 605 | // TODO - New routine to take font of any height, at the moment limited to font height in multiple of 8 pixels | ||
| 606 | |||
| 607 | uint8_t rowsToDraw,row, tempC; | ||
| 608 | uint8_t i,j,temp; | ||
| 609 | uint16_t charPerBitmapRow,charColPositionOnBitmap,charRowPositionOnBitmap,charBitmapStartPosition; | ||
| 610 | |||
| 611 | if ((font>=TOTALFONTS) || (font<0)) | ||
| 612 | return; | ||
| 613 | |||
| 614 | uint8_t fontType = font; | ||
| 615 | uint8_t fontWidth = pgm_read_byte(fonts_pointer[fontType]+0); | ||
| 616 | uint8_t fontHeight = pgm_read_byte(fonts_pointer[fontType]+1); | ||
| 617 | uint8_t fontStartChar = pgm_read_byte(fonts_pointer[fontType]+2); | ||
| 618 | uint8_t fontTotalChar = pgm_read_byte(fonts_pointer[fontType]+3); | ||
| 619 | uint16_t fontMapWidth = (pgm_read_byte(fonts_pointer[fontType]+4)*100)+pgm_read_byte(fonts_pointer[fontType]+5); // two bytes values into integer 16 | ||
| 620 | |||
| 621 | if ((c<fontStartChar) || (c>(fontStartChar+fontTotalChar-1))) // no bitmap for the required c | ||
| 622 | return; | ||
| 623 | |||
| 624 | tempC=c-fontStartChar; | ||
| 625 | |||
| 626 | // each row (in datasheet is call page) is 8 bits high, 16 bit high character will have 2 rows to be drawn | ||
| 627 | rowsToDraw=fontHeight/8; // 8 is LCD's page size, see SSD1306 datasheet | ||
| 628 | if (rowsToDraw<=1) rowsToDraw=1; | ||
| 629 | |||
| 630 | // the following draw function can draw anywhere on the screen, but SLOW pixel by pixel draw | ||
| 631 | if (rowsToDraw==1) { | ||
| 632 | for (i=0;i<fontWidth+1;i++) { | ||
| 633 | if (i==fontWidth) // this is done in a weird way because for 5x7 font, there is no margin, this code add a margin after col 5 | ||
| 634 | temp=0; | ||
| 635 | else | ||
| 636 | temp=pgm_read_byte(fonts_pointer[fontType]+FONTHEADERSIZE+(tempC*fontWidth)+i); | ||
| 637 | |||
| 638 | for (j=0;j<8;j++) { // 8 is the LCD's page height (see datasheet for explanation) | ||
| 639 | if (temp & 0x1) { | ||
| 640 | draw_pixel(x+i, y+j, color,mode); | ||
| 641 | } | ||
| 642 | else { | ||
| 643 | draw_pixel(x+i, y+j, !color,mode); | ||
| 644 | } | ||
| 645 | |||
| 646 | temp >>=1; | ||
| 647 | } | ||
| 648 | } | ||
| 649 | return; | ||
| 650 | } | ||
| 651 | |||
| 652 | // font height over 8 bit | ||
| 653 | // take character "0" ASCII 48 as example | ||
| 654 | charPerBitmapRow = fontMapWidth/fontWidth; // 256/8 =32 char per row | ||
| 655 | charColPositionOnBitmap = tempC % charPerBitmapRow; // =16 | ||
| 656 | charRowPositionOnBitmap = (int)(tempC/charPerBitmapRow); // =1 | ||
| 657 | charBitmapStartPosition = (charRowPositionOnBitmap * fontMapWidth * (fontHeight/8)) + (charColPositionOnBitmap * fontWidth) ; | ||
| 658 | |||
| 659 | // each row on LCD is 8 bit height (see datasheet for explanation) | ||
| 660 | for(row=0;row<rowsToDraw;row++) { | ||
| 661 | for (i=0; i<fontWidth;i++) { | ||
| 662 | temp=pgm_read_byte(fonts_pointer[fontType]+FONTHEADERSIZE+(charBitmapStartPosition+i+(row*fontMapWidth))); | ||
| 663 | for (j=0;j<8;j++) { // 8 is the LCD's page height (see datasheet for explanation) | ||
| 664 | if (temp & 0x1) { | ||
| 665 | draw_pixel(x+i,y+j+(row*8), color, mode); | ||
| 666 | } | ||
| 667 | else { | ||
| 668 | draw_pixel(x+i,y+j+(row*8), !color, mode); | ||
| 669 | } | ||
| 670 | temp >>=1; | ||
| 671 | } | ||
| 672 | } | ||
| 673 | } | ||
| 674 | |||
| 675 | } | ||
| 676 | |||
| 677 | void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mode, uint8_t font) { | ||
| 678 | |||
| 679 | if ((font>=TOTALFONTS) || (font<0)) | ||
| 680 | return; | ||
| 681 | |||
| 682 | uint8_t fontType = font; | ||
| 683 | uint8_t fontWidth = pgm_read_byte(fonts_pointer[fontType]+0); | ||
| 684 | |||
| 685 | uint8_t cur_x = x; | ||
| 686 | for (int i = 0; i < strlen(string); i++) { | ||
| 687 | draw_char(cur_x, y, string[i], color, mode, font); | ||
| 688 | cur_x += fontWidth + 1; | ||
| 689 | } | ||
| 690 | |||
| 691 | } | ||
diff --git a/drivers/qwiic/micro_oled.h b/drivers/qwiic/micro_oled.h new file mode 100644 index 000000000..5d6a1029e --- /dev/null +++ b/drivers/qwiic/micro_oled.h | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | /* Jim Lindblom @ SparkFun Electronics | ||
| 2 | * October 26, 2014 | ||
| 3 | * https://github.com/sparkfun/Micro_OLED_Breakout/tree/master/Firmware/Arduino/libraries/SFE_MicroOLED | ||
| 4 | * | ||
| 5 | * Modified by: | ||
| 6 | * Emil Varughese @ Edwin Robotics Pvt. Ltd. | ||
| 7 | * July 27, 2015 | ||
| 8 | * https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/ | ||
| 9 | * | ||
| 10 | * This code was heavily based around the MicroView library, written by GeekAmmo | ||
| 11 | * (https://github.com/geekammo/MicroView-Arduino-Library). | ||
| 12 | * | ||
| 13 | * Adapted for QMK by: | ||
| 14 | * Jack Humbert <jack.humb@gmail.com> | ||
| 15 | * October 11, 2018 | ||
| 16 | * | ||
| 17 | * This program is free software: you can redistribute it and/or modify | ||
| 18 | * it under the terms of the GNU General Public License as published by | ||
| 19 | * the Free Software Foundation, either version 3 of the License, or | ||
| 20 | * (at your option) any later version. | ||
| 21 | * | ||
| 22 | * This program is distributed in the hope that it will be useful, | ||
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 25 | * GNU General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU General Public License | ||
| 28 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 29 | */ | ||
| 30 | #pragma once | ||
| 31 | |||
| 32 | #include "qwiic.h" | ||
| 33 | |||
| 34 | void micro_oled_init(void); | ||
| 35 | |||
| 36 | void send_command(uint8_t command); | ||
| 37 | void send_data(uint8_t data); | ||
| 38 | void set_page_address(uint8_t address); | ||
| 39 | void set_column_address(uint8_t address); | ||
| 40 | void clear_screen(void); | ||
| 41 | void clear_buffer(void); | ||
| 42 | void send_buffer(void); | ||
| 43 | void draw_pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode); | ||
| 44 | void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, uint8_t mode); | ||
| 45 | void draw_line_hori(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode); | ||
| 46 | void draw_line_vert(uint8_t x, uint8_t y, uint8_t height, bool color, uint8_t mode); | ||
| 47 | void draw_rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode); | ||
| 48 | void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode); | ||
| 49 | void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode); | ||
| 50 | void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode); | ||
| 51 | void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font); | ||
| 52 | void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mode, uint8_t font); | ||
| 53 | |||
| 54 | #define I2C_ADDRESS_SA0_0 0b0111100 | ||
| 55 | #ifndef I2C_ADDRESS_SA0_1 | ||
| 56 | #define I2C_ADDRESS_SA0_1 0b0111101 | ||
| 57 | #endif | ||
| 58 | #define I2C_COMMAND 0x00 | ||
| 59 | #define I2C_DATA 0x40 | ||
| 60 | #define PIXEL_OFF 0 | ||
| 61 | #define PIXEL_ON 1 | ||
| 62 | |||
| 63 | #ifndef LCDWIDTH | ||
| 64 | #define LCDWIDTH 64 | ||
| 65 | #endif | ||
| 66 | #ifndef LCDWIDTH | ||
| 67 | #define LCDHEIGHT 48 | ||
| 68 | #endif | ||
| 69 | #define FONTHEADERSIZE 6 | ||
| 70 | |||
| 71 | #define NORM 0 | ||
| 72 | #define XOR 1 | ||
| 73 | |||
| 74 | #define PAGE 0 | ||
| 75 | #define ALL 1 | ||
| 76 | |||
| 77 | #define WIDGETSTYLE0 0 | ||
| 78 | #define WIDGETSTYLE1 1 | ||
| 79 | #define WIDGETSTYLE2 2 | ||
| 80 | |||
| 81 | #define SETCONTRAST 0x81 | ||
| 82 | #define DISPLAYALLONRESUME 0xA4 | ||
| 83 | #define DISPLAYALLON 0xA5 | ||
| 84 | #define NORMALDISPLAY 0xA6 | ||
| 85 | #define INVERTDISPLAY 0xA7 | ||
| 86 | #define DISPLAYOFF 0xAE | ||
| 87 | #define DISPLAYON 0xAF | ||
| 88 | #define SETDISPLAYOFFSET 0xD3 | ||
| 89 | #define SETCOMPINS 0xDA | ||
| 90 | #define SETVCOMDESELECT 0xDB | ||
| 91 | #define SETDISPLAYCLOCKDIV 0xD5 | ||
| 92 | #define SETPRECHARGE 0xD9 | ||
| 93 | #define SETMULTIPLEX 0xA8 | ||
| 94 | #define SETLOWCOLUMN 0x00 | ||
| 95 | #define SETHIGHCOLUMN 0x10 | ||
| 96 | #define SETSTARTLINE 0x40 | ||
| 97 | #define MEMORYMODE 0x20 | ||
| 98 | #define COMSCANINC 0xC0 | ||
| 99 | #define COMSCANDEC 0xC8 | ||
| 100 | #define SEGREMAP 0xA0 | ||
| 101 | #define CHARGEPUMP 0x8D | ||
| 102 | #define EXTERNALVCC 0x01 | ||
| 103 | #define SWITCHCAPVCC 0x02 | ||
| 104 | |||
| 105 | // Scroll | ||
| 106 | #define ACTIVATESCROLL 0x2F | ||
| 107 | #define DEACTIVATESCROLL 0x2E | ||
| 108 | #define SETVERTICALSCROLLAREA 0xA3 | ||
| 109 | #define RIGHTHORIZONTALSCROLL 0x26 | ||
| 110 | #define LEFT_HORIZONTALSCROLL 0x27 | ||
| 111 | #define VERTICALRIGHTHORIZONTALSCROLL 0x29 | ||
| 112 | #define VERTICALLEFTHORIZONTALSCROLL 0x2A | ||
| 113 | |||
| 114 | typedef enum CMD { | ||
| 115 | CMD_CLEAR, //0 | ||
| 116 | CMD_INVERT, //1 | ||
| 117 | CMD_CONTRAST, //2 | ||
| 118 | CMD_DISPLAY, //3 | ||
| 119 | CMD_SETCURSOR, //4 | ||
| 120 | CMD_PIXEL, //5 | ||
| 121 | CMD_LINE, //6 | ||
| 122 | CMD_LINEH, //7 | ||
| 123 | CMD_LINEV, //8 | ||
| 124 | CMD_RECT, //9 | ||
| 125 | CMD_RECTFILL, //10 | ||
| 126 | CMD_CIRCLE, //11 | ||
| 127 | CMD_CIRCLEFILL, //12 | ||
| 128 | CMD_DRAWCHAR, //13 | ||
| 129 | CMD_DRAWBITMAP, //14 | ||
| 130 | CMD_GETLCDWIDTH, //15 | ||
| 131 | CMD_GETLCDHEIGHT, //16 | ||
| 132 | CMD_SETCOLOR, //17 | ||
| 133 | CMD_SETDRAWMODE //18 | ||
| 134 | } commCommand_t; \ No newline at end of file | ||
diff --git a/drivers/qwiic/qwiic.c b/drivers/qwiic/qwiic.c new file mode 100644 index 000000000..904791992 --- /dev/null +++ b/drivers/qwiic/qwiic.c | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include "qwiic.h" | ||
| 17 | |||
| 18 | void qwiic_init(void) { | ||
| 19 | #ifdef QWIIC_JOYSTIIC_ENABLE | ||
| 20 | joystiic_init(); | ||
| 21 | #endif | ||
| 22 | #ifdef QWIIC_MICRO_OLED_ENABLE | ||
| 23 | micro_oled_init(); | ||
| 24 | #endif | ||
| 25 | } | ||
| 26 | |||
| 27 | void qwiic_task(void) { | ||
| 28 | #ifdef QWIIC_JOYSTIIC_ENABLE | ||
| 29 | joystiic_task(); | ||
| 30 | #endif | ||
| 31 | } | ||
diff --git a/drivers/qwiic/qwiic.h b/drivers/qwiic/qwiic.h new file mode 100644 index 000000000..160fb28df --- /dev/null +++ b/drivers/qwiic/qwiic.h | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | |||
| 18 | #include "i2c_master.h" | ||
| 19 | |||
| 20 | #ifdef QWIIC_JOYSTIIC_ENABLE | ||
| 21 | #include "joystiic.h" | ||
| 22 | #endif | ||
| 23 | #ifdef QWIIC_MICRO_OLED_ENABLE | ||
| 24 | #include "micro_oled.h" | ||
| 25 | #endif | ||
| 26 | |||
| 27 | void qwiic_init(void); | ||
| 28 | void qwiic_task(void); | ||
diff --git a/drivers/qwiic/qwiic.mk b/drivers/qwiic/qwiic.mk new file mode 100644 index 000000000..4ae2d78e3 --- /dev/null +++ b/drivers/qwiic/qwiic.mk | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | ifneq ($(strip $(QWIIC_ENABLE)),) | ||
| 2 | COMMON_VPATH += $(DRIVER_PATH)/qwiic | ||
| 3 | OPT_DEFS += -DQWIIC_ENABLE | ||
| 4 | SRC += qwiic.c | ||
| 5 | ifeq ($(filter "i2c_master.c", $(SRC)),) | ||
| 6 | SRC += i2c_master.c | ||
| 7 | endif | ||
| 8 | endif | ||
| 9 | |||
| 10 | ifneq ($(filter JOYSTIIC, $(QWIIC_ENABLE)),) | ||
| 11 | OPT_DEFS += -DQWIIC_JOYSTIIC_ENABLE | ||
| 12 | SRC += joystiic.c | ||
| 13 | endif | ||
| 14 | |||
| 15 | ifneq ($(filter MICRO_OLED, $(QWIIC_ENABLE)),) | ||
| 16 | OPT_DEFS += -DQWIIC_MICRO_OLED_ENABLE | ||
| 17 | SRC += micro_oled.c | ||
| 18 | endif | ||
diff --git a/drivers/qwiic/util/font5x7.h b/drivers/qwiic/util/font5x7.h new file mode 100644 index 000000000..0bad206b7 --- /dev/null +++ b/drivers/qwiic/util/font5x7.h | |||
| @@ -0,0 +1,288 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | font5x7.h | ||
| 3 | Definition for small font | ||
| 4 | |||
| 5 | This file was imported from the MicroView library, written by GeekAmmo | ||
| 6 | (https://github.com/geekammo/MicroView-Arduino-Library), and released under | ||
| 7 | the terms of the GNU General Public License as published by the Free Software | ||
| 8 | Foundation, either version 3 of the License, or (at your option) any later | ||
| 9 | version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | Modified by: | ||
| 20 | Emil Varughese @ Edwin Robotics Pvt. Ltd. | ||
| 21 | July 27, 2015 | ||
| 22 | https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/ | ||
| 23 | |||
| 24 | ******************************************************************************/ | ||
| 25 | #pragma once | ||
| 26 | |||
| 27 | #include "progmem.h" | ||
| 28 | |||
| 29 | // Standard ASCII 5x7 font | ||
| 30 | static const unsigned char font5x7[] PROGMEM = { | ||
| 31 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) | ||
| 32 | 5,8,0,255,12,75, | ||
| 33 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 34 | 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, | ||
| 35 | 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, | ||
| 36 | 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, | ||
| 37 | 0x18, 0x3C, 0x7E, 0x3C, 0x18, | ||
| 38 | 0x1C, 0x57, 0x7D, 0x57, 0x1C, | ||
| 39 | 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, | ||
| 40 | 0x00, 0x18, 0x3C, 0x18, 0x00, | ||
| 41 | 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, | ||
| 42 | 0x00, 0x18, 0x24, 0x18, 0x00, | ||
| 43 | 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, | ||
| 44 | 0x30, 0x48, 0x3A, 0x06, 0x0E, | ||
| 45 | 0x26, 0x29, 0x79, 0x29, 0x26, | ||
| 46 | 0x40, 0x7F, 0x05, 0x05, 0x07, | ||
| 47 | 0x40, 0x7F, 0x05, 0x25, 0x3F, | ||
| 48 | 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, | ||
| 49 | 0x7F, 0x3E, 0x1C, 0x1C, 0x08, | ||
| 50 | 0x08, 0x1C, 0x1C, 0x3E, 0x7F, | ||
| 51 | 0x14, 0x22, 0x7F, 0x22, 0x14, | ||
| 52 | 0x5F, 0x5F, 0x00, 0x5F, 0x5F, | ||
| 53 | 0x06, 0x09, 0x7F, 0x01, 0x7F, | ||
| 54 | 0x00, 0x66, 0x89, 0x95, 0x6A, | ||
| 55 | 0x60, 0x60, 0x60, 0x60, 0x60, | ||
| 56 | 0x94, 0xA2, 0xFF, 0xA2, 0x94, | ||
| 57 | 0x08, 0x04, 0x7E, 0x04, 0x08, | ||
| 58 | 0x10, 0x20, 0x7E, 0x20, 0x10, | ||
| 59 | 0x08, 0x08, 0x2A, 0x1C, 0x08, | ||
| 60 | 0x08, 0x1C, 0x2A, 0x08, 0x08, | ||
| 61 | 0x1E, 0x10, 0x10, 0x10, 0x10, | ||
| 62 | 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, | ||
| 63 | 0x30, 0x38, 0x3E, 0x38, 0x30, | ||
| 64 | 0x06, 0x0E, 0x3E, 0x0E, 0x06, | ||
| 65 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 66 | 0x00, 0x00, 0x5F, 0x00, 0x00, | ||
| 67 | 0x00, 0x07, 0x00, 0x07, 0x00, | ||
| 68 | 0x14, 0x7F, 0x14, 0x7F, 0x14, | ||
| 69 | 0x24, 0x2A, 0x7F, 0x2A, 0x12, | ||
| 70 | 0x23, 0x13, 0x08, 0x64, 0x62, | ||
| 71 | 0x36, 0x49, 0x56, 0x20, 0x50, | ||
| 72 | 0x00, 0x08, 0x07, 0x03, 0x00, | ||
| 73 | 0x00, 0x1C, 0x22, 0x41, 0x00, | ||
| 74 | 0x00, 0x41, 0x22, 0x1C, 0x00, | ||
| 75 | 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, | ||
| 76 | 0x08, 0x08, 0x3E, 0x08, 0x08, | ||
| 77 | 0x00, 0x80, 0x70, 0x30, 0x00, | ||
| 78 | 0x08, 0x08, 0x08, 0x08, 0x08, | ||
| 79 | 0x00, 0x00, 0x60, 0x60, 0x00, | ||
| 80 | 0x20, 0x10, 0x08, 0x04, 0x02, | ||
| 81 | 0x3E, 0x51, 0x49, 0x45, 0x3E, | ||
| 82 | 0x00, 0x42, 0x7F, 0x40, 0x00, | ||
| 83 | 0x72, 0x49, 0x49, 0x49, 0x46, | ||
| 84 | 0x21, 0x41, 0x49, 0x4D, 0x33, | ||
| 85 | 0x18, 0x14, 0x12, 0x7F, 0x10, | ||
| 86 | 0x27, 0x45, 0x45, 0x45, 0x39, | ||
| 87 | 0x3C, 0x4A, 0x49, 0x49, 0x31, | ||
| 88 | 0x41, 0x21, 0x11, 0x09, 0x07, | ||
| 89 | 0x36, 0x49, 0x49, 0x49, 0x36, | ||
| 90 | 0x46, 0x49, 0x49, 0x29, 0x1E, | ||
| 91 | 0x00, 0x00, 0x14, 0x00, 0x00, | ||
| 92 | 0x00, 0x40, 0x34, 0x00, 0x00, | ||
| 93 | 0x00, 0x08, 0x14, 0x22, 0x41, | ||
| 94 | 0x14, 0x14, 0x14, 0x14, 0x14, | ||
| 95 | 0x00, 0x41, 0x22, 0x14, 0x08, | ||
| 96 | 0x02, 0x01, 0x59, 0x09, 0x06, | ||
| 97 | 0x3E, 0x41, 0x5D, 0x59, 0x4E, | ||
| 98 | 0x7C, 0x12, 0x11, 0x12, 0x7C, | ||
| 99 | 0x7F, 0x49, 0x49, 0x49, 0x36, | ||
| 100 | 0x3E, 0x41, 0x41, 0x41, 0x22, | ||
| 101 | 0x7F, 0x41, 0x41, 0x41, 0x3E, | ||
| 102 | 0x7F, 0x49, 0x49, 0x49, 0x41, | ||
| 103 | 0x7F, 0x09, 0x09, 0x09, 0x01, | ||
| 104 | 0x3E, 0x41, 0x41, 0x51, 0x73, | ||
| 105 | 0x7F, 0x08, 0x08, 0x08, 0x7F, | ||
| 106 | 0x00, 0x41, 0x7F, 0x41, 0x00, | ||
| 107 | 0x20, 0x40, 0x41, 0x3F, 0x01, | ||
| 108 | 0x7F, 0x08, 0x14, 0x22, 0x41, | ||
| 109 | 0x7F, 0x40, 0x40, 0x40, 0x40, | ||
| 110 | 0x7F, 0x02, 0x1C, 0x02, 0x7F, | ||
| 111 | 0x7F, 0x04, 0x08, 0x10, 0x7F, | ||
| 112 | 0x3E, 0x41, 0x41, 0x41, 0x3E, | ||
| 113 | 0x7F, 0x09, 0x09, 0x09, 0x06, | ||
| 114 | 0x3E, 0x41, 0x51, 0x21, 0x5E, | ||
| 115 | 0x7F, 0x09, 0x19, 0x29, 0x46, | ||
| 116 | 0x26, 0x49, 0x49, 0x49, 0x32, | ||
| 117 | 0x03, 0x01, 0x7F, 0x01, 0x03, | ||
| 118 | 0x3F, 0x40, 0x40, 0x40, 0x3F, | ||
| 119 | 0x1F, 0x20, 0x40, 0x20, 0x1F, | ||
| 120 | 0x3F, 0x40, 0x38, 0x40, 0x3F, | ||
| 121 | 0x63, 0x14, 0x08, 0x14, 0x63, | ||
| 122 | 0x03, 0x04, 0x78, 0x04, 0x03, | ||
| 123 | 0x61, 0x59, 0x49, 0x4D, 0x43, | ||
| 124 | 0x00, 0x7F, 0x41, 0x41, 0x41, | ||
| 125 | 0x02, 0x04, 0x08, 0x10, 0x20, | ||
| 126 | 0x00, 0x41, 0x41, 0x41, 0x7F, | ||
| 127 | 0x04, 0x02, 0x01, 0x02, 0x04, | ||
| 128 | 0x40, 0x40, 0x40, 0x40, 0x40, | ||
| 129 | 0x00, 0x03, 0x07, 0x08, 0x00, | ||
| 130 | 0x20, 0x54, 0x54, 0x78, 0x40, | ||
| 131 | 0x7F, 0x28, 0x44, 0x44, 0x38, | ||
| 132 | 0x38, 0x44, 0x44, 0x44, 0x28, | ||
| 133 | 0x38, 0x44, 0x44, 0x28, 0x7F, | ||
| 134 | 0x38, 0x54, 0x54, 0x54, 0x18, | ||
| 135 | 0x00, 0x08, 0x7E, 0x09, 0x02, | ||
| 136 | 0x18, 0xA4, 0xA4, 0x9C, 0x78, | ||
| 137 | 0x7F, 0x08, 0x04, 0x04, 0x78, | ||
| 138 | 0x00, 0x44, 0x7D, 0x40, 0x00, | ||
| 139 | 0x20, 0x40, 0x40, 0x3D, 0x00, | ||
| 140 | 0x7F, 0x10, 0x28, 0x44, 0x00, | ||
| 141 | 0x00, 0x41, 0x7F, 0x40, 0x00, | ||
| 142 | 0x7C, 0x04, 0x78, 0x04, 0x78, | ||
| 143 | 0x7C, 0x08, 0x04, 0x04, 0x78, | ||
| 144 | 0x38, 0x44, 0x44, 0x44, 0x38, | ||
| 145 | 0xFC, 0x18, 0x24, 0x24, 0x18, | ||
| 146 | 0x18, 0x24, 0x24, 0x18, 0xFC, | ||
| 147 | 0x7C, 0x08, 0x04, 0x04, 0x08, | ||
| 148 | 0x48, 0x54, 0x54, 0x54, 0x24, | ||
| 149 | 0x04, 0x04, 0x3F, 0x44, 0x24, | ||
| 150 | 0x3C, 0x40, 0x40, 0x20, 0x7C, | ||
| 151 | 0x1C, 0x20, 0x40, 0x20, 0x1C, | ||
| 152 | 0x3C, 0x40, 0x30, 0x40, 0x3C, | ||
| 153 | 0x44, 0x28, 0x10, 0x28, 0x44, | ||
| 154 | 0x4C, 0x90, 0x90, 0x90, 0x7C, | ||
| 155 | 0x44, 0x64, 0x54, 0x4C, 0x44, | ||
| 156 | 0x00, 0x08, 0x36, 0x41, 0x00, | ||
| 157 | 0x00, 0x00, 0x77, 0x00, 0x00, | ||
| 158 | 0x00, 0x41, 0x36, 0x08, 0x00, | ||
| 159 | 0x02, 0x01, 0x02, 0x04, 0x02, | ||
| 160 | 0x3C, 0x26, 0x23, 0x26, 0x3C, | ||
| 161 | 0x1E, 0xA1, 0xA1, 0x61, 0x12, | ||
| 162 | 0x3A, 0x40, 0x40, 0x20, 0x7A, | ||
| 163 | 0x38, 0x54, 0x54, 0x55, 0x59, | ||
| 164 | 0x21, 0x55, 0x55, 0x79, 0x41, | ||
| 165 | 0x21, 0x54, 0x54, 0x78, 0x41, | ||
| 166 | 0x21, 0x55, 0x54, 0x78, 0x40, | ||
| 167 | 0x20, 0x54, 0x55, 0x79, 0x40, | ||
| 168 | 0x0C, 0x1E, 0x52, 0x72, 0x12, | ||
| 169 | 0x39, 0x55, 0x55, 0x55, 0x59, | ||
| 170 | 0x39, 0x54, 0x54, 0x54, 0x59, | ||
| 171 | 0x39, 0x55, 0x54, 0x54, 0x58, | ||
| 172 | 0x00, 0x00, 0x45, 0x7C, 0x41, | ||
| 173 | 0x00, 0x02, 0x45, 0x7D, 0x42, | ||
| 174 | 0x00, 0x01, 0x45, 0x7C, 0x40, | ||
| 175 | 0xF0, 0x29, 0x24, 0x29, 0xF0, | ||
| 176 | 0xF0, 0x28, 0x25, 0x28, 0xF0, | ||
| 177 | 0x7C, 0x54, 0x55, 0x45, 0x00, | ||
| 178 | 0x20, 0x54, 0x54, 0x7C, 0x54, | ||
| 179 | 0x7C, 0x0A, 0x09, 0x7F, 0x49, | ||
| 180 | 0x32, 0x49, 0x49, 0x49, 0x32, | ||
| 181 | 0x32, 0x48, 0x48, 0x48, 0x32, | ||
| 182 | 0x32, 0x4A, 0x48, 0x48, 0x30, | ||
| 183 | 0x3A, 0x41, 0x41, 0x21, 0x7A, | ||
| 184 | 0x3A, 0x42, 0x40, 0x20, 0x78, | ||
| 185 | 0x00, 0x9D, 0xA0, 0xA0, 0x7D, | ||
| 186 | 0x39, 0x44, 0x44, 0x44, 0x39, | ||
| 187 | 0x3D, 0x40, 0x40, 0x40, 0x3D, | ||
| 188 | 0x3C, 0x24, 0xFF, 0x24, 0x24, | ||
| 189 | 0x48, 0x7E, 0x49, 0x43, 0x66, | ||
| 190 | 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, | ||
| 191 | 0xFF, 0x09, 0x29, 0xF6, 0x20, | ||
| 192 | 0xC0, 0x88, 0x7E, 0x09, 0x03, | ||
| 193 | 0x20, 0x54, 0x54, 0x79, 0x41, | ||
| 194 | 0x00, 0x00, 0x44, 0x7D, 0x41, | ||
| 195 | 0x30, 0x48, 0x48, 0x4A, 0x32, | ||
| 196 | 0x38, 0x40, 0x40, 0x22, 0x7A, | ||
| 197 | 0x00, 0x7A, 0x0A, 0x0A, 0x72, | ||
| 198 | 0x7D, 0x0D, 0x19, 0x31, 0x7D, | ||
| 199 | 0x26, 0x29, 0x29, 0x2F, 0x28, | ||
| 200 | 0x26, 0x29, 0x29, 0x29, 0x26, | ||
| 201 | 0x30, 0x48, 0x4D, 0x40, 0x20, | ||
| 202 | 0x38, 0x08, 0x08, 0x08, 0x08, | ||
| 203 | 0x08, 0x08, 0x08, 0x08, 0x38, | ||
| 204 | 0x2F, 0x10, 0xC8, 0xAC, 0xBA, | ||
| 205 | 0x2F, 0x10, 0x28, 0x34, 0xFA, | ||
| 206 | 0x00, 0x00, 0x7B, 0x00, 0x00, | ||
| 207 | 0x08, 0x14, 0x2A, 0x14, 0x22, | ||
| 208 | 0x22, 0x14, 0x2A, 0x14, 0x08, | ||
| 209 | 0xAA, 0x00, 0x55, 0x00, 0xAA, | ||
| 210 | 0xAA, 0x55, 0xAA, 0x55, 0xAA, | ||
| 211 | 0x00, 0x00, 0x00, 0xFF, 0x00, | ||
| 212 | 0x10, 0x10, 0x10, 0xFF, 0x00, | ||
| 213 | 0x14, 0x14, 0x14, 0xFF, 0x00, | ||
| 214 | 0x10, 0x10, 0xFF, 0x00, 0xFF, | ||
| 215 | 0x10, 0x10, 0xF0, 0x10, 0xF0, | ||
| 216 | 0x14, 0x14, 0x14, 0xFC, 0x00, | ||
| 217 | 0x14, 0x14, 0xF7, 0x00, 0xFF, | ||
| 218 | 0x00, 0x00, 0xFF, 0x00, 0xFF, | ||
| 219 | 0x14, 0x14, 0xF4, 0x04, 0xFC, | ||
| 220 | 0x14, 0x14, 0x17, 0x10, 0x1F, | ||
| 221 | 0x10, 0x10, 0x1F, 0x10, 0x1F, | ||
| 222 | 0x14, 0x14, 0x14, 0x1F, 0x00, | ||
| 223 | 0x10, 0x10, 0x10, 0xF0, 0x00, | ||
| 224 | 0x00, 0x00, 0x00, 0x1F, 0x10, | ||
| 225 | 0x10, 0x10, 0x10, 0x1F, 0x10, | ||
| 226 | 0x10, 0x10, 0x10, 0xF0, 0x10, | ||
| 227 | 0x00, 0x00, 0x00, 0xFF, 0x10, | ||
| 228 | 0x10, 0x10, 0x10, 0x10, 0x10, | ||
| 229 | 0x10, 0x10, 0x10, 0xFF, 0x10, | ||
| 230 | 0x00, 0x00, 0x00, 0xFF, 0x14, | ||
| 231 | 0x00, 0x00, 0xFF, 0x00, 0xFF, | ||
| 232 | 0x00, 0x00, 0x1F, 0x10, 0x17, | ||
| 233 | 0x00, 0x00, 0xFC, 0x04, 0xF4, | ||
| 234 | 0x14, 0x14, 0x17, 0x10, 0x17, | ||
| 235 | 0x14, 0x14, 0xF4, 0x04, 0xF4, | ||
| 236 | 0x00, 0x00, 0xFF, 0x00, 0xF7, | ||
| 237 | 0x14, 0x14, 0x14, 0x14, 0x14, | ||
| 238 | 0x14, 0x14, 0xF7, 0x00, 0xF7, | ||
| 239 | 0x14, 0x14, 0x14, 0x17, 0x14, | ||
| 240 | 0x10, 0x10, 0x1F, 0x10, 0x1F, | ||
| 241 | 0x14, 0x14, 0x14, 0xF4, 0x14, | ||
| 242 | 0x10, 0x10, 0xF0, 0x10, 0xF0, | ||
| 243 | 0x00, 0x00, 0x1F, 0x10, 0x1F, | ||
| 244 | 0x00, 0x00, 0x00, 0x1F, 0x14, | ||
| 245 | 0x00, 0x00, 0x00, 0xFC, 0x14, | ||
| 246 | 0x00, 0x00, 0xF0, 0x10, 0xF0, | ||
| 247 | 0x10, 0x10, 0xFF, 0x10, 0xFF, | ||
| 248 | 0x14, 0x14, 0x14, 0xFF, 0x14, | ||
| 249 | 0x10, 0x10, 0x10, 0x1F, 0x00, | ||
| 250 | 0x00, 0x00, 0x00, 0xF0, 0x10, | ||
| 251 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 252 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | ||
| 253 | 0xFF, 0xFF, 0xFF, 0x00, 0x00, | ||
| 254 | 0x00, 0x00, 0x00, 0xFF, 0xFF, | ||
| 255 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | ||
| 256 | 0x38, 0x44, 0x44, 0x38, 0x44, | ||
| 257 | 0x7C, 0x2A, 0x2A, 0x3E, 0x14, | ||
| 258 | 0x7E, 0x02, 0x02, 0x06, 0x06, | ||
| 259 | 0x02, 0x7E, 0x02, 0x7E, 0x02, | ||
| 260 | 0x63, 0x55, 0x49, 0x41, 0x63, | ||
| 261 | 0x38, 0x44, 0x44, 0x3C, 0x04, | ||
| 262 | 0x40, 0x7E, 0x20, 0x1E, 0x20, | ||
| 263 | 0x06, 0x02, 0x7E, 0x02, 0x02, | ||
| 264 | 0x99, 0xA5, 0xE7, 0xA5, 0x99, | ||
| 265 | 0x1C, 0x2A, 0x49, 0x2A, 0x1C, | ||
| 266 | 0x4C, 0x72, 0x01, 0x72, 0x4C, | ||
| 267 | 0x30, 0x4A, 0x4D, 0x4D, 0x30, | ||
| 268 | 0x30, 0x48, 0x78, 0x48, 0x30, | ||
| 269 | 0xBC, 0x62, 0x5A, 0x46, 0x3D, | ||
| 270 | 0x3E, 0x49, 0x49, 0x49, 0x00, | ||
| 271 | 0x7E, 0x01, 0x01, 0x01, 0x7E, | ||
| 272 | 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, | ||
| 273 | 0x44, 0x44, 0x5F, 0x44, 0x44, | ||
| 274 | 0x40, 0x51, 0x4A, 0x44, 0x40, | ||
| 275 | 0x40, 0x44, 0x4A, 0x51, 0x40, | ||
| 276 | 0x00, 0x00, 0xFF, 0x01, 0x03, | ||
| 277 | 0xE0, 0x80, 0xFF, 0x00, 0x00, | ||
| 278 | 0x08, 0x08, 0x6B, 0x6B, 0x08, | ||
| 279 | 0x36, 0x12, 0x36, 0x24, 0x36, | ||
| 280 | 0x06, 0x0F, 0x09, 0x0F, 0x06, | ||
| 281 | 0x00, 0x00, 0x18, 0x18, 0x00, | ||
| 282 | 0x00, 0x00, 0x10, 0x10, 0x00, | ||
| 283 | 0x30, 0x40, 0xFF, 0x01, 0x01, | ||
| 284 | 0x00, 0x1F, 0x01, 0x01, 0x1E, | ||
| 285 | 0x00, 0x19, 0x1D, 0x17, 0x12, | ||
| 286 | 0x00, 0x3C, 0x3C, 0x3C, 0x3C, | ||
| 287 | 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 288 | }; | ||
diff --git a/drivers/qwiic/util/font8x16.h b/drivers/qwiic/util/font8x16.h new file mode 100644 index 000000000..c070e4ec8 --- /dev/null +++ b/drivers/qwiic/util/font8x16.h | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | font8x16.h | ||
| 3 | Definition for medium font | ||
| 4 | |||
| 5 | This file was imported from the MicroView library, written by GeekAmmo | ||
| 6 | (https://github.com/geekammo/MicroView-Arduino-Library), and released under | ||
| 7 | the terms of the GNU General Public License as published by the Free Software | ||
| 8 | Foundation, either version 3 of the License, or (at your option) any later | ||
| 9 | version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | Modified by: | ||
| 20 | Emil Varughese @ Edwin Robotics Pvt. Ltd. | ||
| 21 | July 27, 2015 | ||
| 22 | https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/ | ||
| 23 | ******************************************************************************/ | ||
| 24 | #pragma once | ||
| 25 | |||
| 26 | #include "progmem.h" | ||
| 27 | |||
| 28 | static const unsigned char font8x16[] PROGMEM = { | ||
| 29 | // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256) | ||
| 30 | 8,16,32,96,2,56, | ||
| 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, | ||
| 32 | 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xBE, 0x90, 0xD0, 0xBE, 0x90, 0x00, | ||
| 33 | 0x00, 0x1C, 0x62, 0xFF, 0xC2, 0x80, 0x00, 0x00, 0x0C, 0x12, 0x92, 0x4C, 0xB0, 0x88, 0x06, 0x00, | ||
| 34 | 0x80, 0x7C, 0x62, 0xB2, 0x1C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x00, | ||
| 35 | 0x00, 0xE0, 0x18, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x18, 0xE0, 0x00, 0x00, | ||
| 36 | 0x00, 0x24, 0x18, 0x7E, 0x18, 0x24, 0x00, 0x00, 0x80, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00, | ||
| 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, | ||
| 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x18, 0x06, 0x00, 0x00, | ||
| 39 | 0xF8, 0x04, 0xC2, 0x32, 0x0C, 0xF8, 0x00, 0x00, 0x00, 0x04, 0x04, 0xFE, 0x00, 0x00, 0x00, 0x00, | ||
| 40 | 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, | ||
| 41 | 0xC0, 0xA0, 0x98, 0x84, 0xFE, 0x80, 0x80, 0x00, 0x00, 0x1E, 0x12, 0x12, 0x22, 0xC2, 0x00, 0x00, | ||
| 42 | 0xF8, 0x44, 0x22, 0x22, 0x22, 0xC0, 0x00, 0x00, 0x00, 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, | ||
| 43 | 0x00, 0x8C, 0x52, 0x22, 0x52, 0x8C, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x26, 0xF8, 0x00, 0x00, | ||
| 44 | 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, | ||
| 45 | 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, | ||
| 46 | 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00, | ||
| 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, | ||
| 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, | ||
| 49 | 0x00, 0x04, 0x04, 0x0F, 0x04, 0x03, 0x00, 0x00, 0x04, 0x02, 0x01, 0x03, 0x04, 0x04, 0x03, 0x00, | ||
| 50 | 0x03, 0x04, 0x04, 0x04, 0x05, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 51 | 0x00, 0x03, 0x06, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x06, 0x03, 0x00, 0x00, | ||
| 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, | ||
| 53 | 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 54 | 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 55 | 0x01, 0x03, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00, | ||
| 56 | 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, | ||
| 57 | 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, | ||
| 58 | 0x01, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 59 | 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, | ||
| 60 | 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, | ||
| 61 | 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x04, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, | ||
| 62 | 0x04, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 63 | 0xF8, 0x04, 0x72, 0x8A, 0xFA, 0x84, 0x78, 0x00, 0x00, 0xC0, 0x38, 0x06, 0x38, 0xC0, 0x00, 0x00, | ||
| 64 | 0x00, 0xFE, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, | ||
| 65 | 0xFE, 0x02, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, | ||
| 66 | 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x22, 0xE2, 0x00, 0x00, | ||
| 67 | 0xFE, 0x20, 0x20, 0x20, 0x20, 0xFE, 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x00, 0x00, | ||
| 68 | 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0xFE, 0x40, 0xB0, 0x08, 0x04, 0x02, 0x00, 0x00, | ||
| 69 | 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0C, 0x70, 0x80, 0x70, 0x0C, 0xFE, 0x00, | ||
| 70 | 0xFE, 0x0C, 0x30, 0xC0, 0x00, 0xFE, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, | ||
| 71 | 0xFE, 0x42, 0x42, 0x42, 0x22, 0x1C, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, | ||
| 72 | 0x00, 0xFE, 0x42, 0x42, 0xA2, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x42, 0x42, 0x80, 0x00, 0x00, | ||
| 73 | 0x02, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x02, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, | ||
| 74 | 0x06, 0x38, 0xC0, 0x00, 0xC0, 0x38, 0x06, 0x00, 0x3E, 0xC0, 0xF0, 0x0E, 0xF0, 0xC0, 0x3E, 0x00, | ||
| 75 | 0x00, 0x06, 0x98, 0x60, 0x98, 0x06, 0x00, 0x00, 0x00, 0x06, 0x18, 0xE0, 0x18, 0x06, 0x00, 0x00, | ||
| 76 | 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x02, 0x02, 0x02, 0x02, 0x00, | ||
| 77 | 0x00, 0x06, 0x18, 0x60, 0x80, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, | ||
| 78 | 0x40, 0x30, 0x0C, 0x0C, 0x30, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 79 | 0x01, 0x02, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x06, 0x00, | ||
| 80 | 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, | ||
| 81 | 0x07, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, | ||
| 82 | 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, | ||
| 83 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00, | ||
| 84 | 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00, | ||
| 85 | 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x00, | ||
| 86 | 0x07, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, | ||
| 87 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0C, 0x12, 0x11, 0x10, 0x00, | ||
| 88 | 0x00, 0x07, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, | ||
| 89 | 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, | ||
| 90 | 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, | ||
| 91 | 0x00, 0x06, 0x01, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, | ||
| 92 | 0x06, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x00, | ||
| 93 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, | ||
| 94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, | ||
| 95 | 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, | ||
| 96 | 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, | ||
| 97 | 0x00, 0xE0, 0x10, 0x10, 0x10, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00, | ||
| 98 | 0x00, 0x20, 0xFC, 0x22, 0x22, 0x22, 0x02, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, | ||
| 99 | 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 100 | 0x00, 0x10, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, | ||
| 101 | 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x10, 0xF0, 0x20, 0x10, 0xF0, 0x00, | ||
| 102 | 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00, | ||
| 103 | 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, | ||
| 104 | 0x00, 0xF0, 0x20, 0x10, 0x10, 0x70, 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x20, 0x00, 0x00, | ||
| 105 | 0x00, 0x20, 0x20, 0xFC, 0x20, 0x20, 0x20, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, | ||
| 106 | 0x00, 0x70, 0x80, 0x00, 0x80, 0x70, 0x00, 0x00, 0xF0, 0x00, 0xC0, 0x30, 0xC0, 0x00, 0xF0, 0x00, | ||
| 107 | 0x00, 0x30, 0xC0, 0xC0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00, | ||
| 108 | 0x00, 0x10, 0x10, 0x90, 0x50, 0x30, 0x00, 0x00, 0x00, 0x80, 0x80, 0x7E, 0x02, 0x02, 0x00, 0x00, | ||
| 109 | 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x7E, 0x80, 0x80, 0x00, 0x00, | ||
| 110 | 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 111 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, | ||
| 112 | 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, | ||
| 113 | 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, | ||
| 114 | 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x24, 0x24, 0x22, 0x1F, 0x00, 0x00, | ||
| 115 | 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00, | ||
| 116 | 0x20, 0x20, 0x20, 0x20, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00, | ||
| 117 | 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, | ||
| 118 | 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, | ||
| 119 | 0x00, 0x3F, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x3F, 0x00, 0x00, | ||
| 120 | 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, | ||
| 121 | 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, | ||
| 122 | 0x00, 0x00, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x01, 0x06, 0x01, 0x00, | ||
| 123 | 0x00, 0x06, 0x01, 0x01, 0x06, 0x00, 0x00, 0x00, 0x20, 0x20, 0x31, 0x0E, 0x03, 0x00, 0x00, 0x00, | ||
| 124 | 0x00, 0x06, 0x05, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x00, 0x00, | ||
| 125 | 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, | ||
| 126 | 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 127 | }; | ||
diff --git a/keyboards/hadron/config.h b/keyboards/hadron/config.h index 9111ad727..d54d2c543 100644 --- a/keyboards/hadron/config.h +++ b/keyboards/hadron/config.h | |||
| @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 24 | #define PRODUCT_ID 0x6060 | 24 | #define PRODUCT_ID 0x6060 |
| 25 | #define MANUFACTURER ishtob | 25 | #define MANUFACTURER ishtob |
| 26 | #define PRODUCT Hadron Keyboard | 26 | #define PRODUCT Hadron Keyboard |
| 27 | #define DESCRIPTION A cherry ML ortholinear keyboard | 27 | #define DESCRIPTION A low profile ortholinear keyboard |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | 30 | ||
| @@ -46,9 +46,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 46 | #define DEBOUNCING_DELAY 5 | 46 | #define DEBOUNCING_DELAY 5 |
| 47 | 47 | ||
| 48 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | 48 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ |
| 49 | #define LOCKING_SUPPORT_ENABLE | 49 | //#define LOCKING_SUPPORT_ENABLE |
| 50 | /* Locking resynchronize hack */ | 50 | /* Locking resynchronize hack */ |
| 51 | #define LOCKING_RESYNC_ENABLE | 51 | //#define LOCKING_RESYNC_ENABLE |
| 52 | 52 | ||
| 53 | /* key combination for command */ | 53 | /* key combination for command */ |
| 54 | #define IS_COMMAND() ( \ | 54 | #define IS_COMMAND() ( \ |
| @@ -70,7 +70,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 70 | //#define NO_ACTION_LAYER | 70 | //#define NO_ACTION_LAYER |
| 71 | //#define NO_ACTION_TAPPING | 71 | //#define NO_ACTION_TAPPING |
| 72 | //#define NO_ACTION_ONESHOT | 72 | //#define NO_ACTION_ONESHOT |
| 73 | #define NO_ACTION_MACRO | 73 | //#define NO_ACTION_MACRO |
| 74 | #define NO_ACTION_FUNCTION | 74 | //#define NO_ACTION_FUNCTION |
| 75 | 75 | ||
| 76 | 76 | ||
diff --git a/keyboards/hadron/hadron.c b/keyboards/hadron/hadron.c index ca5b20e89..fa5065b32 100644 --- a/keyboards/hadron/hadron.c +++ b/keyboards/hadron/hadron.c | |||
| @@ -1,26 +1,2 @@ | |||
| 1 | #include "hadron.h" | 1 | #include "hadron.h" |
| 2 | 2 | ||
| 3 | |||
| 4 | void matrix_init_kb(void) { | ||
| 5 | |||
| 6 | matrix_init_user(); | ||
| 7 | } | ||
| 8 | |||
| 9 | void matrix_scan_kb(void) { | ||
| 10 | // put your looping keyboard code here | ||
| 11 | // runs every cycle (a lot) | ||
| 12 | matrix_scan_user(); | ||
| 13 | } | ||
| 14 | |||
| 15 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 16 | // put your per-action keyboard code here | ||
| 17 | // runs for every action, just before processing by the firmware | ||
| 18 | |||
| 19 | return process_record_user(keycode, record); | ||
| 20 | } | ||
| 21 | |||
| 22 | void led_set_kb(uint8_t usb_led) { | ||
| 23 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 24 | |||
| 25 | led_set_user(usb_led); | ||
| 26 | } \ No newline at end of file | ||
diff --git a/keyboards/hadron/hadron.h b/keyboards/hadron/hadron.h index a165f4c5c..426face6f 100644 --- a/keyboards/hadron/hadron.h +++ b/keyboards/hadron/hadron.h | |||
| @@ -7,7 +7,9 @@ | |||
| 7 | #ifdef SUBPROJECT_ver2 | 7 | #ifdef SUBPROJECT_ver2 |
| 8 | #include "ver2.h" | 8 | #include "ver2.h" |
| 9 | #endif | 9 | #endif |
| 10 | 10 | #ifdef SUBPROJECT_ver3 | |
| 11 | #include "ver3.h" | ||
| 12 | #endif | ||
| 11 | #include "quantum.h" | 13 | #include "quantum.h" |
| 12 | 14 | ||
| 13 | 15 | ||
diff --git a/keyboards/hadron/keymaps/default/config.h b/keyboards/hadron/keymaps/default/config.h deleted file mode 100644 index 09922b61b..000000000 --- a/keyboards/hadron/keymaps/default/config.h +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | #define LEADER_TIMEOUT 300 | ||
| 7 | //#define BACKLIGHT_BREATHING | ||
| 8 | |||
| 9 | #define USE_I2C | ||
| 10 | #define SSD1306OLED | ||
| 11 | #define OLED_ROTATE180 | ||
| 12 | |||
| 13 | /* ws2812 RGB LED*/ | ||
| 14 | #define RGB_DI_PIN D4 | ||
| 15 | #define RGBLIGHT_ANIMATIONS | ||
| 16 | #define RGBLED_NUM 14 // Number of LEDs | ||
| 17 | #define RGBLIGHT_HUE_STEP 10 | ||
| 18 | #define RGBLIGHT_SAT_STEP 17 | ||
| 19 | |||
| 20 | #endif | ||
diff --git a/keyboards/hadron/keymaps/default/rules.mk b/keyboards/hadron/keymaps/default/rules.mk deleted file mode 100644 index 4c6d04f1e..000000000 --- a/keyboards/hadron/keymaps/default/rules.mk +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | |||
| 2 | |||
| 3 | # Build Options | ||
| 4 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 5 | # the appropriate keymap folder that will get included automatically | ||
| 6 | # | ||
| 7 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 8 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
| 9 | EXTRAKEY_ENABLE = no # Audio control and System control(+450) | ||
| 10 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 11 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 12 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 13 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 14 | MIDI_ENABLE = no # MIDI controls | ||
| 15 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 16 | UNICODE_ENABLE = no # Unicode | ||
| 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 18 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. | ||
| 19 | SWAP_HANDS_ENABLE = no # Enable one-hand typing | ||
| 20 | |||
| 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 23 | |||
| 24 | EXTRAFLAGS += -flto | ||
diff --git a/keyboards/hadron/keymaps/side_numpad/config.h b/keyboards/hadron/keymaps/side_numpad/config.h deleted file mode 100644 index 09922b61b..000000000 --- a/keyboards/hadron/keymaps/side_numpad/config.h +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | #define LEADER_TIMEOUT 300 | ||
| 7 | //#define BACKLIGHT_BREATHING | ||
| 8 | |||
| 9 | #define USE_I2C | ||
| 10 | #define SSD1306OLED | ||
| 11 | #define OLED_ROTATE180 | ||
| 12 | |||
| 13 | /* ws2812 RGB LED*/ | ||
| 14 | #define RGB_DI_PIN D4 | ||
| 15 | #define RGBLIGHT_ANIMATIONS | ||
| 16 | #define RGBLED_NUM 14 // Number of LEDs | ||
| 17 | #define RGBLIGHT_HUE_STEP 10 | ||
| 18 | #define RGBLIGHT_SAT_STEP 17 | ||
| 19 | |||
| 20 | #endif | ||
diff --git a/keyboards/hadron/readme.md b/keyboards/hadron/readme.md index ebebab9e6..13ef6c66a 100644 --- a/keyboards/hadron/readme.md +++ b/keyboards/hadron/readme.md | |||
| @@ -2,10 +2,10 @@ | |||
| 2 | 2 | ||
| 3 |  | 3 |  |
| 4 | 4 | ||
| 5 | A low-profile Cherry ML ortholinear build. | 5 | A low-profile ortholinear build. |
| 6 | 6 | ||
| 7 | Keyboard Maintainer: [ishtob](https://github.com/ishtob), [QMK](https://github.com/qmk) | 7 | Keyboard Maintainer: [ishtob](https://github.com/ishtob), [QMK](https://github.com/qmk) |
| 8 | Hardware Supported: Hadron PCB rev0, rev2 | 8 | Hardware Supported: Hadron PCB rev0, rev2, rev3 |
| 9 | 9 | ||
| 10 | Make example for this keyboard (after setting up your build environment): | 10 | Make example for this keyboard (after setting up your build environment): |
| 11 | 11 | ||
diff --git a/keyboards/hadron/rules.mk b/keyboards/hadron/rules.mk index 2a8b78045..bd1633f61 100644 --- a/keyboards/hadron/rules.mk +++ b/keyboards/hadron/rules.mk | |||
| @@ -1,75 +1,2 @@ | |||
| 1 | # MCU name | ||
| 2 | #MCU = at90usb1287 | ||
| 3 | MCU = atmega32u4 | ||
| 4 | |||
| 5 | # Processor frequency. | ||
| 6 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 7 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 8 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 9 | # automatically to create a 32-bit value in your source code. | ||
| 10 | # | ||
| 11 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 12 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 13 | # does not *change* the processor frequency - it should merely be updated to | ||
| 14 | # reflect the processor speed set externally so that the code can use accurate | ||
| 15 | # software delays. | ||
| 16 | F_CPU = 16000000 | ||
| 17 | |||
| 18 | # | ||
| 19 | # LUFA specific | ||
| 20 | # | ||
| 21 | # Target architecture (see library "Board Types" documentation). | ||
| 22 | ARCH = AVR8 | ||
| 23 | |||
| 24 | # Input clock frequency. | ||
| 25 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 26 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 27 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 28 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 29 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 30 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 31 | # source code. | ||
| 32 | # | ||
| 33 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 34 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 35 | F_USB = $(F_CPU) | ||
| 36 | |||
| 37 | # Interrupt driven control endpoint task(+60) | ||
| 38 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 39 | |||
| 40 | |||
| 41 | # Boot Section Size in *bytes* | ||
| 42 | # Teensy halfKay 512 | ||
| 43 | # Teensy++ halfKay 1024 | ||
| 44 | # Atmel DFU loader 4096 | ||
| 45 | # LUFA bootloader 4096 | ||
| 46 | # USBaspLoader 2048 | ||
| 47 | BOOTLOADER = halfkay | ||
| 48 | |||
| 49 | # Build Options | ||
| 50 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 51 | # the appropriate keymap folder that will get included automatically | ||
| 52 | # | ||
| 53 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 54 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
| 55 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 56 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 57 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 58 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 59 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 60 | MIDI_ENABLE = no # MIDI controls | ||
| 61 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 62 | UNICODE_ENABLE = no # Unicode | ||
| 63 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 64 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. | ||
| 65 | API_SYSEX_ENABLE = yes | ||
| 66 | |||
| 67 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 68 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 69 | |||
| 70 | SRC = i2c.c \ | ||
| 71 | ssd1306.c | ||
| 72 | 1 | ||
| 73 | DEFAULT_FOLDER = hadron/ver2 | 2 | DEFAULT_FOLDER = hadron/ver2 |
| 74 | |||
| 75 | EXTRAFLAGS += -flto | ||
diff --git a/keyboards/hadron/ver2/config.h b/keyboards/hadron/ver2/config.h index 5ee3f931f..e051db209 100644 --- a/keyboards/hadron/ver2/config.h +++ b/keyboards/hadron/ver2/config.h | |||
| @@ -29,4 +29,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 29 | #define UNUSED_PINS | 29 | #define UNUSED_PINS |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | #define USE_I2C | ||
| 33 | #define SSD1306OLED | ||
| 34 | #define OLED_ROTATE180 | ||
| 35 | |||
| 36 | /* ws2812 RGB LED*/ | ||
| 37 | #define RGB_DI_PIN D4 | ||
| 38 | #define RGBLIGHT_ANIMATIONS | ||
| 39 | #define RGBLED_NUM 14 // Number of LEDs | ||
| 40 | #define RGBLIGHT_HUE_STEP 10 | ||
| 41 | #define RGBLIGHT_SAT_STEP 17 | ||
| 42 | |||
| 32 | 43 | ||
diff --git a/keyboards/hadron/ver2/keymaps/default/config.h b/keyboards/hadron/ver2/keymaps/default/config.h new file mode 100644 index 000000000..e1fdd6dd3 --- /dev/null +++ b/keyboards/hadron/ver2/keymaps/default/config.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ | ||
| 4 | SONG(COLEMAK_SOUND) \ | ||
| 5 | } | ||
| 6 | |||
| 7 | #define LEADER_TIMEOUT 300 | ||
| 8 | //#define BACKLIGHT_BREATHING | ||
| 9 | |||
diff --git a/keyboards/hadron/keymaps/default/keymap.c b/keyboards/hadron/ver2/keymaps/default/keymap.c index de5979c1d..cc79f5267 100644 --- a/keyboards/hadron/keymaps/default/keymap.c +++ b/keyboards/hadron/ver2/keymaps/default/keymap.c | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | #include QMK_KEYBOARD_H | 1 | #include QMK_KEYBOARD_H |
| 2 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 3 | #ifdef AUDIO_ENABLE | 2 | #ifdef AUDIO_ENABLE |
| 4 | #include "audio.h" | 3 | #include "audio.h" |
| 5 | #endif | 4 | #endif |
| @@ -215,29 +214,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 215 | 214 | ||
| 216 | }; | 215 | }; |
| 217 | 216 | ||
| 218 | |||
| 219 | #ifdef AUDIO_ENABLE | ||
| 220 | |||
| 221 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
| 222 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 223 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
| 224 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
| 225 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
| 226 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
| 227 | #endif | ||
| 228 | |||
| 229 | // define variables for reactive RGB | 217 | // define variables for reactive RGB |
| 230 | bool RGB_INIT = false; | 218 | bool RGB_INIT = false; |
| 231 | bool TOG_STATUS = false; | 219 | bool TOG_STATUS = false; |
| 232 | int RGB_current_mode; | 220 | int RGB_current_mode; |
| 233 | 221 | ||
| 234 | |||
| 235 | |||
| 236 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 237 | eeconfig_update_default_layer(default_layer); | ||
| 238 | default_layer_set(default_layer); | ||
| 239 | } | ||
| 240 | |||
| 241 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | 222 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { |
| 242 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | 223 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { |
| 243 | rgblight_mode(RGB_current_mode); | 224 | rgblight_mode(RGB_current_mode); |
| @@ -251,19 +232,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 251 | switch (keycode) { | 232 | switch (keycode) { |
| 252 | case QWERTY: | 233 | case QWERTY: |
| 253 | if (record->event.pressed) { | 234 | if (record->event.pressed) { |
| 254 | #ifdef AUDIO_ENABLE | 235 | set_single_persistent_default_layer(_QWERTY); |
| 255 | PLAY_SONG(tone_qwerty); | ||
| 256 | #endif | ||
| 257 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 258 | } | 236 | } |
| 259 | return false; | 237 | return false; |
| 260 | break; | 238 | break; |
| 261 | case COLEMAK: | 239 | case COLEMAK: |
| 262 | if (record->event.pressed) { | 240 | if (record->event.pressed) { |
| 263 | #ifdef AUDIO_ENABLE | 241 | set_single_persistent_default_layer(_COLEMAK); |
| 264 | PLAY_SONG(tone_colemak); | ||
| 265 | #endif | ||
| 266 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
| 267 | } | 242 | } |
| 268 | return false; | 243 | return false; |
| 269 | break; | 244 | break; |
| @@ -337,53 +312,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 337 | return true; | 312 | return true; |
| 338 | } | 313 | } |
| 339 | 314 | ||
| 340 | void matrix_init_user(void) { | ||
| 341 | #ifdef USE_I2C | ||
| 342 | i2c_master_init(); | ||
| 343 | #ifdef SSD1306OLED | ||
| 344 | // calls code for the SSD1306 OLED | ||
| 345 | _delay_ms(400); | ||
| 346 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | ||
| 347 | iota_gfx_init(); // turns on the display | ||
| 348 | #endif | ||
| 349 | #endif | ||
| 350 | #ifdef AUDIO_ENABLE | ||
| 351 | startup_user(); | ||
| 352 | #endif | ||
| 353 | } | ||
| 354 | |||
| 355 | void matrix_scan_user(void) { | ||
| 356 | #ifdef SSD1306OLED | ||
| 357 | iota_gfx_task(); // this is what updates the display continuously | ||
| 358 | #endif | ||
| 359 | } | ||
| 360 | 315 | ||
| 361 | #ifdef AUDIO_ENABLE | ||
| 362 | |||
| 363 | void startup_user() | ||
| 364 | { | ||
| 365 | _delay_ms(20); // gets rid of tick | ||
| 366 | PLAY_SONG(tone_startup); | ||
| 367 | } | ||
| 368 | |||
| 369 | void shutdown_user() | ||
| 370 | {cc | ||
| 371 | PLAY_SONG(tone_goodbye); | ||
| 372 | _delay_ms(150); | ||
| 373 | stop_all_notes(); | ||
| 374 | } | ||
| 375 | |||
| 376 | void music_on_user(void) | ||
| 377 | { | ||
| 378 | music_scale_user(); | ||
| 379 | } | ||
| 380 | |||
| 381 | void music_scale_user(void) | ||
| 382 | { | ||
| 383 | PLAY_SONG(music_scale); | ||
| 384 | } | ||
| 385 | |||
| 386 | #endif | ||
| 387 | 316 | ||
| 388 | /* | 317 | /* |
| 389 | * Macro definition | 318 | * Macro definition |
| @@ -404,6 +333,32 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |||
| 404 | return MACRO_NONE; | 333 | return MACRO_NONE; |
| 405 | } | 334 | } |
| 406 | 335 | ||
| 336 | |||
| 337 | //Functions for ver2 | ||
| 338 | #ifdef KEYBOARD_hadron_ver2 | ||
| 339 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 340 | void matrix_init_user(void) { | ||
| 341 | #ifdef USE_I2C | ||
| 342 | i2c_master_init(); | ||
| 343 | #ifdef SSD1306OLED | ||
| 344 | // calls code for the SSD1306 OLED | ||
| 345 | _delay_ms(400); | ||
| 346 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | ||
| 347 | iota_gfx_init(); // turns on the display | ||
| 348 | #endif | ||
| 349 | #endif | ||
| 350 | #ifdef AUDIO_ENABLE | ||
| 351 | startup_user(); | ||
| 352 | #endif | ||
| 353 | } | ||
| 354 | |||
| 355 | |||
| 356 | void matrix_scan_user(void) { | ||
| 357 | #ifdef SSD1306OLED | ||
| 358 | iota_gfx_task(); // this is what updates the display continuously | ||
| 359 | #endif | ||
| 360 | } | ||
| 361 | |||
| 407 | void matrix_update(struct CharacterMatrix *dest, | 362 | void matrix_update(struct CharacterMatrix *dest, |
| 408 | const struct CharacterMatrix *source) { | 363 | const struct CharacterMatrix *source) { |
| 409 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | 364 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { |
| @@ -411,7 +366,6 @@ void matrix_update(struct CharacterMatrix *dest, | |||
| 411 | dest->dirty = true; | 366 | dest->dirty = true; |
| 412 | } | 367 | } |
| 413 | } | 368 | } |
| 414 | |||
| 415 | //assign the right code to your layers for OLED display | 369 | //assign the right code to your layers for OLED display |
| 416 | #define L_BASE 0 | 370 | #define L_BASE 0 |
| 417 | #define L_LOWER 8 | 371 | #define L_LOWER 8 |
| @@ -491,3 +445,4 @@ void iota_gfx_task_user(void) { | |||
| 491 | matrix_update(&display, &matrix); | 445 | matrix_update(&display, &matrix); |
| 492 | } | 446 | } |
| 493 | 447 | ||
| 448 | #endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/keymaps/default/readme.md b/keyboards/hadron/ver2/keymaps/default/readme.md index de9680b49..de9680b49 100644 --- a/keyboards/hadron/keymaps/default/readme.md +++ b/keyboards/hadron/ver2/keymaps/default/readme.md | |||
diff --git a/keyboards/hadron/keymaps/readme.md b/keyboards/hadron/ver2/keymaps/readme.md index 54fb5f6d9..54fb5f6d9 100644 --- a/keyboards/hadron/keymaps/readme.md +++ b/keyboards/hadron/ver2/keymaps/readme.md | |||
diff --git a/keyboards/hadron/ver2/keymaps/side_numpad/config.h b/keyboards/hadron/ver2/keymaps/side_numpad/config.h new file mode 100644 index 000000000..409279a95 --- /dev/null +++ b/keyboards/hadron/ver2/keymaps/side_numpad/config.h | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND)\ | ||
| 4 | } | ||
| 5 | |||
| 6 | #define LEADER_TIMEOUT 300 | ||
| 7 | //#define BACKLIGHT_BREATHING | ||
| 8 | |||
diff --git a/keyboards/hadron/keymaps/side_numpad/keymap.c b/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c index fa42c79ea..248bb7ca6 100644 --- a/keyboards/hadron/keymaps/side_numpad/keymap.c +++ b/keyboards/hadron/ver2/keymaps/side_numpad/keymap.c | |||
| @@ -218,15 +218,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 218 | 218 | ||
| 219 | }; | 219 | }; |
| 220 | 220 | ||
| 221 | |||
| 222 | #ifdef AUDIO_ENABLE | ||
| 223 | |||
| 224 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
| 225 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 226 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
| 227 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
| 228 | #endif | ||
| 229 | |||
| 230 | // define variables for reactive RGB | 221 | // define variables for reactive RGB |
| 231 | bool RGB_INIT = false; | 222 | bool RGB_INIT = false; |
| 232 | bool TOG_STATUS = false; | 223 | bool TOG_STATUS = false; |
| @@ -234,12 +225,6 @@ bool NUMLAY_STATUS = false; | |||
| 234 | int RGB_current_mode; | 225 | int RGB_current_mode; |
| 235 | 226 | ||
| 236 | 227 | ||
| 237 | |||
| 238 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 239 | eeconfig_update_default_layer(default_layer); | ||
| 240 | default_layer_set(default_layer); | ||
| 241 | } | ||
| 242 | |||
| 243 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | 228 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { |
| 244 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | 229 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { |
| 245 | rgblight_mode(RGB_current_mode); | 230 | rgblight_mode(RGB_current_mode); |
| @@ -253,10 +238,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 253 | switch (keycode) { | 238 | switch (keycode) { |
| 254 | case QWERTY: | 239 | case QWERTY: |
| 255 | if (record->event.pressed) { | 240 | if (record->event.pressed) { |
| 256 | #ifdef AUDIO_ENABLE | 241 | set_single_persistent_default_layer(_QWERTY); |
| 257 | PLAY_SONG(tone_qwerty); | ||
| 258 | #endif | ||
| 259 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 260 | } | 242 | } |
| 261 | return false; | 243 | return false; |
| 262 | break; | 244 | break; |
diff --git a/keyboards/hadron/keymaps/side_numpad/readme.md b/keyboards/hadron/ver2/keymaps/side_numpad/readme.md index de9680b49..de9680b49 100644 --- a/keyboards/hadron/keymaps/side_numpad/readme.md +++ b/keyboards/hadron/ver2/keymaps/side_numpad/readme.md | |||
diff --git a/keyboards/hadron/keymaps/side_numpad/rules.mk b/keyboards/hadron/ver2/keymaps/side_numpad/rules.mk index 687c285bd..687c285bd 100644 --- a/keyboards/hadron/keymaps/side_numpad/rules.mk +++ b/keyboards/hadron/ver2/keymaps/side_numpad/rules.mk | |||
diff --git a/keyboards/hadron/ver2/rules.mk b/keyboards/hadron/ver2/rules.mk index 521493b3d..c47bdb1af 100644 --- a/keyboards/hadron/ver2/rules.mk +++ b/keyboards/hadron/ver2/rules.mk | |||
| @@ -1 +1,76 @@ | |||
| 1 | #AUDIO_ENABLE = yes # Audio output on port C6 | 1 | # MCU name |
| 2 | #MCU = at90usb1287 | ||
| 3 | MCU = atmega32u4 | ||
| 4 | |||
| 5 | # Processor frequency. | ||
| 6 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 7 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 8 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 9 | # automatically to create a 32-bit value in your source code. | ||
| 10 | # | ||
| 11 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 12 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 13 | # does not *change* the processor frequency - it should merely be updated to | ||
| 14 | # reflect the processor speed set externally so that the code can use accurate | ||
| 15 | # software delays. | ||
| 16 | F_CPU = 16000000 | ||
| 17 | |||
| 18 | # | ||
| 19 | # LUFA specific | ||
| 20 | # | ||
| 21 | # Target architecture (see library "Board Types" documentation). | ||
| 22 | ARCH = AVR8 | ||
| 23 | |||
| 24 | # Input clock frequency. | ||
| 25 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 26 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 27 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 28 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 29 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 30 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 31 | # source code. | ||
| 32 | # | ||
| 33 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 34 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 35 | F_USB = $(F_CPU) | ||
| 36 | |||
| 37 | # Interrupt driven control endpoint task(+60) | ||
| 38 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 39 | |||
| 40 | |||
| 41 | # Boot Section Size in *bytes* | ||
| 42 | # Teensy halfKay 512 | ||
| 43 | # Teensy++ halfKay 1024 | ||
| 44 | # Atmel DFU loader 4096 | ||
| 45 | # LUFA bootloader 4096 | ||
| 46 | # USBaspLoader 2048 | ||
| 47 | BOOTLOADER = halfkay | ||
| 48 | |||
| 49 | # Build Options | ||
| 50 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 51 | # the appropriate keymap folder that will get included automatically | ||
| 52 | # | ||
| 53 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 54 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
| 55 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 56 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 57 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 58 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 59 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 60 | MIDI_ENABLE = no # MIDI controls | ||
| 61 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 62 | UNICODE_ENABLE = no # Unicode | ||
| 63 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 64 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. | ||
| 65 | API_SYSEX_ENABLE = yes | ||
| 66 | SWAP_HANDS_ENABLE = no # Enable one-hand typing | ||
| 67 | |||
| 68 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 69 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 70 | |||
| 71 | |||
| 72 | EXTRAFLAGS += -flto | ||
| 73 | |||
| 74 | |||
| 75 | SRC = i2c.c \ | ||
| 76 | ssd1306.c \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver2/ver2.c b/keyboards/hadron/ver2/ver2.c index bc0917746..739f06567 100644 --- a/keyboards/hadron/ver2/ver2.c +++ b/keyboards/hadron/ver2/ver2.c | |||
| @@ -1 +1,26 @@ | |||
| 1 | #include "ver2.h" \ No newline at end of file | 1 | #include "ver2.h" |
| 2 | |||
| 3 | |||
| 4 | void matrix_init_kb(void) { | ||
| 5 | |||
| 6 | matrix_init_user(); | ||
| 7 | } | ||
| 8 | |||
| 9 | void matrix_scan_kb(void) { | ||
| 10 | // put your looping keyboard code here | ||
| 11 | // runs every cycle (a lot) | ||
| 12 | matrix_scan_user(); | ||
| 13 | } | ||
| 14 | |||
| 15 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 16 | // put your per-action keyboard code here | ||
| 17 | // runs for every action, just before processing by the firmware | ||
| 18 | |||
| 19 | return process_record_user(keycode, record); | ||
| 20 | } | ||
| 21 | |||
| 22 | void led_set_kb(uint8_t usb_led) { | ||
| 23 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 24 | |||
| 25 | led_set_user(usb_led); | ||
| 26 | } \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.c b/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.c new file mode 100644 index 000000000..4331155df --- /dev/null +++ b/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.c | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | /* | ||
| 2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
| 3 | |||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | you may not use this file except in compliance with the License. | ||
| 6 | You may obtain a copy of the License at | ||
| 7 | |||
| 8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | |||
| 10 | Unless required by applicable law or agreed to in writing, software | ||
| 11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | See the License for the specific language governing permissions and | ||
| 14 | limitations under the License. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "hal.h" | ||
| 18 | |||
| 19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
| 20 | /** | ||
| 21 | * @brief PAL setup. | ||
| 22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
| 23 | * This variable is used by the HAL when initializing the PAL driver. | ||
| 24 | */ | ||
| 25 | const PALConfig pal_default_config = { | ||
| 26 | #if STM32_HAS_GPIOA | ||
| 27 | {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, | ||
| 28 | VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, | ||
| 29 | #endif | ||
| 30 | #if STM32_HAS_GPIOB | ||
| 31 | {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, | ||
| 32 | VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, | ||
| 33 | #endif | ||
| 34 | #if STM32_HAS_GPIOC | ||
| 35 | {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, | ||
| 36 | VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, | ||
| 37 | #endif | ||
| 38 | #if STM32_HAS_GPIOD | ||
| 39 | {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, | ||
| 40 | VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, | ||
| 41 | #endif | ||
| 42 | #if STM32_HAS_GPIOE | ||
| 43 | {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, | ||
| 44 | VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, | ||
| 45 | #endif | ||
| 46 | #if STM32_HAS_GPIOF | ||
| 47 | {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, | ||
| 48 | VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, | ||
| 49 | #endif | ||
| 50 | #if STM32_HAS_GPIOG | ||
| 51 | {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, | ||
| 52 | VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, | ||
| 53 | #endif | ||
| 54 | #if STM32_HAS_GPIOH | ||
| 55 | {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, | ||
| 56 | VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, | ||
| 57 | #endif | ||
| 58 | #if STM32_HAS_GPIOI | ||
| 59 | {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, | ||
| 60 | VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} | ||
| 61 | #endif | ||
| 62 | }; | ||
| 63 | #endif | ||
| 64 | |||
| 65 | void enter_bootloader_mode_if_requested(void); | ||
| 66 | |||
| 67 | /** | ||
| 68 | * @brief Early initialization code. | ||
| 69 | * @details This initialization must be performed just after stack setup | ||
| 70 | * and before any other initialization. | ||
| 71 | */ | ||
| 72 | void __early_init(void) { | ||
| 73 | enter_bootloader_mode_if_requested(); | ||
| 74 | stm32_clock_init(); | ||
| 75 | } | ||
| 76 | |||
| 77 | #if HAL_USE_SDC || defined(__DOXYGEN__) | ||
| 78 | /** | ||
| 79 | * @brief SDC card detection. | ||
| 80 | */ | ||
| 81 | bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { | ||
| 82 | |||
| 83 | (void)sdcp; | ||
| 84 | /* TODO: Fill the implementation.*/ | ||
| 85 | return true; | ||
| 86 | } | ||
| 87 | |||
| 88 | /** | ||
| 89 | * @brief SDC card write protection detection. | ||
| 90 | */ | ||
| 91 | bool sdc_lld_is_write_protected(SDCDriver *sdcp) { | ||
| 92 | |||
| 93 | (void)sdcp; | ||
| 94 | /* TODO: Fill the implementation.*/ | ||
| 95 | return false; | ||
| 96 | } | ||
| 97 | #endif /* HAL_USE_SDC */ | ||
| 98 | |||
| 99 | #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) | ||
| 100 | /** | ||
| 101 | * @brief MMC_SPI card detection. | ||
| 102 | */ | ||
| 103 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
| 104 | |||
| 105 | (void)mmcp; | ||
| 106 | /* TODO: Fill the implementation.*/ | ||
| 107 | return true; | ||
| 108 | } | ||
| 109 | |||
| 110 | /** | ||
| 111 | * @brief MMC_SPI card write protection detection. | ||
| 112 | */ | ||
| 113 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
| 114 | |||
| 115 | (void)mmcp; | ||
| 116 | /* TODO: Fill the implementation.*/ | ||
| 117 | return false; | ||
| 118 | } | ||
| 119 | #endif | ||
| 120 | |||
| 121 | /** | ||
| 122 | * @brief Board-specific initialization code. | ||
| 123 | * @todo Add your board-specific code, if any. | ||
| 124 | */ | ||
| 125 | void boardInit(void) { | ||
| 126 | } | ||
diff --git a/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.h b/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.h new file mode 100644 index 000000000..ec26557f3 --- /dev/null +++ b/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.h | |||
| @@ -0,0 +1,1187 @@ | |||
| 1 | /* | ||
| 2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
| 3 | |||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | you may not use this file except in compliance with the License. | ||
| 6 | You may obtain a copy of the License at | ||
| 7 | |||
| 8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | |||
| 10 | Unless required by applicable law or agreed to in writing, software | ||
| 11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | See the License for the specific language governing permissions and | ||
| 14 | limitations under the License. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef _BOARD_H_ | ||
| 18 | #define _BOARD_H_ | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Setup for Clueboard 60% Keyboard | ||
| 22 | */ | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Board identifier. | ||
| 26 | */ | ||
| 27 | #define BOARD_GENERIC_STM32_F303XC | ||
| 28 | #define BOARD_NAME "Planck PCB" | ||
| 29 | |||
| 30 | /* | ||
| 31 | * Board oscillators-related settings. | ||
| 32 | * NOTE: LSE not fitted. | ||
| 33 | */ | ||
| 34 | #if !defined(STM32_LSECLK) | ||
| 35 | #define STM32_LSECLK 0U | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #define STM32_LSEDRV (3U << 3U) | ||
| 39 | |||
| 40 | #if !defined(STM32_HSECLK) | ||
| 41 | #define STM32_HSECLK 8000000U | ||
| 42 | #endif | ||
| 43 | |||
| 44 | // #define STM32_HSE_BYPASS | ||
| 45 | |||
| 46 | /* | ||
| 47 | * MCU type as defined in the ST header. | ||
| 48 | */ | ||
| 49 | #define STM32F303xC | ||
| 50 | |||
| 51 | /* | ||
| 52 | * IO pins assignments. | ||
| 53 | */ | ||
| 54 | #define GPIOA_PIN0 0U | ||
| 55 | #define GPIOA_PIN1 1U | ||
| 56 | #define GPIOA_PIN2 2U | ||
| 57 | #define GPIOA_PIN3 3U | ||
| 58 | #define GPIOA_PIN4 4U | ||
| 59 | #define GPIOA_PIN5 5U | ||
| 60 | #define GPIOA_PIN6 6U | ||
| 61 | #define GPIOA_PIN7 7U | ||
| 62 | #define GPIOA_PIN8 8U | ||
| 63 | #define GPIOA_PIN9 9U | ||
| 64 | #define GPIOA_PIN10 10U | ||
| 65 | #define GPIOA_USB_DM 11U | ||
| 66 | #define GPIOA_USB_DP 12U | ||
| 67 | #define GPIOA_SWDIO 13U | ||
| 68 | #define GPIOA_SWCLK 14U | ||
| 69 | #define GPIOA_PIN15 15U | ||
| 70 | |||
| 71 | #define GPIOB_PIN0 0U | ||
| 72 | #define GPIOB_PIN1 1U | ||
| 73 | #define GPIOB_PIN2 2U | ||
| 74 | #define GPIOB_PIN3 3U | ||
| 75 | #define GPIOB_PIN4 4U | ||
| 76 | #define GPIOB_PIN5 5U | ||
| 77 | #define GPIOB_PIN6 6U | ||
| 78 | #define GPIOB_PIN7 7U | ||
| 79 | #define GPIOB_PIN8 8U | ||
| 80 | #define GPIOB_PIN9 9U | ||
| 81 | #define GPIOB_PIN10 10U | ||
| 82 | #define GPIOB_PIN11 11U | ||
| 83 | #define GPIOB_PIN12 12U | ||
| 84 | #define GPIOB_PIN13 13U | ||
| 85 | #define GPIOB_PIN14 14U | ||
| 86 | #define GPIOB_PIN15 15U | ||
| 87 | |||
| 88 | #define GPIOC_PIN0 0U | ||
| 89 | #define GPIOC_PIN1 1U | ||
| 90 | #define GPIOC_PIN2 2U | ||
| 91 | #define GPIOC_PIN3 3U | ||
| 92 | #define GPIOC_PIN4 4U | ||
| 93 | #define GPIOC_PIN5 5U | ||
| 94 | #define GPIOC_PIN6 6U | ||
| 95 | #define GPIOC_PIN7 7U | ||
| 96 | #define GPIOC_PIN8 8U | ||
| 97 | #define GPIOC_PIN9 9U | ||
| 98 | #define GPIOC_PIN10 10U | ||
| 99 | #define GPIOC_PIN11 11U | ||
| 100 | #define GPIOC_PIN12 12U | ||
| 101 | #define GPIOC_PIN13 13U | ||
| 102 | #define GPIOC_PIN14 14U | ||
| 103 | #define GPIOC_PIN15 15U | ||
| 104 | |||
| 105 | #define GPIOD_PIN0 0U | ||
| 106 | #define GPIOD_PIN1 1U | ||
| 107 | #define GPIOD_PIN2 2U | ||
| 108 | #define GPIOD_PIN3 3U | ||
| 109 | #define GPIOD_PIN4 4U | ||
| 110 | #define GPIOD_PIN5 5U | ||
| 111 | #define GPIOD_PIN6 6U | ||
| 112 | #define GPIOD_PIN7 7U | ||
| 113 | #define GPIOD_PIN8 8U | ||
| 114 | #define GPIOD_PIN9 9U | ||
| 115 | #define GPIOD_PIN10 10U | ||
| 116 | #define GPIOD_PIN11 11U | ||
| 117 | #define GPIOD_PIN12 12U | ||
| 118 | #define GPIOD_PIN13 13U | ||
| 119 | #define GPIOD_PIN14 14U | ||
| 120 | #define GPIOD_PIN15 15U | ||
| 121 | |||
| 122 | #define GPIOE_PIN0 0U | ||
| 123 | #define GPIOE_PIN1 1U | ||
| 124 | #define GPIOE_PIN2 2U | ||
| 125 | #define GPIOE_PIN3 3U | ||
| 126 | #define GPIOE_PIN4 4U | ||
| 127 | #define GPIOE_PIN5 5U | ||
| 128 | #define GPIOE_PIN6 6U | ||
| 129 | #define GPIOE_PIN7 7U | ||
| 130 | #define GPIOE_PIN8 8U | ||
| 131 | #define GPIOE_PIN9 9U | ||
| 132 | #define GPIOE_PIN10 10U | ||
| 133 | #define GPIOE_PIN11 11U | ||
| 134 | #define GPIOE_PIN12 12U | ||
| 135 | #define GPIOE_PIN13 13U | ||
| 136 | #define GPIOE_PIN14 14U | ||
| 137 | #define GPIOE_PIN15 15U | ||
| 138 | |||
| 139 | #define GPIOF_I2C2_SDA 0U | ||
| 140 | #define GPIOF_I2C2_SCL 1U | ||
| 141 | #define GPIOF_PIN2 2U | ||
| 142 | #define GPIOF_PIN3 3U | ||
| 143 | #define GPIOF_PIN4 4U | ||
| 144 | #define GPIOF_PIN5 5U | ||
| 145 | #define GPIOF_PIN6 6U | ||
| 146 | #define GPIOF_PIN7 7U | ||
| 147 | #define GPIOF_PIN8 8U | ||
| 148 | #define GPIOF_PIN9 9U | ||
| 149 | #define GPIOF_PIN10 10U | ||
| 150 | #define GPIOF_PIN11 11U | ||
| 151 | #define GPIOF_PIN12 12U | ||
| 152 | #define GPIOF_PIN13 13U | ||
| 153 | #define GPIOF_PIN14 14U | ||
| 154 | #define GPIOF_PIN15 15U | ||
| 155 | |||
| 156 | #define GPIOG_PIN0 0U | ||
| 157 | #define GPIOG_PIN1 1U | ||
| 158 | #define GPIOG_PIN2 2U | ||
| 159 | #define GPIOG_PIN3 3U | ||
| 160 | #define GPIOG_PIN4 4U | ||
| 161 | #define GPIOG_PIN5 5U | ||
| 162 | #define GPIOG_PIN6 6U | ||
| 163 | #define GPIOG_PIN7 7U | ||
| 164 | #define GPIOG_PIN8 8U | ||
| 165 | #define GPIOG_PIN9 9U | ||
| 166 | #define GPIOG_PIN10 10U | ||
| 167 | #define GPIOG_PIN11 11U | ||
| 168 | #define GPIOG_PIN12 12U | ||
| 169 | #define GPIOG_PIN13 13U | ||
| 170 | #define GPIOG_PIN14 14U | ||
| 171 | #define GPIOG_PIN15 15U | ||
| 172 | |||
| 173 | #define GPIOH_PIN0 0U | ||
| 174 | #define GPIOH_PIN1 1U | ||
| 175 | #define GPIOH_PIN2 2U | ||
| 176 | #define GPIOH_PIN3 3U | ||
| 177 | #define GPIOH_PIN4 4U | ||
| 178 | #define GPIOH_PIN5 5U | ||
| 179 | #define GPIOH_PIN6 6U | ||
| 180 | #define GPIOH_PIN7 7U | ||
| 181 | #define GPIOH_PIN8 8U | ||
| 182 | #define GPIOH_PIN9 9U | ||
| 183 | #define GPIOH_PIN10 10U | ||
| 184 | #define GPIOH_PIN11 11U | ||
| 185 | #define GPIOH_PIN12 12U | ||
| 186 | #define GPIOH_PIN13 13U | ||
| 187 | #define GPIOH_PIN14 14U | ||
| 188 | #define GPIOH_PIN15 15U | ||
| 189 | |||
| 190 | /* | ||
| 191 | * IO lines assignments. | ||
| 192 | */ | ||
| 193 | #define LINE_L3GD20_SDI PAL_LINE(GPIOA, 7U) | ||
| 194 | #define LINE_USB_DM PAL_LINE(GPIOA, 11U) | ||
| 195 | #define LINE_USB_DP PAL_LINE(GPIOA, 12U) | ||
| 196 | #define LINE_SWDIO PAL_LINE(GPIOA, 13U) | ||
| 197 | #define LINE_SWCLK PAL_LINE(GPIOA, 14U) | ||
| 198 | |||
| 199 | #define LINE_PIN6 PAL_LINE(GPIOF, 0U) | ||
| 200 | #define LINE_PIN7 PAL_LINE(GPIOF, 1U) | ||
| 201 | |||
| 202 | #define LINE_CAPS_LOCK PAL_LINE(GPIOB, 7U) | ||
| 203 | |||
| 204 | |||
| 205 | /* | ||
| 206 | * I/O ports initial setup, this configuration is established soon after reset | ||
| 207 | * in the initialization code. | ||
| 208 | * Please refer to the STM32 Reference Manual for details. | ||
| 209 | */ | ||
| 210 | #define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) | ||
| 211 | #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) | ||
| 212 | #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) | ||
| 213 | #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) | ||
| 214 | #define PIN_ODR_LOW(n) (0U << (n)) | ||
| 215 | #define PIN_ODR_HIGH(n) (1U << (n)) | ||
| 216 | #define PIN_OTYPE_PUSHPULL(n) (0U << (n)) | ||
| 217 | #define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) | ||
| 218 | #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) | ||
| 219 | #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) | ||
| 220 | #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) | ||
| 221 | #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) | ||
| 222 | #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) | ||
| 223 | #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) | ||
| 224 | #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) | ||
| 225 | #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) | ||
| 226 | |||
| 227 | /* | ||
| 228 | * GPIOA setup: | ||
| 229 | * | ||
| 230 | * PA0 - NC | ||
| 231 | * PA1 - NC | ||
| 232 | * PA2 - COL1 | ||
| 233 | * PA3 - COL2 | ||
| 234 | * PA4 - SPEAKER1 | ||
| 235 | * PA5 - SPEAKER2 | ||
| 236 | * PA6 - COL3 | ||
| 237 | * PA7 - COL8 | ||
| 238 | * PA8 - COL6 | ||
| 239 | * PA9 - COL7 | ||
| 240 | * PA10 - ROW5 | ||
| 241 | * PA11 - USB_DM (alternate 14). | ||
| 242 | * PA12 - USB_DP (alternate 14). | ||
| 243 | * PA13 - SWDIO (alternate 0). | ||
| 244 | * PA14 - SWCLK (alternate 0). | ||
| 245 | * PA15 - ROW4 | ||
| 246 | */ | ||
| 247 | #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \ | ||
| 248 | PIN_MODE_ALTERNATE(GPIOA_PIN1) | \ | ||
| 249 | PIN_MODE_INPUT(GPIOA_PIN2) | \ | ||
| 250 | PIN_MODE_INPUT(GPIOA_PIN3) | \ | ||
| 251 | PIN_MODE_INPUT(GPIOA_PIN4) | \ | ||
| 252 | PIN_MODE_INPUT(GPIOA_PIN5) | \ | ||
| 253 | PIN_MODE_INPUT(GPIOA_PIN6) | \ | ||
| 254 | PIN_MODE_INPUT(GPIOA_PIN7) | \ | ||
| 255 | PIN_MODE_INPUT(GPIOA_PIN8) | \ | ||
| 256 | PIN_MODE_INPUT(GPIOA_PIN9) | \ | ||
| 257 | PIN_MODE_INPUT(GPIOA_PIN10) | \ | ||
| 258 | PIN_MODE_ALTERNATE(GPIOA_USB_DM) | \ | ||
| 259 | PIN_MODE_ALTERNATE(GPIOA_USB_DP) | \ | ||
| 260 | PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \ | ||
| 261 | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \ | ||
| 262 | PIN_MODE_INPUT(GPIOA_PIN15)) | ||
| 263 | #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \ | ||
| 264 | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \ | ||
| 265 | PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \ | ||
| 266 | PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \ | ||
| 267 | PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \ | ||
| 268 | PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \ | ||
| 269 | PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \ | ||
| 270 | PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \ | ||
| 271 | PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \ | ||
| 272 | PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \ | ||
| 273 | PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \ | ||
| 274 | PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | \ | ||
| 275 | PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | \ | ||
| 276 | PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \ | ||
| 277 | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \ | ||
| 278 | PIN_OTYPE_PUSHPULL(GPIOA_PIN15)) | ||
| 279 | #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \ | ||
| 280 | PIN_OSPEED_HIGH(GPIOA_PIN1) | \ | ||
| 281 | PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \ | ||
| 282 | PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \ | ||
| 283 | PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \ | ||
| 284 | PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \ | ||
| 285 | PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \ | ||
| 286 | PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \ | ||
| 287 | PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \ | ||
| 288 | PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \ | ||
| 289 | PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \ | ||
| 290 | PIN_OSPEED_HIGH(GPIOA_USB_DM) | \ | ||
| 291 | PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | \ | ||
| 292 | PIN_OSPEED_HIGH(GPIOA_SWDIO) | \ | ||
| 293 | PIN_OSPEED_HIGH(GPIOA_SWCLK) | \ | ||
| 294 | PIN_OSPEED_VERYLOW(GPIOA_PIN15)) | ||
| 295 | #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) | \ | ||
| 296 | PIN_PUPDR_FLOATING(GPIOA_PIN1) | \ | ||
| 297 | PIN_PUPDR_PULLUP(GPIOA_PIN2) | \ | ||
| 298 | PIN_PUPDR_PULLUP(GPIOA_PIN3) | \ | ||
| 299 | PIN_PUPDR_PULLUP(GPIOA_PIN4) | \ | ||
| 300 | PIN_PUPDR_PULLUP(GPIOA_PIN5) | \ | ||
| 301 | PIN_PUPDR_PULLUP(GPIOA_PIN6) | \ | ||
| 302 | PIN_PUPDR_FLOATING(GPIOA_PIN7) | \ | ||
| 303 | PIN_PUPDR_PULLUP(GPIOA_PIN8) | \ | ||
| 304 | PIN_PUPDR_PULLUP(GPIOA_PIN9) | \ | ||
| 305 | PIN_PUPDR_PULLUP(GPIOA_PIN10) | \ | ||
| 306 | PIN_PUPDR_FLOATING(GPIOA_USB_DM) | \ | ||
| 307 | PIN_PUPDR_FLOATING(GPIOA_USB_DP) | \ | ||
| 308 | PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \ | ||
| 309 | PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \ | ||
| 310 | PIN_PUPDR_PULLUP(GPIOA_PIN15)) | ||
| 311 | #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \ | ||
| 312 | PIN_ODR_HIGH(GPIOA_PIN1) | \ | ||
| 313 | PIN_ODR_HIGH(GPIOA_PIN2) | \ | ||
| 314 | PIN_ODR_HIGH(GPIOA_PIN3) | \ | ||
| 315 | PIN_ODR_HIGH(GPIOA_PIN4) | \ | ||
| 316 | PIN_ODR_HIGH(GPIOA_PIN5) | \ | ||
| 317 | PIN_ODR_HIGH(GPIOA_PIN6) | \ | ||
| 318 | PIN_ODR_HIGH(GPIOA_PIN7) | \ | ||
| 319 | PIN_ODR_HIGH(GPIOA_PIN8) | \ | ||
| 320 | PIN_ODR_HIGH(GPIOA_PIN9) | \ | ||
| 321 | PIN_ODR_HIGH(GPIOA_PIN10) | \ | ||
| 322 | PIN_ODR_HIGH(GPIOA_USB_DM) | \ | ||
| 323 | PIN_ODR_HIGH(GPIOA_USB_DP) | \ | ||
| 324 | PIN_ODR_HIGH(GPIOA_SWDIO) | \ | ||
| 325 | PIN_ODR_HIGH(GPIOA_SWCLK) | \ | ||
| 326 | PIN_ODR_HIGH(GPIOA_PIN15)) | ||
| 327 | #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0) | \ | ||
| 328 | PIN_AFIO_AF(GPIOA_PIN1, 1) | \ | ||
| 329 | PIN_AFIO_AF(GPIOA_PIN2, 0) | \ | ||
| 330 | PIN_AFIO_AF(GPIOA_PIN3, 0) | \ | ||
| 331 | PIN_AFIO_AF(GPIOA_PIN4, 0) | \ | ||
| 332 | PIN_AFIO_AF(GPIOA_PIN5, 5) | \ | ||
| 333 | PIN_AFIO_AF(GPIOA_PIN6, 5) | \ | ||
| 334 | PIN_AFIO_AF(GPIOA_PIN7, 5)) | ||
| 335 | #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0) | \ | ||
| 336 | PIN_AFIO_AF(GPIOA_PIN9, 0) | \ | ||
| 337 | PIN_AFIO_AF(GPIOA_PIN10, 0) | \ | ||
| 338 | PIN_AFIO_AF(GPIOA_USB_DM, 14) | \ | ||
| 339 | PIN_AFIO_AF(GPIOA_USB_DP, 14) | \ | ||
| 340 | PIN_AFIO_AF(GPIOA_SWDIO, 0) | \ | ||
| 341 | PIN_AFIO_AF(GPIOA_SWCLK, 0) | \ | ||
| 342 | PIN_AFIO_AF(GPIOA_PIN15, 0)) | ||
| 343 | |||
| 344 | /* | ||
| 345 | * GPIOB setup: | ||
| 346 | * | ||
| 347 | * PB0 - PIN0 (input pullup). | ||
| 348 | * PB1 - PIN1 (input pullup). | ||
| 349 | * PB2 - PIN2 (input pullup). | ||
| 350 | * PB3 - PIN3 (alternate 0). | ||
| 351 | * PB4 - PIN4 (input pullup). | ||
| 352 | * PB5 - PIN5 (input pullup). | ||
| 353 | * PB6 - PIN6 LSM303DLHC_SCL (alternate 4). | ||
| 354 | * PB7 - PIN7 LSM303DLHC_SDA (alternate 4). | ||
| 355 | * PB8 - PIN8 (input pullup). | ||
| 356 | * PB9 - PIN9 (input pullup). | ||
| 357 | * PB10 - PIN10 (input pullup). | ||
| 358 | * PB11 - PIN11 (input pullup). | ||
| 359 | * PB12 - PIN12 (input pullup). | ||
| 360 | * PB13 - PIN13 (input pullup). | ||
| 361 | * PB14 - PIN14 (input pullup). | ||
| 362 | * PB15 - PIN15 (input pullup). | ||
| 363 | */ | ||
| 364 | #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \ | ||
| 365 | PIN_MODE_INPUT(GPIOB_PIN1) | \ | ||
| 366 | PIN_MODE_INPUT(GPIOB_PIN2) | \ | ||
| 367 | PIN_MODE_ALTERNATE(GPIOB_PIN3) | \ | ||
| 368 | PIN_MODE_INPUT(GPIOB_PIN4) | \ | ||
| 369 | PIN_MODE_INPUT(GPIOB_PIN5) | \ | ||
| 370 | PIN_MODE_ALTERNATE(GPIOB_PIN6) | \ | ||
| 371 | PIN_MODE_OUTPUT(GPIOB_PIN7) | \ | ||
| 372 | PIN_MODE_INPUT(GPIOB_PIN8) | \ | ||
| 373 | PIN_MODE_INPUT(GPIOB_PIN9) | \ | ||
| 374 | PIN_MODE_INPUT(GPIOB_PIN10) | \ | ||
| 375 | PIN_MODE_INPUT(GPIOB_PIN11) | \ | ||
| 376 | PIN_MODE_INPUT(GPIOB_PIN12) | \ | ||
| 377 | PIN_MODE_INPUT(GPIOB_PIN13) | \ | ||
| 378 | PIN_MODE_INPUT(GPIOB_PIN14) | \ | ||
| 379 | PIN_MODE_INPUT(GPIOB_PIN15)) | ||
| 380 | #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \ | ||
| 381 | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \ | ||
| 382 | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \ | ||
| 383 | PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | \ | ||
| 384 | PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \ | ||
| 385 | PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \ | ||
| 386 | PIN_OTYPE_OPENDRAIN(GPIOB_PIN6) | \ | ||
| 387 | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \ | ||
| 388 | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \ | ||
| 389 | PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \ | ||
| 390 | PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \ | ||
| 391 | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \ | ||
| 392 | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \ | ||
| 393 | PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \ | ||
| 394 | PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \ | ||
| 395 | PIN_OTYPE_PUSHPULL(GPIOB_PIN15)) | ||
| 396 | #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \ | ||
| 397 | PIN_OSPEED_VERYLOW(GPIOB_PIN1) | \ | ||
| 398 | PIN_OSPEED_VERYLOW(GPIOB_PIN2) | \ | ||
| 399 | PIN_OSPEED_HIGH(GPIOB_PIN3) | \ | ||
| 400 | PIN_OSPEED_VERYLOW(GPIOB_PIN4) | \ | ||
| 401 | PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \ | ||
| 402 | PIN_OSPEED_HIGH(GPIOB_PIN6) | \ | ||
| 403 | PIN_OSPEED_VERYLOW(GPIOB_PIN7) | \ | ||
| 404 | PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \ | ||
| 405 | PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \ | ||
| 406 | PIN_OSPEED_VERYLOW(GPIOB_PIN10) | \ | ||
| 407 | PIN_OSPEED_VERYLOW(GPIOB_PIN11) | \ | ||
| 408 | PIN_OSPEED_VERYLOW(GPIOB_PIN12) | \ | ||
| 409 | PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \ | ||
| 410 | PIN_OSPEED_VERYLOW(GPIOB_PIN14) | \ | ||
| 411 | PIN_OSPEED_VERYLOW(GPIOB_PIN15)) | ||
| 412 | #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \ | ||
| 413 | PIN_PUPDR_PULLUP(GPIOB_PIN1) | \ | ||
| 414 | PIN_PUPDR_PULLUP(GPIOB_PIN2) | \ | ||
| 415 | PIN_PUPDR_FLOATING(GPIOB_PIN3) | \ | ||
| 416 | PIN_PUPDR_PULLUP(GPIOB_PIN4) | \ | ||
| 417 | PIN_PUPDR_PULLUP(GPIOB_PIN5) | \ | ||
| 418 | PIN_PUPDR_FLOATING(GPIOB_PIN6) | \ | ||
| 419 | PIN_PUPDR_PULLDOWN(GPIOB_PIN7) | \ | ||
| 420 | PIN_PUPDR_PULLUP(GPIOB_PIN8) | \ | ||
| 421 | PIN_PUPDR_PULLUP(GPIOB_PIN9) | \ | ||
| 422 | PIN_PUPDR_PULLUP(GPIOB_PIN10) | \ | ||
| 423 | PIN_PUPDR_PULLUP(GPIOB_PIN11) | \ | ||
| 424 | PIN_PUPDR_PULLUP(GPIOB_PIN12) | \ | ||
| 425 | PIN_PUPDR_PULLUP(GPIOB_PIN13) | \ | ||
| 426 | PIN_PUPDR_PULLUP(GPIOB_PIN14) | \ | ||
| 427 | PIN_PUPDR_PULLUP(GPIOB_PIN15)) | ||
| 428 | #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \ | ||
| 429 | PIN_ODR_HIGH(GPIOB_PIN1) | \ | ||
| 430 | PIN_ODR_HIGH(GPIOB_PIN2) | \ | ||
| 431 | PIN_ODR_HIGH(GPIOB_PIN3) | \ | ||
| 432 | PIN_ODR_HIGH(GPIOB_PIN4) | \ | ||
| 433 | PIN_ODR_HIGH(GPIOB_PIN5) | \ | ||
| 434 | PIN_ODR_HIGH(GPIOB_PIN6) | \ | ||
| 435 | PIN_ODR_LOW(GPIOB_PIN7) | \ | ||
| 436 | PIN_ODR_HIGH(GPIOB_PIN8) | \ | ||
| 437 | PIN_ODR_HIGH(GPIOB_PIN9) | \ | ||
| 438 | PIN_ODR_HIGH(GPIOB_PIN10) | \ | ||
| 439 | PIN_ODR_HIGH(GPIOB_PIN11) | \ | ||
| 440 | PIN_ODR_HIGH(GPIOB_PIN12) | \ | ||
| 441 | PIN_ODR_HIGH(GPIOB_PIN13) | \ | ||
| 442 | PIN_ODR_HIGH(GPIOB_PIN14) | \ | ||
| 443 | PIN_ODR_HIGH(GPIOB_PIN15)) | ||
| 444 | #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0) | \ | ||
| 445 | PIN_AFIO_AF(GPIOB_PIN1, 0) | \ | ||
| 446 | PIN_AFIO_AF(GPIOB_PIN2, 0) | \ | ||
| 447 | PIN_AFIO_AF(GPIOB_PIN3, 0) | \ | ||
| 448 | PIN_AFIO_AF(GPIOB_PIN4, 0) | \ | ||
| 449 | PIN_AFIO_AF(GPIOB_PIN5, 0) | \ | ||
| 450 | PIN_AFIO_AF(GPIOB_PIN6, 4) | \ | ||
| 451 | PIN_AFIO_AF(GPIOB_PIN7, 0)) | ||
| 452 | #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0) | \ | ||
| 453 | PIN_AFIO_AF(GPIOB_PIN9, 0) | \ | ||
| 454 | PIN_AFIO_AF(GPIOB_PIN10, 0) | \ | ||
| 455 | PIN_AFIO_AF(GPIOB_PIN11, 0) | \ | ||
| 456 | PIN_AFIO_AF(GPIOB_PIN12, 0) | \ | ||
| 457 | PIN_AFIO_AF(GPIOB_PIN13, 0) | \ | ||
| 458 | PIN_AFIO_AF(GPIOB_PIN14, 0) | \ | ||
| 459 | PIN_AFIO_AF(GPIOB_PIN15, 0)) | ||
| 460 | |||
| 461 | /* | ||
| 462 | * GPIOC setup: | ||
| 463 | * | ||
| 464 | * PC0 - PIN0 (input pullup). | ||
| 465 | * PC1 - PIN1 (input pullup). | ||
| 466 | * PC2 - PIN2 (input pullup). | ||
| 467 | * PC3 - PIN3 (input pullup). | ||
| 468 | * PC4 - PIN4 (input pullup). | ||
| 469 | * PC5 - PIN5 (input pullup). | ||
| 470 | * PC6 - PIN6 (input pullup). | ||
| 471 | * PC7 - PIN7 (input pullup). | ||
| 472 | * PC8 - PIN8 (input pullup). | ||
| 473 | * PC9 - PIN9 (input pullup). | ||
| 474 | * PC10 - PIN10 (input pullup). | ||
| 475 | * PC11 - PIN11 (input pullup). | ||
| 476 | * PC12 - PIN12 (input pullup). | ||
| 477 | * PC13 - PIN13 (input pullup). | ||
| 478 | * PC14 - PIN14 (input floating). | ||
| 479 | * PC15 - PIN15 (input floating). | ||
| 480 | */ | ||
| 481 | #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \ | ||
| 482 | PIN_MODE_INPUT(GPIOC_PIN1) | \ | ||
| 483 | PIN_MODE_INPUT(GPIOC_PIN2) | \ | ||
| 484 | PIN_MODE_INPUT(GPIOC_PIN3) | \ | ||
| 485 | PIN_MODE_INPUT(GPIOC_PIN4) | \ | ||
| 486 | PIN_MODE_INPUT(GPIOC_PIN5) | \ | ||
| 487 | PIN_MODE_INPUT(GPIOC_PIN6) | \ | ||
| 488 | PIN_MODE_INPUT(GPIOC_PIN7) | \ | ||
| 489 | PIN_MODE_INPUT(GPIOC_PIN8) | \ | ||
| 490 | PIN_MODE_INPUT(GPIOC_PIN9) | \ | ||
| 491 | PIN_MODE_INPUT(GPIOC_PIN10) | \ | ||
| 492 | PIN_MODE_INPUT(GPIOC_PIN11) | \ | ||
| 493 | PIN_MODE_INPUT(GPIOC_PIN12) | \ | ||
| 494 | PIN_MODE_INPUT(GPIOC_PIN13) | \ | ||
| 495 | PIN_MODE_INPUT(GPIOC_PIN14) | \ | ||
| 496 | PIN_MODE_INPUT(GPIOC_PIN15)) | ||
| 497 | #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \ | ||
| 498 | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \ | ||
| 499 | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \ | ||
| 500 | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \ | ||
| 501 | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \ | ||
| 502 | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \ | ||
| 503 | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \ | ||
| 504 | PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \ | ||
| 505 | PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \ | ||
| 506 | PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \ | ||
| 507 | PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \ | ||
| 508 | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \ | ||
| 509 | PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \ | ||
| 510 | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \ | ||
| 511 | PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \ | ||
| 512 | PIN_OTYPE_PUSHPULL(GPIOC_PIN15)) | ||
| 513 | #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | \ | ||
| 514 | PIN_OSPEED_VERYLOW(GPIOC_PIN1) | \ | ||
| 515 | PIN_OSPEED_VERYLOW(GPIOC_PIN2) | \ | ||
| 516 | PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \ | ||
| 517 | PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \ | ||
| 518 | PIN_OSPEED_VERYLOW(GPIOC_PIN5) | \ | ||
| 519 | PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \ | ||
| 520 | PIN_OSPEED_VERYLOW(GPIOC_PIN7) | \ | ||
| 521 | PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \ | ||
| 522 | PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \ | ||
| 523 | PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \ | ||
| 524 | PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \ | ||
| 525 | PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \ | ||
| 526 | PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \ | ||
| 527 | PIN_OSPEED_HIGH(GPIOC_PIN14) | \ | ||
| 528 | PIN_OSPEED_HIGH(GPIOC_PIN15)) | ||
| 529 | #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \ | ||
| 530 | PIN_PUPDR_PULLUP(GPIOC_PIN1) | \ | ||
| 531 | PIN_PUPDR_PULLUP(GPIOC_PIN2) | \ | ||
| 532 | PIN_PUPDR_PULLUP(GPIOC_PIN3) | \ | ||
| 533 | PIN_PUPDR_PULLUP(GPIOC_PIN4) | \ | ||
| 534 | PIN_PUPDR_PULLUP(GPIOC_PIN5) | \ | ||
| 535 | PIN_PUPDR_PULLUP(GPIOC_PIN6) | \ | ||
| 536 | PIN_PUPDR_PULLUP(GPIOC_PIN7) | \ | ||
| 537 | PIN_PUPDR_PULLUP(GPIOC_PIN8) | \ | ||
| 538 | PIN_PUPDR_PULLUP(GPIOC_PIN9) | \ | ||
| 539 | PIN_PUPDR_PULLUP(GPIOC_PIN10) | \ | ||
| 540 | PIN_PUPDR_PULLUP(GPIOC_PIN11) | \ | ||
| 541 | PIN_PUPDR_PULLUP(GPIOC_PIN12) | \ | ||
| 542 | PIN_PUPDR_PULLUP(GPIOC_PIN13) | \ | ||
| 543 | PIN_PUPDR_FLOATING(GPIOC_PIN14) | \ | ||
| 544 | PIN_PUPDR_FLOATING(GPIOC_PIN15)) | ||
| 545 | #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \ | ||
| 546 | PIN_ODR_HIGH(GPIOC_PIN1) | \ | ||
| 547 | PIN_ODR_HIGH(GPIOC_PIN2) | \ | ||
| 548 | PIN_ODR_HIGH(GPIOC_PIN3) | \ | ||
| 549 | PIN_ODR_HIGH(GPIOC_PIN4) | \ | ||
| 550 | PIN_ODR_HIGH(GPIOC_PIN5) | \ | ||
| 551 | PIN_ODR_HIGH(GPIOC_PIN6) | \ | ||
| 552 | PIN_ODR_HIGH(GPIOC_PIN7) | \ | ||
| 553 | PIN_ODR_HIGH(GPIOC_PIN8) | \ | ||
| 554 | PIN_ODR_HIGH(GPIOC_PIN9) | \ | ||
| 555 | PIN_ODR_HIGH(GPIOC_PIN10) | \ | ||
| 556 | PIN_ODR_HIGH(GPIOC_PIN11) | \ | ||
| 557 | PIN_ODR_HIGH(GPIOC_PIN12) | \ | ||
| 558 | PIN_ODR_HIGH(GPIOC_PIN13) | \ | ||
| 559 | PIN_ODR_HIGH(GPIOC_PIN14) | \ | ||
| 560 | PIN_ODR_HIGH(GPIOC_PIN15)) | ||
| 561 | #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0) | \ | ||
| 562 | PIN_AFIO_AF(GPIOC_PIN1, 0) | \ | ||
| 563 | PIN_AFIO_AF(GPIOC_PIN2, 0) | \ | ||
| 564 | PIN_AFIO_AF(GPIOC_PIN3, 0) | \ | ||
| 565 | PIN_AFIO_AF(GPIOC_PIN4, 0) | \ | ||
| 566 | PIN_AFIO_AF(GPIOC_PIN5, 0) | \ | ||
| 567 | PIN_AFIO_AF(GPIOC_PIN6, 0) | \ | ||
| 568 | PIN_AFIO_AF(GPIOC_PIN7, 0)) | ||
| 569 | #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0) | \ | ||
| 570 | PIN_AFIO_AF(GPIOC_PIN9, 0) | \ | ||
| 571 | PIN_AFIO_AF(GPIOC_PIN10, 0) | \ | ||
| 572 | PIN_AFIO_AF(GPIOC_PIN11, 0) | \ | ||
| 573 | PIN_AFIO_AF(GPIOC_PIN12, 0) | \ | ||
| 574 | PIN_AFIO_AF(GPIOC_PIN13, 0) | \ | ||
| 575 | PIN_AFIO_AF(GPIOC_PIN14, 0) | \ | ||
| 576 | PIN_AFIO_AF(GPIOC_PIN15, 0)) | ||
| 577 | |||
| 578 | /* | ||
| 579 | * GPIOD setup: | ||
| 580 | * | ||
| 581 | * PD0 - PIN0 (input pullup). | ||
| 582 | * PD1 - PIN1 (input pullup). | ||
| 583 | * PD2 - PIN2 (input pullup). | ||
| 584 | * PD3 - PIN3 (input pullup). | ||
| 585 | * PD4 - PIN4 (input pullup). | ||
| 586 | * PD5 - PIN5 (input pullup). | ||
| 587 | * PD6 - PIN6 (input pullup). | ||
| 588 | * PD7 - PIN7 (input pullup). | ||
| 589 | * PD8 - PIN8 (input pullup). | ||
| 590 | * PD9 - PIN9 (input pullup). | ||
| 591 | * PD11 - PIN10 (input pullup). | ||
| 592 | * PD11 - PIN11 (input pullup). | ||
| 593 | * PD12 - PIN12 (input pullup). | ||
| 594 | * PD13 - PIN13 (input pullup). | ||
| 595 | * PD14 - PIN14 (input pullup). | ||
| 596 | * PD15 - PIN15 (input pullup). | ||
| 597 | */ | ||
| 598 | #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \ | ||
| 599 | PIN_MODE_INPUT(GPIOD_PIN1) | \ | ||
| 600 | PIN_MODE_INPUT(GPIOD_PIN2) | \ | ||
| 601 | PIN_MODE_INPUT(GPIOD_PIN3) | \ | ||
| 602 | PIN_MODE_INPUT(GPIOD_PIN4) | \ | ||
| 603 | PIN_MODE_INPUT(GPIOD_PIN5) | \ | ||
| 604 | PIN_MODE_INPUT(GPIOD_PIN6) | \ | ||
| 605 | PIN_MODE_INPUT(GPIOD_PIN7) | \ | ||
| 606 | PIN_MODE_INPUT(GPIOD_PIN8) | \ | ||
| 607 | PIN_MODE_INPUT(GPIOD_PIN9) | \ | ||
| 608 | PIN_MODE_INPUT(GPIOD_PIN10) | \ | ||
| 609 | PIN_MODE_INPUT(GPIOD_PIN11) | \ | ||
| 610 | PIN_MODE_INPUT(GPIOD_PIN12) | \ | ||
| 611 | PIN_MODE_INPUT(GPIOD_PIN13) | \ | ||
| 612 | PIN_MODE_INPUT(GPIOD_PIN14) | \ | ||
| 613 | PIN_MODE_INPUT(GPIOD_PIN15)) | ||
| 614 | #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \ | ||
| 615 | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \ | ||
| 616 | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \ | ||
| 617 | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \ | ||
| 618 | PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \ | ||
| 619 | PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \ | ||
| 620 | PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \ | ||
| 621 | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \ | ||
| 622 | PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \ | ||
| 623 | PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \ | ||
| 624 | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \ | ||
| 625 | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \ | ||
| 626 | PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \ | ||
| 627 | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \ | ||
| 628 | PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \ | ||
| 629 | PIN_OTYPE_PUSHPULL(GPIOD_PIN15)) | ||
| 630 | #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \ | ||
| 631 | PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \ | ||
| 632 | PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \ | ||
| 633 | PIN_OSPEED_VERYLOW(GPIOD_PIN3) | \ | ||
| 634 | PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \ | ||
| 635 | PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \ | ||
| 636 | PIN_OSPEED_VERYLOW(GPIOD_PIN6) | \ | ||
| 637 | PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \ | ||
| 638 | PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \ | ||
| 639 | PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \ | ||
| 640 | PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \ | ||
| 641 | PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \ | ||
| 642 | PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \ | ||
| 643 | PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \ | ||
| 644 | PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \ | ||
| 645 | PIN_OSPEED_VERYLOW(GPIOD_PIN15)) | ||
| 646 | #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \ | ||
| 647 | PIN_PUPDR_PULLUP(GPIOD_PIN1) | \ | ||
| 648 | PIN_PUPDR_PULLUP(GPIOD_PIN2) | \ | ||
| 649 | PIN_PUPDR_PULLUP(GPIOD_PIN3) | \ | ||
| 650 | PIN_PUPDR_PULLUP(GPIOD_PIN4) | \ | ||
| 651 | PIN_PUPDR_PULLUP(GPIOD_PIN5) | \ | ||
| 652 | PIN_PUPDR_PULLUP(GPIOD_PIN6) | \ | ||
| 653 | PIN_PUPDR_PULLUP(GPIOD_PIN7) | \ | ||
| 654 | PIN_PUPDR_PULLUP(GPIOD_PIN8) | \ | ||
| 655 | PIN_PUPDR_PULLUP(GPIOD_PIN9) | \ | ||
| 656 | PIN_PUPDR_PULLUP(GPIOD_PIN10) | \ | ||
| 657 | PIN_PUPDR_PULLUP(GPIOD_PIN11) | \ | ||
| 658 | PIN_PUPDR_PULLUP(GPIOD_PIN12) | \ | ||
| 659 | PIN_PUPDR_PULLUP(GPIOD_PIN13) | \ | ||
| 660 | PIN_PUPDR_PULLUP(GPIOD_PIN14) | \ | ||
| 661 | PIN_PUPDR_PULLUP(GPIOD_PIN15)) | ||
| 662 | #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \ | ||
| 663 | PIN_ODR_HIGH(GPIOD_PIN1) | \ | ||
| 664 | PIN_ODR_HIGH(GPIOD_PIN2) | \ | ||
| 665 | PIN_ODR_HIGH(GPIOD_PIN3) | \ | ||
| 666 | PIN_ODR_HIGH(GPIOD_PIN4) | \ | ||
| 667 | PIN_ODR_HIGH(GPIOD_PIN5) | \ | ||
| 668 | PIN_ODR_HIGH(GPIOD_PIN6) | \ | ||
| 669 | PIN_ODR_HIGH(GPIOD_PIN7) | \ | ||
| 670 | PIN_ODR_HIGH(GPIOD_PIN8) | \ | ||
| 671 | PIN_ODR_HIGH(GPIOD_PIN9) | \ | ||
| 672 | PIN_ODR_HIGH(GPIOD_PIN10) | \ | ||
| 673 | PIN_ODR_HIGH(GPIOD_PIN11) | \ | ||
| 674 | PIN_ODR_HIGH(GPIOD_PIN12) | \ | ||
| 675 | PIN_ODR_HIGH(GPIOD_PIN13) | \ | ||
| 676 | PIN_ODR_HIGH(GPIOD_PIN14) | \ | ||
| 677 | PIN_ODR_HIGH(GPIOD_PIN15)) | ||
| 678 | #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0) | \ | ||
| 679 | PIN_AFIO_AF(GPIOD_PIN1, 0) | \ | ||
| 680 | PIN_AFIO_AF(GPIOD_PIN2, 0) | \ | ||
| 681 | PIN_AFIO_AF(GPIOD_PIN3, 0) | \ | ||
| 682 | PIN_AFIO_AF(GPIOD_PIN4, 0) | \ | ||
| 683 | PIN_AFIO_AF(GPIOD_PIN5, 0) | \ | ||
| 684 | PIN_AFIO_AF(GPIOD_PIN6, 0) | \ | ||
| 685 | PIN_AFIO_AF(GPIOD_PIN7, 0)) | ||
| 686 | #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0) | \ | ||
| 687 | PIN_AFIO_AF(GPIOD_PIN9, 0) | \ | ||
| 688 | PIN_AFIO_AF(GPIOD_PIN10, 0) | \ | ||
| 689 | PIN_AFIO_AF(GPIOD_PIN11, 0) | \ | ||
| 690 | PIN_AFIO_AF(GPIOD_PIN12, 0) | \ | ||
| 691 | PIN_AFIO_AF(GPIOD_PIN13, 0) | \ | ||
| 692 | PIN_AFIO_AF(GPIOD_PIN14, 0) | \ | ||
| 693 | PIN_AFIO_AF(GPIOD_PIN15, 0)) | ||
| 694 | |||
| 695 | /* | ||
| 696 | * GPIOE setup: | ||
| 697 | * | ||
| 698 | * PE0 - PIN0 (input pullup). | ||
| 699 | * PE1 - PIN1 (input pullup). | ||
| 700 | * PE2 - PIN2 (input pullup). | ||
| 701 | * PE3 - PIN3 L3GD20_CS (output pushpull maximum). | ||
| 702 | * PE4 - PIN4 (input pullup). | ||
| 703 | * PE5 - PIN5 (input pullup). | ||
| 704 | * PE6 - PIN6 (input pullup). | ||
| 705 | * PE7 - PIN7 (input pullup). | ||
| 706 | * PE8 - PIN8 (output pushpull maximum). | ||
| 707 | * PE9 - PIN9 (output pushpull maximum). | ||
| 708 | * PE10 - PIN10 (output pushpull maximum). | ||
| 709 | * PE11 - PIN11 (output pushpull maximum). | ||
| 710 | * PE12 - PIN12 (output pushpull maximum). | ||
| 711 | * PE13 - PIN13 (output pushpull maximum). | ||
| 712 | * PE14 - PIN14 (output pushpull maximum). | ||
| 713 | * PE15 - PIN15 (output pushpull maximum). | ||
| 714 | */ | ||
| 715 | #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \ | ||
| 716 | PIN_MODE_INPUT(GPIOE_PIN1) | \ | ||
| 717 | PIN_MODE_INPUT(GPIOE_PIN2) |\ | ||
| 718 | PIN_MODE_OUTPUT(GPIOE_PIN3) | \ | ||
| 719 | PIN_MODE_INPUT(GPIOE_PIN4) |\ | ||
| 720 | PIN_MODE_INPUT(GPIOE_PIN5) |\ | ||
| 721 | PIN_MODE_INPUT(GPIOE_PIN6) | \ | ||
| 722 | PIN_MODE_INPUT(GPIOE_PIN7) | \ | ||
| 723 | PIN_MODE_OUTPUT(GPIOE_PIN8) | \ | ||
| 724 | PIN_MODE_OUTPUT(GPIOE_PIN9) | \ | ||
| 725 | PIN_MODE_OUTPUT(GPIOE_PIN10) | \ | ||
| 726 | PIN_MODE_OUTPUT(GPIOE_PIN11) | \ | ||
| 727 | PIN_MODE_OUTPUT(GPIOE_PIN12) | \ | ||
| 728 | PIN_MODE_OUTPUT(GPIOE_PIN13) | \ | ||
| 729 | PIN_MODE_OUTPUT(GPIOE_PIN14) | \ | ||
| 730 | PIN_MODE_OUTPUT(GPIOE_PIN15)) | ||
| 731 | #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) |\ | ||
| 732 | PIN_OTYPE_PUSHPULL(GPIOE_PIN1) |\ | ||
| 733 | PIN_OTYPE_PUSHPULL(GPIOE_PIN2) |\ | ||
| 734 | PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \ | ||
| 735 | PIN_OTYPE_PUSHPULL(GPIOE_PIN4) |\ | ||
| 736 | PIN_OTYPE_PUSHPULL(GPIOE_PIN5) |\ | ||
| 737 | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \ | ||
| 738 | PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \ | ||
| 739 | PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \ | ||
| 740 | PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \ | ||
| 741 | PIN_OTYPE_PUSHPULL(GPIOE_PIN10) |\ | ||
| 742 | PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \ | ||
| 743 | PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \ | ||
| 744 | PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \ | ||
| 745 | PIN_OTYPE_PUSHPULL(GPIOE_PIN14) |\ | ||
| 746 | PIN_OTYPE_PUSHPULL(GPIOE_PIN15)) | ||
| 747 | #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) |\ | ||
| 748 | PIN_OSPEED_VERYLOW(GPIOE_PIN1) |\ | ||
| 749 | PIN_OSPEED_VERYLOW(GPIOE_PIN2) |\ | ||
| 750 | PIN_OSPEED_HIGH(GPIOE_PIN3) | \ | ||
| 751 | PIN_OSPEED_VERYLOW(GPIOE_PIN4) |\ | ||
| 752 | PIN_OSPEED_VERYLOW(GPIOE_PIN5) |\ | ||
| 753 | PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \ | ||
| 754 | PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \ | ||
| 755 | PIN_OSPEED_HIGH(GPIOE_PIN8) | \ | ||
| 756 | PIN_OSPEED_HIGH(GPIOE_PIN9) | \ | ||
| 757 | PIN_OSPEED_HIGH(GPIOE_PIN10) | \ | ||
| 758 | PIN_OSPEED_HIGH(GPIOE_PIN11) | \ | ||
| 759 | PIN_OSPEED_HIGH(GPIOE_PIN12) | \ | ||
| 760 | PIN_OSPEED_HIGH(GPIOE_PIN13) | \ | ||
| 761 | PIN_OSPEED_HIGH(GPIOE_PIN14) | \ | ||
| 762 | PIN_OSPEED_HIGH(GPIOE_PIN15)) | ||
| 763 | #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \ | ||
| 764 | PIN_PUPDR_PULLUP(GPIOE_PIN1) | \ | ||
| 765 | PIN_PUPDR_PULLUP(GPIOE_PIN2) |\ | ||
| 766 | PIN_PUPDR_FLOATING(GPIOE_PIN3) | \ | ||
| 767 | PIN_PUPDR_PULLUP(GPIOE_PIN4) |\ | ||
| 768 | PIN_PUPDR_PULLUP(GPIOE_PIN5) |\ | ||
| 769 | PIN_PUPDR_PULLUP(GPIOE_PIN6) | \ | ||
| 770 | PIN_PUPDR_PULLUP(GPIOE_PIN7) | \ | ||
| 771 | PIN_PUPDR_PULLUP(GPIOE_PIN8) | \ | ||
| 772 | PIN_PUPDR_PULLUP(GPIOE_PIN9) | \ | ||
| 773 | PIN_PUPDR_PULLUP(GPIOE_PIN10) | \ | ||
| 774 | PIN_PUPDR_FLOATING(GPIOE_PIN11) | \ | ||
| 775 | PIN_PUPDR_PULLUP(GPIOE_PIN12) | \ | ||
| 776 | PIN_PUPDR_FLOATING(GPIOE_PIN13) | \ | ||
| 777 | PIN_PUPDR_FLOATING(GPIOE_PIN14) |\ | ||
| 778 | PIN_PUPDR_FLOATING(GPIOE_PIN15)) | ||
| 779 | #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \ | ||
| 780 | PIN_ODR_HIGH(GPIOE_PIN1) | \ | ||
| 781 | PIN_ODR_HIGH(GPIOE_PIN2) | \ | ||
| 782 | PIN_ODR_HIGH(GPIOE_PIN3) | \ | ||
| 783 | PIN_ODR_HIGH(GPIOE_PIN4) | \ | ||
| 784 | PIN_ODR_HIGH(GPIOE_PIN5) | \ | ||
| 785 | PIN_ODR_HIGH(GPIOE_PIN6) | \ | ||
| 786 | PIN_ODR_HIGH(GPIOE_PIN7) | \ | ||
| 787 | PIN_ODR_LOW(GPIOE_PIN8) | \ | ||
| 788 | PIN_ODR_LOW(GPIOE_PIN9) | \ | ||
| 789 | PIN_ODR_LOW(GPIOE_PIN10) | \ | ||
| 790 | PIN_ODR_LOW(GPIOE_PIN11) | \ | ||
| 791 | PIN_ODR_LOW(GPIOE_PIN12) | \ | ||
| 792 | PIN_ODR_LOW(GPIOE_PIN13) | \ | ||
| 793 | PIN_ODR_LOW(GPIOE_PIN14) | \ | ||
| 794 | PIN_ODR_LOW(GPIOE_PIN15)) | ||
| 795 | #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0) | \ | ||
| 796 | PIN_AFIO_AF(GPIOE_PIN1, 0) | \ | ||
| 797 | PIN_AFIO_AF(GPIOE_PIN2, 0) |\ | ||
| 798 | PIN_AFIO_AF(GPIOE_PIN3, 0) | \ | ||
| 799 | PIN_AFIO_AF(GPIOE_PIN4, 0) |\ | ||
| 800 | PIN_AFIO_AF(GPIOE_PIN5, 0) |\ | ||
| 801 | PIN_AFIO_AF(GPIOE_PIN6, 0) | \ | ||
| 802 | PIN_AFIO_AF(GPIOE_PIN7, 0)) | ||
| 803 | #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0) | \ | ||
| 804 | PIN_AFIO_AF(GPIOE_PIN9, 0) | \ | ||
| 805 | PIN_AFIO_AF(GPIOE_PIN10, 0) | \ | ||
| 806 | PIN_AFIO_AF(GPIOE_PIN11, 0) | \ | ||
| 807 | PIN_AFIO_AF(GPIOE_PIN12, 0) | \ | ||
| 808 | PIN_AFIO_AF(GPIOE_PIN13, 0) | \ | ||
| 809 | PIN_AFIO_AF(GPIOE_PIN14, 0) | \ | ||
| 810 | PIN_AFIO_AF(GPIOE_PIN15, 0)) | ||
| 811 | |||
| 812 | /* | ||
| 813 | * GPIOF setup: | ||
| 814 | * | ||
| 815 | * PF0 - I2C2_SDA (input floating). | ||
| 816 | * PF1 - I2C2_SCL (input floating). | ||
| 817 | * PF2 - PIN2 (input pullup). | ||
| 818 | * PF3 - PIN3 (input pullup). | ||
| 819 | * PF4 - PIN4 (input pullup). | ||
| 820 | * PF5 - PIN5 (input pullup). | ||
| 821 | * PF6 - PIN6 (input pullup). | ||
| 822 | * PF7 - PIN7 (input pullup). | ||
| 823 | * PF8 - PIN8 (input pullup). | ||
| 824 | * PF9 - PIN9 (input pullup). | ||
| 825 | * PF10 - PIN10 (input pullup). | ||
| 826 | * PF11 - PIN11 (input pullup). | ||
| 827 | * PF12 - PIN12 (input pullup). | ||
| 828 | * PF13 - PIN13 (input pullup). | ||
| 829 | * PF14 - PIN14 (input pullup). | ||
| 830 | * PF15 - PIN15 (input pullup). | ||
| 831 | */ | ||
| 832 | #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_I2C2_SDA) | \ | ||
| 833 | PIN_MODE_INPUT(GPIOF_I2C2_SCL) | \ | ||
| 834 | PIN_MODE_INPUT(GPIOF_PIN2) | \ | ||
| 835 | PIN_MODE_INPUT(GPIOF_PIN3) | \ | ||
| 836 | PIN_MODE_INPUT(GPIOF_PIN4) | \ | ||
| 837 | PIN_MODE_INPUT(GPIOF_PIN5) | \ | ||
| 838 | PIN_MODE_INPUT(GPIOF_PIN6) | \ | ||
| 839 | PIN_MODE_INPUT(GPIOF_PIN7) | \ | ||
| 840 | PIN_MODE_INPUT(GPIOF_PIN8) | \ | ||
| 841 | PIN_MODE_INPUT(GPIOF_PIN9) | \ | ||
| 842 | PIN_MODE_INPUT(GPIOF_PIN10) | \ | ||
| 843 | PIN_MODE_INPUT(GPIOF_PIN11) | \ | ||
| 844 | PIN_MODE_INPUT(GPIOF_PIN12) | \ | ||
| 845 | PIN_MODE_INPUT(GPIOF_PIN13) | \ | ||
| 846 | PIN_MODE_INPUT(GPIOF_PIN14) | \ | ||
| 847 | PIN_MODE_INPUT(GPIOF_PIN15)) | ||
| 848 | #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SDA) | \ | ||
| 849 | PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SCL) | \ | ||
| 850 | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \ | ||
| 851 | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \ | ||
| 852 | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \ | ||
| 853 | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \ | ||
| 854 | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \ | ||
| 855 | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \ | ||
| 856 | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \ | ||
| 857 | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \ | ||
| 858 | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \ | ||
| 859 | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \ | ||
| 860 | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \ | ||
| 861 | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \ | ||
| 862 | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \ | ||
| 863 | PIN_OTYPE_PUSHPULL(GPIOF_PIN15)) | ||
| 864 | #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_I2C2_SDA) | \ | ||
| 865 | PIN_OSPEED_HIGH(GPIOF_I2C2_SCL) | \ | ||
| 866 | PIN_OSPEED_VERYLOW(GPIOF_PIN2) | \ | ||
| 867 | PIN_OSPEED_VERYLOW(GPIOF_PIN3) | \ | ||
| 868 | PIN_OSPEED_VERYLOW(GPIOF_PIN4) | \ | ||
| 869 | PIN_OSPEED_VERYLOW(GPIOF_PIN5) | \ | ||
| 870 | PIN_OSPEED_VERYLOW(GPIOF_PIN6) | \ | ||
| 871 | PIN_OSPEED_VERYLOW(GPIOF_PIN7) | \ | ||
| 872 | PIN_OSPEED_VERYLOW(GPIOF_PIN8) | \ | ||
| 873 | PIN_OSPEED_VERYLOW(GPIOF_PIN9) | \ | ||
| 874 | PIN_OSPEED_VERYLOW(GPIOF_PIN10) | \ | ||
| 875 | PIN_OSPEED_VERYLOW(GPIOF_PIN11) | \ | ||
| 876 | PIN_OSPEED_VERYLOW(GPIOF_PIN12) | \ | ||
| 877 | PIN_OSPEED_VERYLOW(GPIOF_PIN13) | \ | ||
| 878 | PIN_OSPEED_VERYLOW(GPIOF_PIN14) | \ | ||
| 879 | PIN_OSPEED_VERYLOW(GPIOF_PIN15)) | ||
| 880 | #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_I2C2_SDA) | \ | ||
| 881 | PIN_PUPDR_FLOATING(GPIOF_I2C2_SCL) | \ | ||
| 882 | PIN_PUPDR_PULLUP(GPIOF_PIN2) | \ | ||
| 883 | PIN_PUPDR_PULLUP(GPIOF_PIN3) | \ | ||
| 884 | PIN_PUPDR_PULLUP(GPIOF_PIN4) | \ | ||
| 885 | PIN_PUPDR_PULLUP(GPIOF_PIN5) | \ | ||
| 886 | PIN_PUPDR_PULLUP(GPIOF_PIN6) | \ | ||
| 887 | PIN_PUPDR_PULLUP(GPIOF_PIN7) | \ | ||
| 888 | PIN_PUPDR_PULLUP(GPIOF_PIN8) | \ | ||
| 889 | PIN_PUPDR_PULLUP(GPIOF_PIN9) | \ | ||
| 890 | PIN_PUPDR_PULLUP(GPIOF_PIN10) | \ | ||
| 891 | PIN_PUPDR_PULLUP(GPIOF_PIN11) | \ | ||
| 892 | PIN_PUPDR_PULLUP(GPIOF_PIN12) | \ | ||
| 893 | PIN_PUPDR_PULLUP(GPIOF_PIN13) | \ | ||
| 894 | PIN_PUPDR_PULLUP(GPIOF_PIN14) | \ | ||
| 895 | PIN_PUPDR_PULLUP(GPIOF_PIN15)) | ||
| 896 | #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_I2C2_SDA) | \ | ||
| 897 | PIN_ODR_HIGH(GPIOF_I2C2_SCL) | \ | ||
| 898 | PIN_ODR_HIGH(GPIOF_PIN2) | \ | ||
| 899 | PIN_ODR_HIGH(GPIOF_PIN3) | \ | ||
| 900 | PIN_ODR_HIGH(GPIOF_PIN4) | \ | ||
| 901 | PIN_ODR_HIGH(GPIOF_PIN5) | \ | ||
| 902 | PIN_ODR_HIGH(GPIOF_PIN6) | \ | ||
| 903 | PIN_ODR_HIGH(GPIOF_PIN7) | \ | ||
| 904 | PIN_ODR_HIGH(GPIOF_PIN8) | \ | ||
| 905 | PIN_ODR_HIGH(GPIOF_PIN9) | \ | ||
| 906 | PIN_ODR_HIGH(GPIOF_PIN10) | \ | ||
| 907 | PIN_ODR_HIGH(GPIOF_PIN11) | \ | ||
| 908 | PIN_ODR_HIGH(GPIOF_PIN12) | \ | ||
| 909 | PIN_ODR_HIGH(GPIOF_PIN13) | \ | ||
| 910 | PIN_ODR_HIGH(GPIOF_PIN14) | \ | ||
| 911 | PIN_ODR_HIGH(GPIOF_PIN15)) | ||
| 912 | #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_I2C2_SDA, 0) | \ | ||
| 913 | PIN_AFIO_AF(GPIOF_I2C2_SCL, 0) | \ | ||
| 914 | PIN_AFIO_AF(GPIOF_PIN2, 0) | \ | ||
| 915 | PIN_AFIO_AF(GPIOF_PIN3, 0) | \ | ||
| 916 | PIN_AFIO_AF(GPIOF_PIN4, 0) | \ | ||
| 917 | PIN_AFIO_AF(GPIOF_PIN5, 0) | \ | ||
| 918 | PIN_AFIO_AF(GPIOF_PIN6, 0) | \ | ||
| 919 | PIN_AFIO_AF(GPIOF_PIN7, 0)) | ||
| 920 | #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0) | \ | ||
| 921 | PIN_AFIO_AF(GPIOF_PIN9, 0) | \ | ||
| 922 | PIN_AFIO_AF(GPIOF_PIN10, 0) | \ | ||
| 923 | PIN_AFIO_AF(GPIOF_PIN11, 0) | \ | ||
| 924 | PIN_AFIO_AF(GPIOF_PIN12, 0) | \ | ||
| 925 | PIN_AFIO_AF(GPIOF_PIN13, 0) | \ | ||
| 926 | PIN_AFIO_AF(GPIOF_PIN14, 0) | \ | ||
| 927 | PIN_AFIO_AF(GPIOF_PIN15, 0)) | ||
| 928 | |||
| 929 | /* | ||
| 930 | * GPIOG setup: | ||
| 931 | * | ||
| 932 | * PG0 - PIN0 (input pullup). | ||
| 933 | * PG1 - PIN1 (input pullup). | ||
| 934 | * PG2 - PIN2 (input pullup). | ||
| 935 | * PG3 - PIN3 (input pullup). | ||
| 936 | * PG4 - PIN4 (input pullup). | ||
| 937 | * PG5 - PIN5 (input pullup). | ||
| 938 | * PG6 - PIN6 (input pullup). | ||
| 939 | * PG7 - PIN7 (input pullup). | ||
| 940 | * PG8 - PIN8 (input pullup). | ||
| 941 | * PG9 - PIN9 (input pullup). | ||
| 942 | * PG10 - PIN10 (input pullup). | ||
| 943 | * PG11 - PIN11 (input pullup). | ||
| 944 | * PG12 - PIN12 (input pullup). | ||
| 945 | * PG13 - PIN13 (input pullup). | ||
| 946 | * PG14 - PIN14 (input pullup). | ||
| 947 | * PG15 - PIN15 (input pullup). | ||
| 948 | */ | ||
| 949 | #define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \ | ||
| 950 | PIN_MODE_INPUT(GPIOG_PIN1) | \ | ||
| 951 | PIN_MODE_INPUT(GPIOG_PIN2) | \ | ||
| 952 | PIN_MODE_INPUT(GPIOG_PIN3) | \ | ||
| 953 | PIN_MODE_INPUT(GPIOG_PIN4) | \ | ||
| 954 | PIN_MODE_INPUT(GPIOG_PIN5) | \ | ||
| 955 | PIN_MODE_INPUT(GPIOG_PIN6) | \ | ||
| 956 | PIN_MODE_INPUT(GPIOG_PIN7) | \ | ||
| 957 | PIN_MODE_INPUT(GPIOG_PIN8) | \ | ||
| 958 | PIN_MODE_INPUT(GPIOG_PIN9) | \ | ||
| 959 | PIN_MODE_INPUT(GPIOG_PIN10) | \ | ||
| 960 | PIN_MODE_INPUT(GPIOG_PIN11) | \ | ||
| 961 | PIN_MODE_INPUT(GPIOG_PIN12) | \ | ||
| 962 | PIN_MODE_INPUT(GPIOG_PIN13) | \ | ||
| 963 | PIN_MODE_INPUT(GPIOG_PIN14) | \ | ||
| 964 | PIN_MODE_INPUT(GPIOG_PIN15)) | ||
| 965 | #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \ | ||
| 966 | PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \ | ||
| 967 | PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \ | ||
| 968 | PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \ | ||
| 969 | PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \ | ||
| 970 | PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \ | ||
| 971 | PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \ | ||
| 972 | PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \ | ||
| 973 | PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \ | ||
| 974 | PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \ | ||
| 975 | PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \ | ||
| 976 | PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \ | ||
| 977 | PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \ | ||
| 978 | PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \ | ||
| 979 | PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \ | ||
| 980 | PIN_OTYPE_PUSHPULL(GPIOG_PIN15)) | ||
| 981 | #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | \ | ||
| 982 | PIN_OSPEED_VERYLOW(GPIOG_PIN1) | \ | ||
| 983 | PIN_OSPEED_VERYLOW(GPIOG_PIN2) | \ | ||
| 984 | PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \ | ||
| 985 | PIN_OSPEED_VERYLOW(GPIOG_PIN4) | \ | ||
| 986 | PIN_OSPEED_VERYLOW(GPIOG_PIN5) | \ | ||
| 987 | PIN_OSPEED_VERYLOW(GPIOG_PIN6) | \ | ||
| 988 | PIN_OSPEED_VERYLOW(GPIOG_PIN7) | \ | ||
| 989 | PIN_OSPEED_VERYLOW(GPIOG_PIN8) | \ | ||
| 990 | PIN_OSPEED_VERYLOW(GPIOG_PIN9) | \ | ||
| 991 | PIN_OSPEED_VERYLOW(GPIOG_PIN10) | \ | ||
| 992 | PIN_OSPEED_VERYLOW(GPIOG_PIN11) | \ | ||
| 993 | PIN_OSPEED_VERYLOW(GPIOG_PIN12) | \ | ||
| 994 | PIN_OSPEED_VERYLOW(GPIOG_PIN13) | \ | ||
| 995 | PIN_OSPEED_VERYLOW(GPIOG_PIN14) | \ | ||
| 996 | PIN_OSPEED_VERYLOW(GPIOG_PIN15)) | ||
| 997 | #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | \ | ||
| 998 | PIN_PUPDR_PULLUP(GPIOG_PIN1) | \ | ||
| 999 | PIN_PUPDR_PULLUP(GPIOG_PIN2) | \ | ||
| 1000 | PIN_PUPDR_PULLUP(GPIOG_PIN3) | \ | ||
| 1001 | PIN_PUPDR_PULLUP(GPIOG_PIN4) | \ | ||
| 1002 | PIN_PUPDR_PULLUP(GPIOG_PIN5) | \ | ||
| 1003 | PIN_PUPDR_PULLUP(GPIOG_PIN6) | \ | ||
| 1004 | PIN_PUPDR_PULLUP(GPIOG_PIN7) | \ | ||
| 1005 | PIN_PUPDR_PULLUP(GPIOG_PIN8) | \ | ||
| 1006 | PIN_PUPDR_PULLUP(GPIOG_PIN9) | \ | ||
| 1007 | PIN_PUPDR_PULLUP(GPIOG_PIN10) | \ | ||
| 1008 | PIN_PUPDR_PULLUP(GPIOG_PIN11) | \ | ||
| 1009 | PIN_PUPDR_PULLUP(GPIOG_PIN12) | \ | ||
| 1010 | PIN_PUPDR_PULLUP(GPIOG_PIN13) | \ | ||
| 1011 | PIN_PUPDR_PULLUP(GPIOG_PIN14) | \ | ||
| 1012 | PIN_PUPDR_PULLUP(GPIOG_PIN15)) | ||
| 1013 | #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \ | ||
| 1014 | PIN_ODR_HIGH(GPIOG_PIN1) | \ | ||
| 1015 | PIN_ODR_HIGH(GPIOG_PIN2) | \ | ||
| 1016 | PIN_ODR_HIGH(GPIOG_PIN3) | \ | ||
| 1017 | PIN_ODR_HIGH(GPIOG_PIN4) | \ | ||
| 1018 | PIN_ODR_HIGH(GPIOG_PIN5) | \ | ||
| 1019 | PIN_ODR_HIGH(GPIOG_PIN6) | \ | ||
| 1020 | PIN_ODR_HIGH(GPIOG_PIN7) | \ | ||
| 1021 | PIN_ODR_HIGH(GPIOG_PIN8) | \ | ||
| 1022 | PIN_ODR_HIGH(GPIOG_PIN9) | \ | ||
| 1023 | PIN_ODR_HIGH(GPIOG_PIN10) | \ | ||
| 1024 | PIN_ODR_HIGH(GPIOG_PIN11) | \ | ||
| 1025 | PIN_ODR_HIGH(GPIOG_PIN12) | \ | ||
| 1026 | PIN_ODR_HIGH(GPIOG_PIN13) | \ | ||
| 1027 | PIN_ODR_HIGH(GPIOG_PIN14) | \ | ||
| 1028 | PIN_ODR_HIGH(GPIOG_PIN15)) | ||
| 1029 | #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0) | \ | ||
| 1030 | PIN_AFIO_AF(GPIOG_PIN1, 0) | \ | ||
| 1031 | PIN_AFIO_AF(GPIOG_PIN2, 0) | \ | ||
| 1032 | PIN_AFIO_AF(GPIOG_PIN3, 0) | \ | ||
| 1033 | PIN_AFIO_AF(GPIOG_PIN4, 0) | \ | ||
| 1034 | PIN_AFIO_AF(GPIOG_PIN5, 0) | \ | ||
| 1035 | PIN_AFIO_AF(GPIOG_PIN6, 0) | \ | ||
| 1036 | PIN_AFIO_AF(GPIOG_PIN7, 0)) | ||
| 1037 | #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0) | \ | ||
| 1038 | PIN_AFIO_AF(GPIOG_PIN9, 0) | \ | ||
| 1039 | PIN_AFIO_AF(GPIOG_PIN10, 0) | \ | ||
| 1040 | PIN_AFIO_AF(GPIOG_PIN11, 0) | \ | ||
| 1041 | PIN_AFIO_AF(GPIOG_PIN12, 0) | \ | ||
| 1042 | PIN_AFIO_AF(GPIOG_PIN13, 0) | \ | ||
| 1043 | PIN_AFIO_AF(GPIOG_PIN14, 0) | \ | ||
| 1044 | PIN_AFIO_AF(GPIOG_PIN15, 0)) | ||
| 1045 | |||
| 1046 | /* | ||
| 1047 | * GPIOH setup: | ||
| 1048 | * | ||
| 1049 | * PH0 - PIN0 (input pullup). | ||
| 1050 | * PH1 - PIN1 (input pullup). | ||
| 1051 | * PH2 - PIN2 (input pullup). | ||
| 1052 | * PH3 - PIN3 (input pullup). | ||
| 1053 | * PH4 - PIN4 (input pullup). | ||
| 1054 | * PH5 - PIN5 (input pullup). | ||
| 1055 | * PH6 - PIN6 (input pullup). | ||
| 1056 | * PH7 - PIN7 (input pullup). | ||
| 1057 | * PH8 - PIN8 (input pullup). | ||
| 1058 | * PH9 - PIN9 (input pullup). | ||
| 1059 | * PH10 - PIN10 (input pullup). | ||
| 1060 | * PH11 - PIN11 (input pullup). | ||
| 1061 | * PH12 - PIN12 (input pullup). | ||
| 1062 | * PH13 - PIN13 (input pullup). | ||
| 1063 | * PH14 - PIN14 (input pullup). | ||
| 1064 | * PH15 - PIN15 (input pullup). | ||
| 1065 | */ | ||
| 1066 | #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | \ | ||
| 1067 | PIN_MODE_INPUT(GPIOH_PIN1) | \ | ||
| 1068 | PIN_MODE_INPUT(GPIOH_PIN2) | \ | ||
| 1069 | PIN_MODE_INPUT(GPIOH_PIN3) | \ | ||
| 1070 | PIN_MODE_INPUT(GPIOH_PIN4) | \ | ||
| 1071 | PIN_MODE_INPUT(GPIOH_PIN5) | \ | ||
| 1072 | PIN_MODE_INPUT(GPIOH_PIN6) | \ | ||
| 1073 | PIN_MODE_INPUT(GPIOH_PIN7) | \ | ||
| 1074 | PIN_MODE_INPUT(GPIOH_PIN8) | \ | ||
| 1075 | PIN_MODE_INPUT(GPIOH_PIN9) | \ | ||
| 1076 | PIN_MODE_INPUT(GPIOH_PIN10) | \ | ||
| 1077 | PIN_MODE_INPUT(GPIOH_PIN11) | \ | ||
| 1078 | PIN_MODE_INPUT(GPIOH_PIN12) | \ | ||
| 1079 | PIN_MODE_INPUT(GPIOH_PIN13) | \ | ||
| 1080 | PIN_MODE_INPUT(GPIOH_PIN14) | \ | ||
| 1081 | PIN_MODE_INPUT(GPIOH_PIN15)) | ||
| 1082 | #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | \ | ||
| 1083 | PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | \ | ||
| 1084 | PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \ | ||
| 1085 | PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \ | ||
| 1086 | PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \ | ||
| 1087 | PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \ | ||
| 1088 | PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \ | ||
| 1089 | PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \ | ||
| 1090 | PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \ | ||
| 1091 | PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \ | ||
| 1092 | PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \ | ||
| 1093 | PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \ | ||
| 1094 | PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \ | ||
| 1095 | PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \ | ||
| 1096 | PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \ | ||
| 1097 | PIN_OTYPE_PUSHPULL(GPIOH_PIN15)) | ||
| 1098 | #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOH_PIN0) | \ | ||
| 1099 | PIN_OSPEED_VERYLOW(GPIOH_PIN1) | \ | ||
| 1100 | PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \ | ||
| 1101 | PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \ | ||
| 1102 | PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \ | ||
| 1103 | PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \ | ||
| 1104 | PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \ | ||
| 1105 | PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \ | ||
| 1106 | PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \ | ||
| 1107 | PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \ | ||
| 1108 | PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \ | ||
| 1109 | PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \ | ||
| 1110 | PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \ | ||
| 1111 | PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \ | ||
| 1112 | PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \ | ||
| 1113 | PIN_OSPEED_VERYLOW(GPIOH_PIN15)) | ||
| 1114 | #define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLUP(GPIOH_PIN0) | \ | ||
| 1115 | PIN_PUPDR_PULLUP(GPIOH_PIN1) | \ | ||
| 1116 | PIN_PUPDR_PULLUP(GPIOH_PIN2) | \ | ||
| 1117 | PIN_PUPDR_PULLUP(GPIOH_PIN3) | \ | ||
| 1118 | PIN_PUPDR_PULLUP(GPIOH_PIN4) | \ | ||
| 1119 | PIN_PUPDR_PULLUP(GPIOH_PIN5) | \ | ||
| 1120 | PIN_PUPDR_PULLUP(GPIOH_PIN6) | \ | ||
| 1121 | PIN_PUPDR_PULLUP(GPIOH_PIN7) | \ | ||
| 1122 | PIN_PUPDR_PULLUP(GPIOH_PIN8) | \ | ||
| 1123 | PIN_PUPDR_PULLUP(GPIOH_PIN9) | \ | ||
| 1124 | PIN_PUPDR_PULLUP(GPIOH_PIN10) | \ | ||
| 1125 | PIN_PUPDR_PULLUP(GPIOH_PIN11) | \ | ||
| 1126 | PIN_PUPDR_PULLUP(GPIOH_PIN12) | \ | ||
| 1127 | PIN_PUPDR_PULLUP(GPIOH_PIN13) | \ | ||
| 1128 | PIN_PUPDR_PULLUP(GPIOH_PIN14) | \ | ||
| 1129 | PIN_PUPDR_PULLUP(GPIOH_PIN15)) | ||
| 1130 | #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | \ | ||
| 1131 | PIN_ODR_HIGH(GPIOH_PIN1) | \ | ||
| 1132 | PIN_ODR_HIGH(GPIOH_PIN2) | \ | ||
| 1133 | PIN_ODR_HIGH(GPIOH_PIN3) | \ | ||
| 1134 | PIN_ODR_HIGH(GPIOH_PIN4) | \ | ||
| 1135 | PIN_ODR_HIGH(GPIOH_PIN5) | \ | ||
| 1136 | PIN_ODR_HIGH(GPIOH_PIN6) | \ | ||
| 1137 | PIN_ODR_HIGH(GPIOH_PIN7) | \ | ||
| 1138 | PIN_ODR_HIGH(GPIOH_PIN8) | \ | ||
| 1139 | PIN_ODR_HIGH(GPIOH_PIN9) | \ | ||
| 1140 | PIN_ODR_HIGH(GPIOH_PIN10) | \ | ||
| 1141 | PIN_ODR_HIGH(GPIOH_PIN11) | \ | ||
| 1142 | PIN_ODR_HIGH(GPIOH_PIN12) | \ | ||
| 1143 | PIN_ODR_HIGH(GPIOH_PIN13) | \ | ||
| 1144 | PIN_ODR_HIGH(GPIOH_PIN14) | \ | ||
| 1145 | PIN_ODR_HIGH(GPIOH_PIN15)) | ||
| 1146 | #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0) | \ | ||
| 1147 | PIN_AFIO_AF(GPIOH_PIN1, 0) | \ | ||
| 1148 | PIN_AFIO_AF(GPIOH_PIN2, 0) | \ | ||
| 1149 | PIN_AFIO_AF(GPIOH_PIN3, 0) | \ | ||
| 1150 | PIN_AFIO_AF(GPIOH_PIN4, 0) | \ | ||
| 1151 | PIN_AFIO_AF(GPIOH_PIN5, 0) | \ | ||
| 1152 | PIN_AFIO_AF(GPIOH_PIN6, 0) | \ | ||
| 1153 | PIN_AFIO_AF(GPIOH_PIN7, 0)) | ||
| 1154 | #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0) | \ | ||
| 1155 | PIN_AFIO_AF(GPIOH_PIN9, 0) | \ | ||
| 1156 | PIN_AFIO_AF(GPIOH_PIN10, 0) | \ | ||
| 1157 | PIN_AFIO_AF(GPIOH_PIN11, 0) | \ | ||
| 1158 | PIN_AFIO_AF(GPIOH_PIN12, 0) | \ | ||
| 1159 | PIN_AFIO_AF(GPIOH_PIN13, 0) | \ | ||
| 1160 | PIN_AFIO_AF(GPIOH_PIN14, 0) | \ | ||
| 1161 | PIN_AFIO_AF(GPIOH_PIN15, 0)) | ||
| 1162 | |||
| 1163 | |||
| 1164 | /* | ||
| 1165 | * USB bus activation macro, required by the USB driver. | ||
| 1166 | */ | ||
| 1167 | // #define usb_lld_connect_bus(usbp) | ||
| 1168 | #define usb_lld_connect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_ALTERNATE(14))) | ||
| 1169 | // #define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT) | ||
| 1170 | /* | ||
| 1171 | * USB bus de-activation macro, required by the USB driver. | ||
| 1172 | */ | ||
| 1173 | // #define usb_lld_disconnect_bus(usbp) | ||
| 1174 | #define usb_lld_disconnect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL)); palClearPad(GPIOA, GPIOA_USB_DP) | ||
| 1175 | // #define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12) | ||
| 1176 | |||
| 1177 | #if !defined(_FROM_ASM_) | ||
| 1178 | #ifdef __cplusplus | ||
| 1179 | extern "C" { | ||
| 1180 | #endif | ||
| 1181 | void boardInit(void); | ||
| 1182 | #ifdef __cplusplus | ||
| 1183 | } | ||
| 1184 | #endif | ||
| 1185 | #endif /* _FROM_ASM_ */ | ||
| 1186 | |||
| 1187 | #endif /* _BOARD_H_ */ | ||
diff --git a/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.mk b/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.mk new file mode 100644 index 000000000..43377629a --- /dev/null +++ b/keyboards/hadron/ver3/boards/GENERIC_STM32_F303XC/board.mk | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # List of all the board related files. | ||
| 2 | BOARDSRC = $(BOARD_PATH)/boards/GENERIC_STM32_F303XC/board.c | ||
| 3 | |||
| 4 | # Required include directories | ||
| 5 | BOARDINC = $(BOARD_PATH)/boards/GENERIC_STM32_F303XC | ||
diff --git a/keyboards/hadron/ver3/bootloader_defs.h b/keyboards/hadron/ver3/bootloader_defs.h new file mode 100644 index 000000000..3b0e9d20a --- /dev/null +++ b/keyboards/hadron/ver3/bootloader_defs.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | /* Address for jumping to bootloader on STM32 chips. */ | ||
| 2 | /* It is chip dependent, the correct number can be looked up here: | ||
| 3 | * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf | ||
| 4 | * This also requires a patch to chibios: | ||
| 5 | * <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch | ||
| 6 | */ | ||
| 7 | #define STM32_BOOTLOADER_ADDRESS 0x1FFFD800 | ||
diff --git a/keyboards/hadron/ver3/chconf.h b/keyboards/hadron/ver3/chconf.h new file mode 100644 index 000000000..1d9f12ff1 --- /dev/null +++ b/keyboards/hadron/ver3/chconf.h | |||
| @@ -0,0 +1,520 @@ | |||
| 1 | /* | ||
| 2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
| 3 | |||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | you may not use this file except in compliance with the License. | ||
| 6 | You may obtain a copy of the License at | ||
| 7 | |||
| 8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | |||
| 10 | Unless required by applicable law or agreed to in writing, software | ||
| 11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | See the License for the specific language governing permissions and | ||
| 14 | limitations under the License. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /** | ||
| 18 | * @file templates/chconf.h | ||
| 19 | * @brief Configuration file template. | ||
| 20 | * @details A copy of this file must be placed in each project directory, it | ||
| 21 | * contains the application specific kernel settings. | ||
| 22 | * | ||
| 23 | * @addtogroup config | ||
| 24 | * @details Kernel related settings and hooks. | ||
| 25 | * @{ | ||
| 26 | */ | ||
| 27 | |||
| 28 | #ifndef CHCONF_H | ||
| 29 | #define CHCONF_H | ||
| 30 | |||
| 31 | #define _CHIBIOS_RT_CONF_ | ||
| 32 | |||
| 33 | /*===========================================================================*/ | ||
| 34 | /** | ||
| 35 | * @name System timers settings | ||
| 36 | * @{ | ||
| 37 | */ | ||
| 38 | /*===========================================================================*/ | ||
| 39 | |||
| 40 | /** | ||
| 41 | * @brief System time counter resolution. | ||
| 42 | * @note Allowed values are 16 or 32 bits. | ||
| 43 | */ | ||
| 44 | #define CH_CFG_ST_RESOLUTION 32 | ||
| 45 | |||
| 46 | /** | ||
| 47 | * @brief System tick frequency. | ||
| 48 | * @details Frequency of the system timer that drives the system ticks. This | ||
| 49 | * setting also defines the system tick time unit. | ||
| 50 | */ | ||
| 51 | #define CH_CFG_ST_FREQUENCY 100000 | ||
| 52 | |||
| 53 | /** | ||
| 54 | * @brief Time delta constant for the tick-less mode. | ||
| 55 | * @note If this value is zero then the system uses the classic | ||
| 56 | * periodic tick. This value represents the minimum number | ||
| 57 | * of ticks that is safe to specify in a timeout directive. | ||
| 58 | * The value one is not valid, timeouts are rounded up to | ||
| 59 | * this value. | ||
| 60 | */ | ||
| 61 | #define CH_CFG_ST_TIMEDELTA 2 | ||
| 62 | |||
| 63 | /** @} */ | ||
| 64 | |||
| 65 | /*===========================================================================*/ | ||
| 66 | /** | ||
| 67 | * @name Kernel parameters and options | ||
| 68 | * @{ | ||
| 69 | */ | ||
| 70 | /*===========================================================================*/ | ||
| 71 | |||
| 72 | /** | ||
| 73 | * @brief Round robin interval. | ||
| 74 | * @details This constant is the number of system ticks allowed for the | ||
| 75 | * threads before preemption occurs. Setting this value to zero | ||
| 76 | * disables the preemption for threads with equal priority and the | ||
| 77 | * round robin becomes cooperative. Note that higher priority | ||
| 78 | * threads can still preempt, the kernel is always preemptive. | ||
| 79 | * @note Disabling the round robin preemption makes the kernel more compact | ||
| 80 | * and generally faster. | ||
| 81 | * @note The round robin preemption is not supported in tickless mode and | ||
| 82 | * must be set to zero in that case. | ||
| 83 | */ | ||
| 84 | #define CH_CFG_TIME_QUANTUM 0 | ||
| 85 | |||
| 86 | /** | ||
| 87 | * @brief Managed RAM size. | ||
| 88 | * @details Size of the RAM area to be managed by the OS. If set to zero | ||
| 89 | * then the whole available RAM is used. The core memory is made | ||
| 90 | * available to the heap allocator and/or can be used directly through | ||
| 91 | * the simplified core memory allocator. | ||
| 92 | * | ||
| 93 | * @note In order to let the OS manage the whole RAM the linker script must | ||
| 94 | * provide the @p __heap_base__ and @p __heap_end__ symbols. | ||
| 95 | * @note Requires @p CH_CFG_USE_MEMCORE. | ||
| 96 | */ | ||
| 97 | #define CH_CFG_MEMCORE_SIZE 0 | ||
| 98 | |||
| 99 | /** | ||
| 100 | * @brief Idle thread automatic spawn suppression. | ||
| 101 | * @details When this option is activated the function @p chSysInit() | ||
| 102 | * does not spawn the idle thread. The application @p main() | ||
| 103 | * function becomes the idle thread and must implement an | ||
| 104 | * infinite loop. | ||
| 105 | */ | ||
| 106 | #define CH_CFG_NO_IDLE_THREAD FALSE | ||
| 107 | |||
| 108 | /** @} */ | ||
| 109 | |||
| 110 | /*===========================================================================*/ | ||
| 111 | /** | ||
| 112 | * @name Performance options | ||
| 113 | * @{ | ||
| 114 | */ | ||
| 115 | /*===========================================================================*/ | ||
| 116 | |||
| 117 | /** | ||
| 118 | * @brief OS optimization. | ||
| 119 | * @details If enabled then time efficient rather than space efficient code | ||
| 120 | * is used when two possible implementations exist. | ||
| 121 | * | ||
| 122 | * @note This is not related to the compiler optimization options. | ||
| 123 | * @note The default is @p TRUE. | ||
| 124 | */ | ||
| 125 | #define CH_CFG_OPTIMIZE_SPEED TRUE | ||
| 126 | |||
| 127 | /** @} */ | ||
| 128 | |||
| 129 | /*===========================================================================*/ | ||
| 130 | /** | ||
| 131 | * @name Subsystem options | ||
| 132 | * @{ | ||
| 133 | */ | ||
| 134 | /*===========================================================================*/ | ||
| 135 | |||
| 136 | /** | ||
| 137 | * @brief Time Measurement APIs. | ||
| 138 | * @details If enabled then the time measurement APIs are included in | ||
| 139 | * the kernel. | ||
| 140 | * | ||
| 141 | * @note The default is @p TRUE. | ||
| 142 | */ | ||
| 143 | #define CH_CFG_USE_TM TRUE | ||
| 144 | |||
| 145 | /** | ||
| 146 | * @brief Threads registry APIs. | ||
| 147 | * @details If enabled then the registry APIs are included in the kernel. | ||
| 148 | * | ||
| 149 | * @note The default is @p TRUE. | ||
| 150 | */ | ||
| 151 | #define CH_CFG_USE_REGISTRY TRUE | ||
| 152 | |||
| 153 | /** | ||
| 154 | * @brief Threads synchronization APIs. | ||
| 155 | * @details If enabled then the @p chThdWait() function is included in | ||
| 156 | * the kernel. | ||
| 157 | * | ||
| 158 | * @note The default is @p TRUE. | ||
| 159 | */ | ||
| 160 | #define CH_CFG_USE_WAITEXIT TRUE | ||
| 161 | |||
| 162 | /** | ||
| 163 | * @brief Semaphores APIs. | ||
| 164 | * @details If enabled then the Semaphores APIs are included in the kernel. | ||
| 165 | * | ||
| 166 | * @note The default is @p TRUE. | ||
| 167 | */ | ||
| 168 | #define CH_CFG_USE_SEMAPHORES TRUE | ||
| 169 | |||
| 170 | /** | ||
| 171 | * @brief Semaphores queuing mode. | ||
| 172 | * @details If enabled then the threads are enqueued on semaphores by | ||
| 173 | * priority rather than in FIFO order. | ||
| 174 | * | ||
| 175 | * @note The default is @p FALSE. Enable this if you have special | ||
| 176 | * requirements. | ||
| 177 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
| 178 | */ | ||
| 179 | #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE | ||
| 180 | |||
| 181 | /** | ||
| 182 | * @brief Mutexes APIs. | ||
| 183 | * @details If enabled then the mutexes APIs are included in the kernel. | ||
| 184 | * | ||
| 185 | * @note The default is @p TRUE. | ||
| 186 | */ | ||
| 187 | #define CH_CFG_USE_MUTEXES TRUE | ||
| 188 | |||
| 189 | /** | ||
| 190 | * @brief Enables recursive behavior on mutexes. | ||
| 191 | * @note Recursive mutexes are heavier and have an increased | ||
| 192 | * memory footprint. | ||
| 193 | * | ||
| 194 | * @note The default is @p FALSE. | ||
| 195 | * @note Requires @p CH_CFG_USE_MUTEXES. | ||
| 196 | */ | ||
| 197 | #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE | ||
| 198 | |||
| 199 | /** | ||
| 200 | * @brief Conditional Variables APIs. | ||
| 201 | * @details If enabled then the conditional variables APIs are included | ||
| 202 | * in the kernel. | ||
| 203 | * | ||
| 204 | * @note The default is @p TRUE. | ||
| 205 | * @note Requires @p CH_CFG_USE_MUTEXES. | ||
| 206 | */ | ||
| 207 | #define CH_CFG_USE_CONDVARS TRUE | ||
| 208 | |||
| 209 | /** | ||
| 210 | * @brief Conditional Variables APIs with timeout. | ||
| 211 | * @details If enabled then the conditional variables APIs with timeout | ||
| 212 | * specification are included in the kernel. | ||
| 213 | * | ||
| 214 | * @note The default is @p TRUE. | ||
| 215 | * @note Requires @p CH_CFG_USE_CONDVARS. | ||
| 216 | */ | ||
| 217 | #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE | ||
| 218 | |||
| 219 | /** | ||
| 220 | * @brief Events Flags APIs. | ||
| 221 | * @details If enabled then the event flags APIs are included in the kernel. | ||
| 222 | * | ||
| 223 | * @note The default is @p TRUE. | ||
| 224 | */ | ||
| 225 | #define CH_CFG_USE_EVENTS TRUE | ||
| 226 | |||
| 227 | /** | ||
| 228 | * @brief Events Flags APIs with timeout. | ||
| 229 | * @details If enabled then the events APIs with timeout specification | ||
| 230 | * are included in the kernel. | ||
| 231 | * | ||
| 232 | * @note The default is @p TRUE. | ||
| 233 | * @note Requires @p CH_CFG_USE_EVENTS. | ||
| 234 | */ | ||
| 235 | #define CH_CFG_USE_EVENTS_TIMEOUT TRUE | ||
| 236 | |||
| 237 | /** | ||
| 238 | * @brief Synchronous Messages APIs. | ||
| 239 | * @details If enabled then the synchronous messages APIs are included | ||
| 240 | * in the kernel. | ||
| 241 | * | ||
| 242 | * @note The default is @p TRUE. | ||
| 243 | */ | ||
| 244 | #define CH_CFG_USE_MESSAGES TRUE | ||
| 245 | |||
| 246 | /** | ||
| 247 | * @brief Synchronous Messages queuing mode. | ||
| 248 | * @details If enabled then messages are served by priority rather than in | ||
| 249 | * FIFO order. | ||
| 250 | * | ||
| 251 | * @note The default is @p FALSE. Enable this if you have special | ||
| 252 | * requirements. | ||
| 253 | * @note Requires @p CH_CFG_USE_MESSAGES. | ||
| 254 | */ | ||
| 255 | #define CH_CFG_USE_MESSAGES_PRIORITY TRUE | ||
| 256 | |||
| 257 | /** | ||
| 258 | * @brief Mailboxes APIs. | ||
| 259 | * @details If enabled then the asynchronous messages (mailboxes) APIs are | ||
| 260 | * included in the kernel. | ||
| 261 | * | ||
| 262 | * @note The default is @p TRUE. | ||
| 263 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
| 264 | */ | ||
| 265 | #define CH_CFG_USE_MAILBOXES TRUE | ||
| 266 | |||
| 267 | /** | ||
| 268 | * @brief Core Memory Manager APIs. | ||
| 269 | * @details If enabled then the core memory manager APIs are included | ||
| 270 | * in the kernel. | ||
| 271 | * | ||
| 272 | * @note The default is @p TRUE. | ||
| 273 | */ | ||
| 274 | #define CH_CFG_USE_MEMCORE TRUE | ||
| 275 | |||
| 276 | /** | ||
| 277 | * @brief Heap Allocator APIs. | ||
| 278 | * @details If enabled then the memory heap allocator APIs are included | ||
| 279 | * in the kernel. | ||
| 280 | * | ||
| 281 | * @note The default is @p TRUE. | ||
| 282 | * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or | ||
| 283 | * @p CH_CFG_USE_SEMAPHORES. | ||
| 284 | * @note Mutexes are recommended. | ||
| 285 | */ | ||
| 286 | #define CH_CFG_USE_HEAP TRUE | ||
| 287 | |||
| 288 | /** | ||
| 289 | * @brief Memory Pools Allocator APIs. | ||
| 290 | * @details If enabled then the memory pools allocator APIs are included | ||
| 291 | * in the kernel. | ||
| 292 | * | ||
| 293 | * @note The default is @p TRUE. | ||
| 294 | */ | ||
| 295 | #define CH_CFG_USE_MEMPOOLS TRUE | ||
| 296 | |||
| 297 | /** | ||
| 298 | * @brief Dynamic Threads APIs. | ||
| 299 | * @details If enabled then the dynamic threads creation APIs are included | ||
| 300 | * in the kernel. | ||
| 301 | * | ||
| 302 | * @note The default is @p TRUE. | ||
| 303 | * @note Requires @p CH_CFG_USE_WAITEXIT. | ||
| 304 | * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. | ||
| 305 | */ | ||
| 306 | #define CH_CFG_USE_DYNAMIC TRUE | ||
| 307 | |||
| 308 | /** @} */ | ||
| 309 | |||
| 310 | /*===========================================================================*/ | ||
| 311 | /** | ||
| 312 | * @name Debug options | ||
| 313 | * @{ | ||
| 314 | */ | ||
| 315 | /*===========================================================================*/ | ||
| 316 | |||
| 317 | /** | ||
| 318 | * @brief Debug option, kernel statistics. | ||
| 319 | * | ||
| 320 | * @note The default is @p FALSE. | ||
| 321 | */ | ||
| 322 | #define CH_DBG_STATISTICS FALSE | ||
| 323 | |||
| 324 | /** | ||
| 325 | * @brief Debug option, system state check. | ||
| 326 | * @details If enabled the correct call protocol for system APIs is checked | ||
| 327 | * at runtime. | ||
| 328 | * | ||
| 329 | * @note The default is @p FALSE. | ||
| 330 | */ | ||
| 331 | #define CH_DBG_SYSTEM_STATE_CHECK FALSE | ||
| 332 | |||
| 333 | /** | ||
| 334 | * @brief Debug option, parameters checks. | ||
| 335 | * @details If enabled then the checks on the API functions input | ||
| 336 | * parameters are activated. | ||
| 337 | * | ||
| 338 | * @note The default is @p FALSE. | ||
| 339 | */ | ||
| 340 | #define CH_DBG_ENABLE_CHECKS FALSE | ||
| 341 | |||
| 342 | /** | ||
| 343 | * @brief Debug option, consistency checks. | ||
| 344 | * @details If enabled then all the assertions in the kernel code are | ||
| 345 | * activated. This includes consistency checks inside the kernel, | ||
| 346 | * runtime anomalies and port-defined checks. | ||
| 347 | * | ||
| 348 | * @note The default is @p FALSE. | ||
| 349 | */ | ||
| 350 | #define CH_DBG_ENABLE_ASSERTS FALSE | ||
| 351 | |||
| 352 | /** | ||
| 353 | * @brief Debug option, trace buffer. | ||
| 354 | * @details If enabled then the trace buffer is activated. | ||
| 355 | * | ||
| 356 | * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. | ||
| 357 | */ | ||
| 358 | #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED | ||
| 359 | |||
| 360 | /** | ||
| 361 | * @brief Trace buffer entries. | ||
| 362 | * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is | ||
| 363 | * different from @p CH_DBG_TRACE_MASK_DISABLED. | ||
| 364 | */ | ||
| 365 | #define CH_DBG_TRACE_BUFFER_SIZE 128 | ||
| 366 | |||
| 367 | /** | ||
| 368 | * @brief Debug option, stack checks. | ||
| 369 | * @details If enabled then a runtime stack check is performed. | ||
| 370 | * | ||
| 371 | * @note The default is @p FALSE. | ||
| 372 | * @note The stack check is performed in a architecture/port dependent way. | ||
| 373 | * It may not be implemented or some ports. | ||
| 374 | * @note The default failure mode is to halt the system with the global | ||
| 375 | * @p panic_msg variable set to @p NULL. | ||
| 376 | */ | ||
| 377 | #define CH_DBG_ENABLE_STACK_CHECK TRUE | ||
| 378 | |||
| 379 | /** | ||
| 380 | * @brief Debug option, stacks initialization. | ||
| 381 | * @details If enabled then the threads working area is filled with a byte | ||
| 382 | * value when a thread is created. This can be useful for the | ||
| 383 | * runtime measurement of the used stack. | ||
| 384 | * | ||
| 385 | * @note The default is @p FALSE. | ||
| 386 | */ | ||
| 387 | #define CH_DBG_FILL_THREADS FALSE | ||
| 388 | |||
| 389 | /** | ||
| 390 | * @brief Debug option, threads profiling. | ||
| 391 | * @details If enabled then a field is added to the @p thread_t structure that | ||
| 392 | * counts the system ticks occurred while executing the thread. | ||
| 393 | * | ||
| 394 | * @note The default is @p FALSE. | ||
| 395 | * @note This debug option is not currently compatible with the | ||
| 396 | * tickless mode. | ||
| 397 | */ | ||
| 398 | #define CH_DBG_THREADS_PROFILING FALSE | ||
| 399 | |||
| 400 | /** @} */ | ||
| 401 | |||
| 402 | /*===========================================================================*/ | ||
| 403 | /** | ||
| 404 | * @name Kernel hooks | ||
| 405 | * @{ | ||
| 406 | */ | ||
| 407 | /*===========================================================================*/ | ||
| 408 | |||
| 409 | /** | ||
| 410 | * @brief Threads descriptor structure extension. | ||
| 411 | * @details User fields added to the end of the @p thread_t structure. | ||
| 412 | */ | ||
| 413 | #define CH_CFG_THREAD_EXTRA_FIELDS \ | ||
| 414 | /* Add threads custom fields here.*/ | ||
| 415 | |||
| 416 | /** | ||
| 417 | * @brief Threads initialization hook. | ||
| 418 | * @details User initialization code added to the @p chThdInit() API. | ||
| 419 | * | ||
| 420 | * @note It is invoked from within @p chThdInit() and implicitly from all | ||
| 421 | * the threads creation APIs. | ||
| 422 | */ | ||
| 423 | #define CH_CFG_THREAD_INIT_HOOK(tp) { \ | ||
| 424 | /* Add threads initialization code here.*/ \ | ||
| 425 | } | ||
| 426 | |||
| 427 | /** | ||
| 428 | * @brief Threads finalization hook. | ||
| 429 | * @details User finalization code added to the @p chThdExit() API. | ||
| 430 | */ | ||
| 431 | #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ | ||
| 432 | /* Add threads finalization code here.*/ \ | ||
| 433 | } | ||
| 434 | |||
| 435 | /** | ||
| 436 | * @brief Context switch hook. | ||
| 437 | * @details This hook is invoked just before switching between threads. | ||
| 438 | */ | ||
| 439 | #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ | ||
| 440 | /* Context switch code here.*/ \ | ||
| 441 | } | ||
| 442 | |||
| 443 | /** | ||
| 444 | * @brief ISR enter hook. | ||
| 445 | */ | ||
| 446 | #define CH_CFG_IRQ_PROLOGUE_HOOK() { \ | ||
| 447 | /* IRQ prologue code here.*/ \ | ||
| 448 | } | ||
| 449 | |||
| 450 | /** | ||
| 451 | * @brief ISR exit hook. | ||
| 452 | */ | ||
| 453 | #define CH_CFG_IRQ_EPILOGUE_HOOK() { \ | ||
| 454 | /* IRQ epilogue code here.*/ \ | ||
| 455 | } | ||
| 456 | |||
| 457 | /** | ||
| 458 | * @brief Idle thread enter hook. | ||
| 459 | * @note This hook is invoked within a critical zone, no OS functions | ||
| 460 | * should be invoked from here. | ||
| 461 | * @note This macro can be used to activate a power saving mode. | ||
| 462 | */ | ||
| 463 | #define CH_CFG_IDLE_ENTER_HOOK() { \ | ||
| 464 | /* Idle-enter code here.*/ \ | ||
| 465 | } | ||
| 466 | |||
| 467 | /** | ||
| 468 | * @brief Idle thread leave hook. | ||
| 469 | * @note This hook is invoked within a critical zone, no OS functions | ||
| 470 | * should be invoked from here. | ||
| 471 | * @note This macro can be used to deactivate a power saving mode. | ||
| 472 | */ | ||
| 473 | #define CH_CFG_IDLE_LEAVE_HOOK() { \ | ||
| 474 | /* Idle-leave code here.*/ \ | ||
| 475 | } | ||
| 476 | |||
| 477 | /** | ||
| 478 | * @brief Idle Loop hook. | ||
| 479 | * @details This hook is continuously invoked by the idle thread loop. | ||
| 480 | */ | ||
| 481 | #define CH_CFG_IDLE_LOOP_HOOK() { \ | ||
| 482 | /* Idle loop code here.*/ \ | ||
| 483 | } | ||
| 484 | |||
| 485 | /** | ||
| 486 | * @brief System tick event hook. | ||
| 487 | * @details This hook is invoked in the system tick handler immediately | ||
| 488 | * after processing the virtual timers queue. | ||
| 489 | */ | ||
| 490 | #define CH_CFG_SYSTEM_TICK_HOOK() { \ | ||
| 491 | /* System tick event code here.*/ \ | ||
| 492 | } | ||
| 493 | |||
| 494 | /** | ||
| 495 | * @brief System halt hook. | ||
| 496 | * @details This hook is invoked in case to a system halting error before | ||
| 497 | * the system is halted. | ||
| 498 | */ | ||
| 499 | #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ | ||
| 500 | /* System halt code here.*/ \ | ||
| 501 | } | ||
| 502 | |||
| 503 | /** | ||
| 504 | * @brief Trace hook. | ||
| 505 | * @details This hook is invoked each time a new record is written in the | ||
| 506 | * trace buffer. | ||
| 507 | */ | ||
| 508 | #define CH_CFG_TRACE_HOOK(tep) { \ | ||
| 509 | /* Trace code here.*/ \ | ||
| 510 | } | ||
| 511 | |||
| 512 | /** @} */ | ||
| 513 | |||
| 514 | /*===========================================================================*/ | ||
| 515 | /* Port-specific settings (override port settings defaulted in chcore.h). */ | ||
| 516 | /*===========================================================================*/ | ||
| 517 | |||
| 518 | #endif /* CHCONF_H */ | ||
| 519 | |||
| 520 | /** @} */ | ||
diff --git a/keyboards/hadron/ver3/config.h b/keyboards/hadron/ver3/config.h new file mode 100644 index 000000000..11288f7a5 --- /dev/null +++ b/keyboards/hadron/ver3/config.h | |||
| @@ -0,0 +1,192 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2018 Jack Humbert <jack.humb@gmail.com> | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef REV3_CONFIG_H | ||
| 19 | #define REV3_CONFIG_H | ||
| 20 | |||
| 21 | /* USB Device descriptor parameter */ | ||
| 22 | #define DEVICE_VER 0x0003 | ||
| 23 | |||
| 24 | #undef MATRIX_ROWS | ||
| 25 | #undef MATRIX_COLS | ||
| 26 | /* key matrix size */ | ||
| 27 | #define MATRIX_ROWS 5 | ||
| 28 | #define MATRIX_COLS 15 | ||
| 29 | |||
| 30 | |||
| 31 | //Audio | ||
| 32 | #undef AUDIO_VOICES | ||
| 33 | #undef C6_AUDIO | ||
| 34 | |||
| 35 | #ifdef AUDIO_ENABLE | ||
| 36 | #define STARTUP_SONG SONG(PLANCK_SOUND) | ||
| 37 | // #define STARTUP_SONG SONG(NO_SOUND) | ||
| 38 | |||
| 39 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ | ||
| 40 | SONG(COLEMAK_SOUND), \ | ||
| 41 | SONG(DVORAK_SOUND) \ | ||
| 42 | } | ||
| 43 | #define AUDIO_CLICKY | ||
| 44 | /* to enable clicky on startup */ | ||
| 45 | //#define AUDIO_CLICKY_ON | ||
| 46 | #define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f | ||
| 47 | #endif | ||
| 48 | |||
| 49 | //configure qwiic micro_oled driver for the 128x32 oled | ||
| 50 | #ifdef QWIIC_MICRO_OLED_ENABLE | ||
| 51 | |||
| 52 | #undef I2C_ADDRESS_SA0_1 | ||
| 53 | #define I2C_ADDRESS_SA0_1 0b0111100 | ||
| 54 | #define LCDWIDTH 128 | ||
| 55 | #define LCDHEIGHT 32 | ||
| 56 | #define micro_oled_rotate_180 | ||
| 57 | |||
| 58 | #endif | ||
| 59 | /* | ||
| 60 | * Keyboard Matrix Assignments | ||
| 61 | * | ||
| 62 | * Change this to how you wired your keyboard | ||
| 63 | * COLS: AVR pins used for columns, left to right | ||
| 64 | * ROWS: AVR pins used for rows, top to bottom | ||
| 65 | * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) | ||
| 66 | * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) | ||
| 67 | * | ||
| 68 | */ | ||
| 69 | |||
| 70 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
| 71 | #define DEBOUNCE 6 | ||
| 72 | |||
| 73 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 74 | //#define LOCKING_SUPPORT_ENABLE | ||
| 75 | /* Locking resynchronize hack */ | ||
| 76 | //#define LOCKING_RESYNC_ENABLE | ||
| 77 | |||
| 78 | /* | ||
| 79 | * Force NKRO | ||
| 80 | * | ||
| 81 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
| 82 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
| 83 | * makefile for this to work.) | ||
| 84 | * | ||
| 85 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
| 86 | * until the next keyboard reset. | ||
| 87 | * | ||
| 88 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
| 89 | * fully operational during normal computer usage. | ||
| 90 | * | ||
| 91 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
| 92 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
| 93 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
| 94 | * power-up. | ||
| 95 | * | ||
| 96 | */ | ||
| 97 | //#define FORCE_NKRO | ||
| 98 | |||
| 99 | /* key combination for magic key command */ | ||
| 100 | #define IS_COMMAND() ( \ | ||
| 101 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 102 | ) | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Feature disable options | ||
| 106 | * These options are also useful to firmware size reduction. | ||
| 107 | */ | ||
| 108 | |||
| 109 | /* disable debug print */ | ||
| 110 | //#define NO_DEBUG | ||
| 111 | |||
| 112 | /* disable print */ | ||
| 113 | //#define NO_PRINT | ||
| 114 | |||
| 115 | /* disable action features */ | ||
| 116 | //#define NO_ACTION_LAYER | ||
| 117 | //#define NO_ACTION_TAPPING | ||
| 118 | //#define NO_ACTION_ONESHOT | ||
| 119 | //#define NO_ACTION_MACRO | ||
| 120 | //#define NO_ACTION_FUNCTION | ||
| 121 | /* | ||
| 122 | * MIDI options | ||
| 123 | */ | ||
| 124 | |||
| 125 | /* Prevent use of disabled MIDI features in the keymap */ | ||
| 126 | //#define MIDI_ENABLE_STRICT 1 | ||
| 127 | |||
| 128 | /* enable basic MIDI features: | ||
| 129 | - MIDI notes can be sent when in Music mode is on | ||
| 130 | */ | ||
| 131 | |||
| 132 | #define MIDI_BASIC | ||
| 133 | |||
| 134 | /* enable advanced MIDI features: | ||
| 135 | - MIDI notes can be added to the keymap | ||
| 136 | - Octave shift and transpose | ||
| 137 | - Virtual sustain, portamento, and modulation wheel | ||
| 138 | - etc. | ||
| 139 | */ | ||
| 140 | //#define MIDI_ADVANCED | ||
| 141 | |||
| 142 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
| 143 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
| 144 | |||
| 145 | /* Haptic Driver initialization settings | ||
| 146 | * Feedback Control Settings */ | ||
| 147 | #define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/ | ||
| 148 | #define FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ | ||
| 149 | #define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ | ||
| 150 | |||
| 151 | #define RATED_VOLTAGE 2 | ||
| 152 | #define V_RMS 2.0 | ||
| 153 | #define V_PEAK 2.85 | ||
| 154 | #define F_LRA 205 | ||
| 155 | /* Library Selection */ | ||
| 156 | #define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | ||
| 157 | |||
| 158 | /* Control 1 register settings */ | ||
| 159 | #define DRIVE_TIME 25 | ||
| 160 | #define AC_COUPLE 0 | ||
| 161 | #define STARTUP_BOOST 1 | ||
| 162 | |||
| 163 | /* Control 2 Settings */ | ||
| 164 | #define BIDIR_INPUT 1 | ||
| 165 | #define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */ | ||
| 166 | #define SAMPLE_TIME 3 | ||
| 167 | #define BLANKING_TIME 1 | ||
| 168 | #define IDISS_TIME 1 | ||
| 169 | |||
| 170 | /* Control 3 settings */ | ||
| 171 | #define NG_THRESH 2 | ||
| 172 | #define ERM_OPEN_LOOP 1 | ||
| 173 | #define SUPPLY_COMP_DIS 0 | ||
| 174 | #define DATA_FORMAT_RTO 0 | ||
| 175 | #define LRA_DRIVE_MODE 0 | ||
| 176 | #define N_PWM_ANALOG 0 | ||
| 177 | #define LRA_OPEN_LOOP 0 | ||
| 178 | /* Control 4 settings */ | ||
| 179 | #define ZC_DET_TIME 0 | ||
| 180 | #define AUTO_CAL_TIME 3 | ||
| 181 | |||
| 182 | //#define WS2812_LED_N 2 | ||
| 183 | //#define RGBLED_NUM WS2812_LED_N | ||
| 184 | //#define WS2812_TIM_N 2 | ||
| 185 | //#define WS2812_TIM_CH 2 | ||
| 186 | //#define PORT_WS2812 GPIOA | ||
| 187 | //#define PIN_WS2812 15 | ||
| 188 | //#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection) | ||
| 189 | //#define WS2812_DMA_CHANNEL 7 // DMA channel for TIMx_UP | ||
| 190 | //#define WS2812_EXTERNAL_PULLUP | ||
| 191 | |||
| 192 | #endif | ||
diff --git a/keyboards/hadron/ver3/halconf.h b/keyboards/hadron/ver3/halconf.h new file mode 100644 index 000000000..c3e0cbb72 --- /dev/null +++ b/keyboards/hadron/ver3/halconf.h | |||
| @@ -0,0 +1,388 @@ | |||
| 1 | /* | ||
| 2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
| 3 | |||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | you may not use this file except in compliance with the License. | ||
| 6 | You may obtain a copy of the License at | ||
| 7 | |||
| 8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | |||
| 10 | Unless required by applicable law or agreed to in writing, software | ||
| 11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | See the License for the specific language governing permissions and | ||
| 14 | limitations under the License. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /** | ||
| 18 | * @file templates/halconf.h | ||
| 19 | * @brief HAL configuration header. | ||
| 20 | * @details HAL configuration file, this file allows to enable or disable the | ||
| 21 | * various device drivers from your application. You may also use | ||
| 22 | * this file in order to override the device drivers default settings. | ||
| 23 | * | ||
| 24 | * @addtogroup HAL_CONF | ||
| 25 | * @{ | ||
| 26 | */ | ||
| 27 | |||
| 28 | #ifndef HALCONF_H | ||
| 29 | #define HALCONF_H | ||
| 30 | |||
| 31 | #include "mcuconf.h" | ||
| 32 | |||
| 33 | /** | ||
| 34 | * @brief Enables the PAL subsystem. | ||
| 35 | */ | ||
| 36 | #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) | ||
| 37 | #define HAL_USE_PAL TRUE | ||
| 38 | #endif | ||
| 39 | |||
| 40 | /** | ||
| 41 | * @brief Enables the ADC subsystem. | ||
| 42 | */ | ||
| 43 | #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) | ||
| 44 | #define HAL_USE_ADC FALSE | ||
| 45 | #endif | ||
| 46 | |||
| 47 | /** | ||
| 48 | * @brief Enables the CAN subsystem. | ||
| 49 | */ | ||
| 50 | #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) | ||
| 51 | #define HAL_USE_CAN FALSE | ||
| 52 | #endif | ||
| 53 | |||
| 54 | /** | ||
| 55 | * @brief Enables the DAC subsystem. | ||
| 56 | */ | ||
| 57 | #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) | ||
| 58 | #define HAL_USE_DAC TRUE | ||
| 59 | #endif | ||
| 60 | |||
| 61 | /** | ||
| 62 | * @brief Enables the EXT subsystem. | ||
| 63 | */ | ||
| 64 | #if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) | ||
| 65 | #define HAL_USE_EXT FALSE | ||
| 66 | #endif | ||
| 67 | |||
| 68 | /** | ||
| 69 | * @brief Enables the GPT subsystem. | ||
| 70 | */ | ||
| 71 | #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) | ||
| 72 | #define HAL_USE_GPT TRUE | ||
| 73 | #endif | ||
| 74 | |||
| 75 | /** | ||
| 76 | * @brief Enables the I2C subsystem. | ||
| 77 | */ | ||
| 78 | #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) | ||
| 79 | #define HAL_USE_I2C TRUE | ||
| 80 | #endif | ||
| 81 | |||
| 82 | /** | ||
| 83 | * @brief Enables the I2S subsystem. | ||
| 84 | */ | ||
| 85 | #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) | ||
| 86 | #define HAL_USE_I2S FALSE | ||
| 87 | #endif | ||
| 88 | |||
| 89 | /** | ||
| 90 | * @brief Enables the ICU subsystem. | ||
| 91 | */ | ||
| 92 | #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) | ||
| 93 | #define HAL_USE_ICU FALSE | ||
| 94 | #endif | ||
| 95 | |||
| 96 | /** | ||
| 97 | * @brief Enables the MAC subsystem. | ||
| 98 | */ | ||
| 99 | #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) | ||
| 100 | #define HAL_USE_MAC FALSE | ||
| 101 | #endif | ||
| 102 | |||
| 103 | /** | ||
| 104 | * @brief Enables the MMC_SPI subsystem. | ||
| 105 | */ | ||
| 106 | #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) | ||
| 107 | #define HAL_USE_MMC_SPI FALSE | ||
| 108 | #endif | ||
| 109 | |||
| 110 | /** | ||
| 111 | * @brief Enables the PWM subsystem. | ||
| 112 | */ | ||
| 113 | #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) | ||
| 114 | #define HAL_USE_PWM FALSE | ||
| 115 | #endif | ||
| 116 | |||
| 117 | /** | ||
| 118 | * @brief Enables the QSPI subsystem. | ||
| 119 | */ | ||
| 120 | #if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__) | ||
| 121 | #define HAL_USE_QSPI FALSE | ||
| 122 | #endif | ||
| 123 | |||
| 124 | /** | ||
| 125 | * @brief Enables the RTC subsystem. | ||
| 126 | */ | ||
| 127 | #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) | ||
| 128 | #define HAL_USE_RTC FALSE | ||
| 129 | #endif | ||
| 130 | |||
| 131 | /** | ||
| 132 | * @brief Enables the SDC subsystem. | ||
| 133 | */ | ||
| 134 | #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) | ||
| 135 | #define HAL_USE_SDC FALSE | ||
| 136 | #endif | ||
| 137 | |||
| 138 | /** | ||
| 139 | * @brief Enables the SERIAL subsystem. | ||
| 140 | */ | ||
| 141 | #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) | ||
| 142 | #define HAL_USE_SERIAL FALSE | ||
| 143 | #endif | ||
| 144 | |||
| 145 | /** | ||
| 146 | * @brief Enables the SERIAL over USB subsystem. | ||
| 147 | */ | ||
| 148 | #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) | ||
| 149 | #define HAL_USE_SERIAL_USB TRUE | ||
| 150 | #endif | ||
| 151 | |||
| 152 | /** | ||
| 153 | * @brief Enables the SPI subsystem. | ||
| 154 | */ | ||
| 155 | #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) | ||
| 156 | #define HAL_USE_SPI FALSE | ||
| 157 | #endif | ||
| 158 | |||
| 159 | /** | ||
| 160 | * @brief Enables the UART subsystem. | ||
| 161 | */ | ||
| 162 | #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) | ||
| 163 | #define HAL_USE_UART FALSE | ||
| 164 | #endif | ||
| 165 | |||
| 166 | /** | ||
| 167 | * @brief Enables the USB subsystem. | ||
| 168 | */ | ||
| 169 | #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) | ||
| 170 | #define HAL_USE_USB TRUE | ||
| 171 | #endif | ||
| 172 | |||
| 173 | /** | ||
| 174 | * @brief Enables the WDG subsystem. | ||
| 175 | */ | ||
| 176 | #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) | ||
| 177 | #define HAL_USE_WDG FALSE | ||
| 178 | #endif | ||
| 179 | |||
| 180 | /*===========================================================================*/ | ||
| 181 | /* ADC driver related settings. */ | ||
| 182 | /*===========================================================================*/ | ||
| 183 | |||
| 184 | /** | ||
| 185 | * @brief Enables synchronous APIs. | ||
| 186 | * @note Disabling this option saves both code and data space. | ||
| 187 | */ | ||
| 188 | #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) | ||
| 189 | #define ADC_USE_WAIT TRUE | ||
| 190 | #endif | ||
| 191 | |||
| 192 | /** | ||
| 193 | * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. | ||
| 194 | * @note Disabling this option saves both code and data space. | ||
| 195 | */ | ||
| 196 | #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
| 197 | #define ADC_USE_MUTUAL_EXCLUSION TRUE | ||
| 198 | #endif | ||
| 199 | |||
| 200 | /*===========================================================================*/ | ||
| 201 | /* CAN driver related settings. */ | ||
| 202 | /*===========================================================================*/ | ||
| 203 | |||
| 204 | /** | ||
| 205 | * @brief Sleep mode related APIs inclusion switch. | ||
| 206 | */ | ||
| 207 | #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) | ||
| 208 | #define CAN_USE_SLEEP_MODE TRUE | ||
| 209 | #endif | ||
| 210 | |||
| 211 | /*===========================================================================*/ | ||
| 212 | /* I2C driver related settings. */ | ||
| 213 | /*===========================================================================*/ | ||
| 214 | |||
| 215 | /** | ||
| 216 | * @brief Enables the mutual exclusion APIs on the I2C bus. | ||
| 217 | */ | ||
| 218 | #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
| 219 | #define I2C_USE_MUTUAL_EXCLUSION TRUE | ||
| 220 | #endif | ||
| 221 | |||
| 222 | /*===========================================================================*/ | ||
| 223 | /* MAC driver related settings. */ | ||
| 224 | /*===========================================================================*/ | ||
| 225 | |||
| 226 | /** | ||
| 227 | * @brief Enables an event sources for incoming packets. | ||
| 228 | */ | ||
| 229 | #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) | ||
| 230 | #define MAC_USE_ZERO_COPY FALSE | ||
| 231 | #endif | ||
| 232 | |||
| 233 | /** | ||
| 234 | * @brief Enables an event sources for incoming packets. | ||
| 235 | */ | ||
| 236 | #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) | ||
| 237 | #define MAC_USE_EVENTS TRUE | ||
| 238 | #endif | ||
| 239 | |||
| 240 | /*===========================================================================*/ | ||
| 241 | /* MMC_SPI driver related settings. */ | ||
| 242 | /*===========================================================================*/ | ||
| 243 | |||
| 244 | /** | ||
| 245 | * @brief Delays insertions. | ||
| 246 | * @details If enabled this options inserts delays into the MMC waiting | ||
| 247 | * routines releasing some extra CPU time for the threads with | ||
| 248 | * lower priority, this may slow down the driver a bit however. | ||
| 249 | * This option is recommended also if the SPI driver does not | ||
| 250 | * use a DMA channel and heavily loads the CPU. | ||
| 251 | */ | ||
| 252 | #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) | ||
| 253 | #define MMC_NICE_WAITING TRUE | ||
| 254 | #endif | ||
| 255 | |||
| 256 | /*===========================================================================*/ | ||
| 257 | /* SDC driver related settings. */ | ||
| 258 | /*===========================================================================*/ | ||
| 259 | |||
| 260 | /** | ||
| 261 | * @brief Number of initialization attempts before rejecting the card. | ||
| 262 | * @note Attempts are performed at 10mS intervals. | ||
| 263 | */ | ||
| 264 | #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) | ||
| 265 | #define SDC_INIT_RETRY 100 | ||
| 266 | #endif | ||
| 267 | |||
| 268 | /** | ||
| 269 | * @brief Include support for MMC cards. | ||
| 270 | * @note MMC support is not yet implemented so this option must be kept | ||
| 271 | * at @p FALSE. | ||
| 272 | */ | ||
| 273 | #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) | ||
| 274 | #define SDC_MMC_SUPPORT FALSE | ||
| 275 | #endif | ||
| 276 | |||
| 277 | /** | ||
| 278 | * @brief Delays insertions. | ||
| 279 | * @details If enabled this options inserts delays into the MMC waiting | ||
| 280 | * routines releasing some extra CPU time for the threads with | ||
| 281 | * lower priority, this may slow down the driver a bit however. | ||
| 282 | */ | ||
| 283 | #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) | ||
| 284 | #define SDC_NICE_WAITING TRUE | ||
| 285 | #endif | ||
| 286 | |||
| 287 | /*===========================================================================*/ | ||
| 288 | /* SERIAL driver related settings. */ | ||
| 289 | /*===========================================================================*/ | ||
| 290 | |||
| 291 | /** | ||
| 292 | * @brief Default bit rate. | ||
| 293 | * @details Configuration parameter, this is the baud rate selected for the | ||
| 294 | * default configuration. | ||
| 295 | */ | ||
| 296 | #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) | ||
| 297 | #define SERIAL_DEFAULT_BITRATE 38400 | ||
| 298 | #endif | ||
| 299 | |||
| 300 | /** | ||
| 301 | * @brief Serial buffers size. | ||
| 302 | * @details Configuration parameter, you can change the depth of the queue | ||
| 303 | * buffers depending on the requirements of your application. | ||
| 304 | * @note The default is 16 bytes for both the transmission and receive | ||
| 305 | * buffers. | ||
| 306 | */ | ||
| 307 | #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
| 308 | #define SERIAL_BUFFERS_SIZE 16 | ||
| 309 | #endif | ||
| 310 | |||
| 311 | /*===========================================================================*/ | ||
| 312 | /* SERIAL_USB driver related setting. */ | ||
| 313 | /*===========================================================================*/ | ||
| 314 | |||
| 315 | /** | ||
| 316 | * @brief Serial over USB buffers size. | ||
| 317 | * @details Configuration parameter, the buffer size must be a multiple of | ||
| 318 | * the USB data endpoint maximum packet size. | ||
| 319 | * @note The default is 256 bytes for both the transmission and receive | ||
| 320 | * buffers. | ||
| 321 | */ | ||
| 322 | #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
| 323 | #define SERIAL_USB_BUFFERS_SIZE 1 | ||
| 324 | #endif | ||
| 325 | |||
| 326 | /** | ||
| 327 | * @brief Serial over USB number of buffers. | ||
| 328 | * @note The default is 2 buffers. | ||
| 329 | */ | ||
| 330 | #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) | ||
| 331 | #define SERIAL_USB_BUFFERS_NUMBER 2 | ||
| 332 | #endif | ||
| 333 | |||
| 334 | /*===========================================================================*/ | ||
| 335 | /* SPI driver related settings. */ | ||
| 336 | /*===========================================================================*/ | ||
| 337 | |||
| 338 | /** | ||
| 339 | * @brief Enables synchronous APIs. | ||
| 340 | * @note Disabling this option saves both code and data space. | ||
| 341 | */ | ||
| 342 | #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) | ||
| 343 | #define SPI_USE_WAIT TRUE | ||
| 344 | #endif | ||
| 345 | |||
| 346 | /** | ||
| 347 | * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. | ||
| 348 | * @note Disabling this option saves both code and data space. | ||
| 349 | */ | ||
| 350 | #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
| 351 | #define SPI_USE_MUTUAL_EXCLUSION TRUE | ||
| 352 | #endif | ||
| 353 | |||
| 354 | /*===========================================================================*/ | ||
| 355 | /* UART driver related settings. */ | ||
| 356 | /*===========================================================================*/ | ||
| 357 | |||
| 358 | /** | ||
| 359 | * @brief Enables synchronous APIs. | ||
| 360 | * @note Disabling this option saves both code and data space. | ||
| 361 | */ | ||
| 362 | #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) | ||
| 363 | #define UART_USE_WAIT FALSE | ||
| 364 | #endif | ||
| 365 | |||
| 366 | /** | ||
| 367 | * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. | ||
| 368 | * @note Disabling this option saves both code and data space. | ||
| 369 | */ | ||
| 370 | #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
| 371 | #define UART_USE_MUTUAL_EXCLUSION FALSE | ||
| 372 | #endif | ||
| 373 | |||
| 374 | /*===========================================================================*/ | ||
| 375 | /* USB driver related settings. */ | ||
| 376 | /*===========================================================================*/ | ||
| 377 | |||
| 378 | /** | ||
| 379 | * @brief Enables synchronous APIs. | ||
| 380 | * @note Disabling this option saves both code and data space. | ||
| 381 | */ | ||
| 382 | #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) | ||
| 383 | #define USB_USE_WAIT TRUE | ||
| 384 | #endif | ||
| 385 | |||
| 386 | #endif /* HALCONF_H */ | ||
| 387 | |||
| 388 | /** @} */ | ||
diff --git a/keyboards/hadron/ver3/keymaps/default/config.h b/keyboards/hadron/ver3/keymaps/default/config.h new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/keyboards/hadron/ver3/keymaps/default/config.h | |||
| @@ -0,0 +1 @@ | |||
| #pragma once | |||
diff --git a/keyboards/hadron/ver3/keymaps/default/keymap.c b/keyboards/hadron/ver3/keymaps/default/keymap.c new file mode 100644 index 000000000..11761b321 --- /dev/null +++ b/keyboards/hadron/ver3/keymaps/default/keymap.c | |||
| @@ -0,0 +1,295 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | |||
| 3 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 4 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 5 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 6 | // entirely and just use numbers. | ||
| 7 | #define _QWERTY 0 | ||
| 8 | #define _COLEMAK 1 | ||
| 9 | #define _DVORAK 2 | ||
| 10 | #define _LOWER 3 | ||
| 11 | #define _RAISE 4 | ||
| 12 | #define _MOUSECURSOR 8 | ||
| 13 | #define _ADJUST 16 | ||
| 14 | |||
| 15 | enum preonic_keycodes { | ||
| 16 | QWERTY = SAFE_RANGE, | ||
| 17 | COLEMAK, | ||
| 18 | DVORAK, | ||
| 19 | LOWER, | ||
| 20 | RAISE, | ||
| 21 | BACKLIT, | ||
| 22 | RGBLED_TOGGLE, | ||
| 23 | RGBLED_STEP_MODE, | ||
| 24 | RGBLED_INCREASE_HUE, | ||
| 25 | RGBLED_DECREASE_HUE, | ||
| 26 | RGBLED_INCREASE_SAT, | ||
| 27 | RGBLED_DECREASE_SAT, | ||
| 28 | RGBLED_INCREASE_VAL, | ||
| 29 | RGBLED_DECREASE_VAL, | ||
| 30 | }; | ||
| 31 | |||
| 32 | enum macro_keycodes { | ||
| 33 | KC_DEMOMACRO, | ||
| 34 | }; | ||
| 35 | |||
| 36 | // Fillers to make layering more clear | ||
| 37 | #define _______ KC_TRNS | ||
| 38 | #define XXXXXXX KC_NO | ||
| 39 | // Custom macros | ||
| 40 | #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl | ||
| 41 | #define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl | ||
| 42 | #define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl | ||
| 43 | #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift | ||
| 44 | // Requires KC_TRNS/_______ for the trigger key in the destination layer | ||
| 45 | #define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor | ||
| 46 | #define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise | ||
| 47 | #define DEMOMACRO M(KC_DEMOMACRO) // Sample for macros | ||
| 48 | |||
| 49 | |||
| 50 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 51 | |||
| 52 | /* Qwerty | ||
| 53 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 54 | * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | DEL | | ||
| 55 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 56 | * | Tab | Q | W | E | R | T | 7 | 8 | 9 | Y | U | I | O | P | Bksp | | ||
| 57 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 58 | * | CAPS | A | S | D | F | G | 4 | 5 | 6 | H | J | K | L | ;/Nav| ' | | ||
| 59 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 60 | * | Shift| Z | X | C | V | B | 1 | 2 | 3 | N | M | , | . | / |Ctl/Et| | ||
| 61 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 62 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 63 | * `--------------------------------------------------------------------------------------------------------' | ||
| 64 | */ | ||
| 65 | [_QWERTY] = LAYOUT( | ||
| 66 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 67 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_P7, KC_P8, KC_P9, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | ||
| 68 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_P4, KC_P5, KC_P6, KC_H, KC_J, KC_K, KC_L,LT_MC(KC_SCLN), KC_QUOT, \ | ||
| 69 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, CTL_ENT, \ | ||
| 70 | KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT,KC_DOWN, KC_UP, KC_RGHT \ | ||
| 71 | ), | ||
| 72 | |||
| 73 | /* Colemak | ||
| 74 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 75 | * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | 0 | - | | ||
| 76 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 77 | * | Tab | Q | W | F | P | G | 7 | 8 | 9 | J | L | U | Y | ; | Bksp | | ||
| 78 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 79 | * | CAPS | A | R | S | T | D | 4 | 5 | 6 | H | N | E | I | O | ' | | ||
| 80 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 81 | * | Shift| Z | X | C | V | B | 1 | 2 | 3 | K | M | , | . | / |Ctl/Et| | ||
| 82 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 83 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 84 | * `--------------------------------------------------------------------------------------------------------' | ||
| 85 | */ | ||
| 86 | [_COLEMAK] = LAYOUT( | ||
| 87 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 88 | KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_P7, KC_P8, KC_P9, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ | ||
| 89 | KC_LCTRL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_P4, KC_P5, KC_P6, KC_H, KC_N, KC_E, KC_I, LT_MC(KC_O), KC_QUOT, \ | ||
| 90 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, CTL_ENT, \ | ||
| 91 | KC_GRV, KC_CAPS, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
| 92 | ), | ||
| 93 | |||
| 94 | /* Dvorak | ||
| 95 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 96 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 97 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 98 | * | Tab | " | , | . | P | Y | 7 | 8 | 9 | F | G | C | R | L | Bksp | | ||
| 99 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 100 | * | Esc | A | O | E | U | I | 4 | 5 | 6 | D | H | T | N | S | / | | ||
| 101 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 102 | * | Shift| ; | Q | J | K | X | 1 | 2 | 3 | B | M | W | V | Z |Ctl/Et| | ||
| 103 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 104 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 105 | * `--------------------------------------------------------------------------------------------------------' | ||
| 106 | */ | ||
| 107 | [_DVORAK] = LAYOUT( | ||
| 108 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 109 | KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_P7, KC_P8, KC_P9, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ | ||
| 110 | KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_P4, KC_P5, KC_P6, KC_D, KC_H, KC_T, KC_N, LT_MC(KC_S), KC_SLSH, \ | ||
| 111 | KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_P1, KC_P2, KC_P3, KC_B, KC_M, KC_W, KC_V, KC_Z, CTL_ENT, \ | ||
| 112 | KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
| 113 | ), | ||
| 114 | |||
| 115 | /* Lower | ||
| 116 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 117 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
| 118 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 119 | * | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | Del | | ||
| 120 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 121 | * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | _ | + | { | } | | | | ||
| 122 | * |------+------+------+------+------+------|------+------+------+------+------+------+------+------+------| | ||
| 123 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | | | | | ||
| 124 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 125 | * | | | | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 126 | * `--------------------------------------------------------------------------------------------------------' | ||
| 127 | */ | ||
| 128 | [_LOWER] = LAYOUT( | ||
| 129 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ | ||
| 130 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ | ||
| 131 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, \ | ||
| 132 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, \ | ||
| 133 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
| 134 | ), | ||
| 135 | |||
| 136 | /* Raise | ||
| 137 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 138 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 139 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 140 | * | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Del | | ||
| 141 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 142 | * | Del | F1 | F2 | F3 | F4 | F5 | | | | F6 | - | = | [ | ] | \ | | ||
| 143 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 144 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / | | | | | ||
| 145 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 146 | * | | | | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 147 | * `--------------------------------------------------------------------------------------------------------' | ||
| 148 | */ | ||
| 149 | [_RAISE] = LAYOUT( | ||
| 150 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ | ||
| 151 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ | ||
| 152 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | ||
| 153 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ | ||
| 154 | _______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
| 155 | ), | ||
| 156 | |||
| 157 | /* Mouse Layer (semi-col) | ||
| 158 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 159 | * | ACCL0| ACCL1| ACCL2| | | | | | | | | | | ||
| 160 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 161 | * | | | | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| Macro| | | ||
| 162 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 163 | * | | | | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | ||
| 164 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 165 | * | | | | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | ||
| 166 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 167 | * | | | | | | BTN1 | | | | BTN1 | | | | | | | ||
| 168 | * `--------------------------------------------------------------------------------------------------------' | ||
| 169 | */ | ||
| 170 | |||
| 171 | [_MOUSECURSOR] = LAYOUT( | ||
| 172 | KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 173 | _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, \ | ||
| 174 | _______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, \ | ||
| 175 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, \ | ||
| 176 | _______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ \ | ||
| 177 | ), | ||
| 178 | |||
| 179 | /* Adjust (Lower + Raise) | ||
| 180 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 181 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 182 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 183 | * | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del | | ||
| 184 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 185 | * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | | | ||
| 186 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 187 | * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG | | ||
| 188 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 189 | * | | | | | | | | | | | | | | | | | ||
| 190 | * `--------------------------------------------------------------------------------------------------------' | ||
| 191 | */ | ||
| 192 | [_ADJUST] = LAYOUT( | ||
| 193 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | ||
| 194 | RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \ | ||
| 195 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \ | ||
| 196 | _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \ | ||
| 197 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CK_RST, CK_DOWN, CK_UP, CK_TOGG\ | ||
| 198 | ) | ||
| 199 | |||
| 200 | |||
| 201 | |||
| 202 | }; | ||
| 203 | |||
| 204 | uint32_t layer_state_set_user(uint32_t state) { | ||
| 205 | return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); | ||
| 206 | } | ||
| 207 | |||
| 208 | |||
| 209 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 210 | switch (keycode) { | ||
| 211 | case QWERTY: | ||
| 212 | if (record->event.pressed) { | ||
| 213 | set_single_persistent_default_layer(_QWERTY); | ||
| 214 | } | ||
| 215 | return false; | ||
| 216 | break; | ||
| 217 | case COLEMAK: | ||
| 218 | if (record->event.pressed) { | ||
| 219 | set_single_persistent_default_layer(_COLEMAK); | ||
| 220 | } | ||
| 221 | return false; | ||
| 222 | break; | ||
| 223 | case LOWER: | ||
| 224 | if (record->event.pressed) { | ||
| 225 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 226 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 227 | layer_on(_LOWER); | ||
| 228 | } else { | ||
| 229 | layer_off(_LOWER); | ||
| 230 | } | ||
| 231 | return false; | ||
| 232 | break; | ||
| 233 | case RAISE: | ||
| 234 | if (record->event.pressed) { | ||
| 235 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 236 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 237 | layer_on(_RAISE); | ||
| 238 | } else { | ||
| 239 | layer_off(_RAISE); | ||
| 240 | } | ||
| 241 | return false; | ||
| 242 | break; | ||
| 243 | case BACKLIT: | ||
| 244 | if (record->event.pressed) { | ||
| 245 | register_code(KC_RSFT); | ||
| 246 | #ifdef BACKLIGHT_ENABLE | ||
| 247 | backlight_step(); | ||
| 248 | #endif | ||
| 249 | } else { | ||
| 250 | unregister_code(KC_RSFT); | ||
| 251 | } | ||
| 252 | return false; | ||
| 253 | break; | ||
| 254 | } | ||
| 255 | return true; | ||
| 256 | } | ||
| 257 | |||
| 258 | bool music_mask_user(uint16_t keycode) { | ||
| 259 | switch (keycode) { | ||
| 260 | case RAISE: | ||
| 261 | case LOWER: | ||
| 262 | return false; | ||
| 263 | default: | ||
| 264 | return true; | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 268 | |||
| 269 | /* | ||
| 270 | * Macro definition | ||
| 271 | */ | ||
| 272 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 273 | { | ||
| 274 | if (!eeconfig_is_enabled()) { | ||
| 275 | eeconfig_init(); | ||
| 276 | } | ||
| 277 | |||
| 278 | switch (id) { | ||
| 279 | case KC_DEMOMACRO: | ||
| 280 | if (record->event.pressed){ | ||
| 281 | return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END); | ||
| 282 | } | ||
| 283 | } | ||
| 284 | |||
| 285 | return MACRO_NONE; | ||
| 286 | } | ||
| 287 | |||
| 288 | |||
| 289 | void matrix_init_user(void) { | ||
| 290 | } | ||
| 291 | |||
| 292 | |||
| 293 | void matrix_scan_user(void) { | ||
| 294 | } | ||
| 295 | |||
diff --git a/keyboards/hadron/ver3/keymaps/default/readme.md b/keyboards/hadron/ver3/keymaps/default/readme.md new file mode 100644 index 000000000..88b958ec4 --- /dev/null +++ b/keyboards/hadron/ver3/keymaps/default/readme.md | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | # The Default Hadron Layout | ||
| 2 | |||
diff --git a/keyboards/hadron/ver3/keymaps/readme.md b/keyboards/hadron/ver3/keymaps/readme.md new file mode 100644 index 000000000..54fb5f6d9 --- /dev/null +++ b/keyboards/hadron/ver3/keymaps/readme.md | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | # How to add your own keymap | ||
| 2 | |||
| 3 | Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`: | ||
| 4 | |||
| 5 | _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author] | ||
| 6 | |||
| 7 | \* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements | ||
| 8 | |||
| 9 | and contain the following files: | ||
| 10 | |||
| 11 | * `keymap.c` | ||
| 12 | * `readme.md` *recommended* | ||
| 13 | * `config.h` *optional*, found automatically when compiling | ||
| 14 | * `Makefile` *optional*, found automatically when compling | ||
| 15 | |||
| 16 | When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format: | ||
| 17 | |||
| 18 | * **folder_name** description | ||
| 19 | |||
| 20 | # List of Planck keymaps | ||
| 21 | |||
| 22 | * **default** default Planck layout | ||
| 23 | * **cbbrowne** cbbrowne's Planck layout \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver3/matrix.c b/keyboards/hadron/ver3/matrix.c new file mode 100644 index 000000000..329d1328a --- /dev/null +++ b/keyboards/hadron/ver3/matrix.c | |||
| @@ -0,0 +1,195 @@ | |||
| 1 | #include <string.h> | ||
| 2 | #include "hal.h" | ||
| 3 | #include "timer.h" | ||
| 4 | #include "wait.h" | ||
| 5 | #include "printf.h" | ||
| 6 | #include "backlight.h" | ||
| 7 | #include "matrix.h" | ||
| 8 | #include "action.h" | ||
| 9 | #include "keycode.h" | ||
| 10 | |||
| 11 | /* matrix state(1:on, 0:off) */ | ||
| 12 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 13 | static matrix_row_t matrix_debouncing[MATRIX_COLS]; | ||
| 14 | static bool debouncing = false; | ||
| 15 | static uint16_t debouncing_time = 0; | ||
| 16 | |||
| 17 | static uint8_t encoder_state = 0; | ||
| 18 | static int8_t encoder_value = 0; | ||
| 19 | static int8_t encoder_LUT[] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 }; | ||
| 20 | |||
| 21 | __attribute__ ((weak)) | ||
| 22 | void matrix_init_user(void) {} | ||
| 23 | |||
| 24 | __attribute__ ((weak)) | ||
| 25 | void matrix_scan_user(void) {} | ||
| 26 | |||
| 27 | __attribute__ ((weak)) | ||
| 28 | void matrix_init_kb(void) { | ||
| 29 | matrix_init_user(); | ||
| 30 | } | ||
| 31 | |||
| 32 | __attribute__ ((weak)) | ||
| 33 | void matrix_scan_kb(void) { | ||
| 34 | matrix_scan_user(); | ||
| 35 | } | ||
| 36 | |||
| 37 | void matrix_init(void) { | ||
| 38 | printf("matrix init\n"); | ||
| 39 | //debug_matrix = true; | ||
| 40 | |||
| 41 | // encoder setup | ||
| 42 | palSetPadMode(GPIOB, 13, PAL_MODE_INPUT_PULLUP); | ||
| 43 | palSetPadMode(GPIOB, 14, PAL_MODE_INPUT_PULLUP); | ||
| 44 | |||
| 45 | encoder_state = (palReadPad(GPIOB, 13) << 0) | (palReadPad(GPIOB, 14) << 1); | ||
| 46 | |||
| 47 | // actual matrix setup | ||
| 48 | palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 49 | palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 50 | palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 51 | palSetPadMode(GPIOA, 0, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 52 | palSetPadMode(GPIOA, 1, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 53 | palSetPadMode(GPIOA, 2, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 54 | palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 55 | palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 56 | palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 57 | palSetPadMode(GPIOA, 6, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 58 | palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 59 | palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 60 | palSetPadMode(GPIOC, 13, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 61 | palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 62 | palSetPadMode(GPIOB, 9, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 63 | |||
| 64 | palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLDOWN); | ||
| 65 | palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLDOWN); | ||
| 66 | palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN); | ||
| 67 | palSetPadMode(GPIOA, 9, PAL_MODE_INPUT_PULLDOWN); | ||
| 68 | palSetPadMode(GPIOA, 8, PAL_MODE_INPUT_PULLDOWN); | ||
| 69 | |||
| 70 | |||
| 71 | memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t)); | ||
| 72 | memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t)); | ||
| 73 | |||
| 74 | |||
| 75 | matrix_init_quantum(); | ||
| 76 | } | ||
| 77 | |||
| 78 | __attribute__ ((weak)) | ||
| 79 | void encoder_update(bool clockwise) { } | ||
| 80 | |||
| 81 | #ifndef ENCODER_RESOLUTION | ||
| 82 | #define ENCODER_RESOLUTION 4 | ||
| 83 | #endif | ||
| 84 | |||
| 85 | uint8_t matrix_scan(void) { | ||
| 86 | // encoder on B13 and B14 | ||
| 87 | encoder_state <<= 2; | ||
| 88 | encoder_state |= (palReadPad(GPIOB, 13) << 0) | (palReadPad(GPIOB, 14) << 1); | ||
| 89 | encoder_value += encoder_LUT[encoder_state & 0xF]; | ||
| 90 | if (encoder_value >= ENCODER_RESOLUTION) { | ||
| 91 | encoder_update(0); | ||
| 92 | } | ||
| 93 | if (encoder_value <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise | ||
| 94 | encoder_update(1); | ||
| 95 | } | ||
| 96 | encoder_value %= ENCODER_RESOLUTION; | ||
| 97 | |||
| 98 | // actual matrix | ||
| 99 | for (int col = 0; col < MATRIX_COLS; col++) { | ||
| 100 | matrix_row_t data = 0; | ||
| 101 | |||
| 102 | // strobe col { PB8, PB2, PB10, PA0, PA1, PA2, PB0, PA3, PB1, PA6, PA7, PB1, PA6, PA7, PB12, PC3, PB11, } | ||
| 103 | switch (col) { | ||
| 104 | case 0: palSetPad(GPIOB, 8); break; | ||
| 105 | case 1: palSetPad(GPIOB, 2); break; | ||
| 106 | case 2: palSetPad(GPIOB, 10); break; | ||
| 107 | case 3: palSetPad(GPIOA, 0); break; | ||
| 108 | case 4: palSetPad(GPIOA, 1); break; | ||
| 109 | case 5: palSetPad(GPIOA, 2); break; | ||
| 110 | case 6: palSetPad(GPIOB, 0); break; | ||
| 111 | case 7: palSetPad(GPIOA, 3); break; | ||
| 112 | case 8: palSetPad(GPIOB, 1); break; | ||
| 113 | case 9: palSetPad(GPIOA, 6); break; | ||
| 114 | case 10: palSetPad(GPIOA, 7); break; | ||
| 115 | case 11: palSetPad(GPIOB, 12); break; | ||
| 116 | case 12: palSetPad(GPIOC, 13); break; | ||
| 117 | case 13: palSetPad(GPIOB, 11); break; | ||
| 118 | case 14: palSetPad(GPIOB, 9); break; | ||
| 119 | } | ||
| 120 | |||
| 121 | // need wait to settle pin state | ||
| 122 | wait_us(20); | ||
| 123 | |||
| 124 | // read row data { PC15, PC14, PA10, PA9, PA8 } | ||
| 125 | data = ( | ||
| 126 | (palReadPad(GPIOC, 15) << 0 ) | | ||
| 127 | (palReadPad(GPIOC, 14) << 1 ) | | ||
| 128 | (palReadPad(GPIOA, 10) << 2 ) | | ||
| 129 | (palReadPad(GPIOA, 9) << 3 ) | | ||
| 130 | (palReadPad(GPIOA, 8) << 4 ) | ||
| 131 | ); | ||
| 132 | |||
| 133 | // unstrobe col { PB8, PB2, PB10, PA0, PA1, PA2, PB0, PA3, PB1, PA6, PA7, PB1, PA6, PA7, PB12, PC3, PB11, } | ||
| 134 | switch (col) { | ||
| 135 | case 0: palClearPad(GPIOB, 8); break; | ||
| 136 | case 1: palClearPad(GPIOB, 2); break; | ||
| 137 | case 2: palClearPad(GPIOB, 10); break; | ||
| 138 | case 3: palClearPad(GPIOA, 0); break; | ||
| 139 | case 4: palClearPad(GPIOA, 1); break; | ||
| 140 | case 5: palClearPad(GPIOA, 2); break; | ||
| 141 | case 6: palClearPad(GPIOB, 0); break; | ||
| 142 | case 7: palClearPad(GPIOA, 3); break; | ||
| 143 | case 8: palClearPad(GPIOB, 1); break; | ||
| 144 | case 9: palClearPad(GPIOA, 6); break; | ||
| 145 | case 10: palClearPad(GPIOA, 7); break; | ||
| 146 | case 11: palClearPad(GPIOB, 12); break; | ||
| 147 | case 12: palClearPad(GPIOC, 13); break; | ||
| 148 | case 13: palClearPad(GPIOB, 11); break; | ||
| 149 | case 14: palClearPad(GPIOB, 9); break; | ||
| 150 | } | ||
| 151 | |||
| 152 | if (matrix_debouncing[col] != data) { | ||
| 153 | matrix_debouncing[col] = data; | ||
| 154 | debouncing = true; | ||
| 155 | debouncing_time = timer_read(); | ||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { | ||
| 160 | for (int row = 0; row < MATRIX_ROWS; row++) { | ||
| 161 | matrix[row] = 0; | ||
| 162 | for (int col = 0; col < MATRIX_COLS; col++) { | ||
| 163 | matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col); | ||
| 164 | } | ||
| 165 | } | ||
| 166 | debouncing = false; | ||
| 167 | } | ||
| 168 | |||
| 169 | matrix_scan_quantum(); | ||
| 170 | |||
| 171 | return 1; | ||
| 172 | } | ||
| 173 | |||
| 174 | bool matrix_is_on(uint8_t row, uint8_t col) { | ||
| 175 | return (matrix[row] & (1<<col)); | ||
| 176 | } | ||
| 177 | |||
| 178 | matrix_row_t matrix_get_row(uint8_t row) { | ||
| 179 | return matrix[row]; | ||
| 180 | } | ||
| 181 | |||
| 182 | void matrix_print(void) { | ||
| 183 | printf("\nr/c 01234567\n"); | ||
| 184 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 185 | printf("%X0: ", row); | ||
| 186 | matrix_row_t data = matrix_get_row(row); | ||
| 187 | for (int col = 0; col < MATRIX_COLS; col++) { | ||
| 188 | if (data & (1<<col)) | ||
| 189 | printf("1"); | ||
| 190 | else | ||
| 191 | printf("0"); | ||
| 192 | } | ||
| 193 | printf("\n"); | ||
| 194 | } | ||
| 195 | } | ||
diff --git a/keyboards/hadron/ver3/mcuconf.h b/keyboards/hadron/ver3/mcuconf.h new file mode 100644 index 000000000..36f8ca225 --- /dev/null +++ b/keyboards/hadron/ver3/mcuconf.h | |||
| @@ -0,0 +1,257 @@ | |||
| 1 | /* | ||
| 2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
| 3 | |||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | you may not use this file except in compliance with the License. | ||
| 6 | You may obtain a copy of the License at | ||
| 7 | |||
| 8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | |||
| 10 | Unless required by applicable law or agreed to in writing, software | ||
| 11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | See the License for the specific language governing permissions and | ||
| 14 | limitations under the License. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef MCUCONF_H | ||
| 18 | #define MCUCONF_H | ||
| 19 | |||
| 20 | /* | ||
| 21 | * STM32F3xx drivers configuration. | ||
| 22 | * The following settings override the default settings present in | ||
| 23 | * the various device driver implementation headers. | ||
| 24 | * Note that the settings for each driver only have effect if the whole | ||
| 25 | * driver is enabled in halconf.h. | ||
| 26 | * | ||
| 27 | * IRQ priorities: | ||
| 28 | * 15...0 Lowest...Highest. | ||
| 29 | * | ||
| 30 | * DMA priorities: | ||
| 31 | * 0...3 Lowest...Highest. | ||
| 32 | */ | ||
| 33 | |||
| 34 | #define STM32F3xx_MCUCONF | ||
| 35 | |||
| 36 | /* | ||
| 37 | * HAL driver system settings. | ||
| 38 | */ | ||
| 39 | #define STM32_NO_INIT FALSE | ||
| 40 | #define STM32_PVD_ENABLE FALSE | ||
| 41 | #define STM32_PLS STM32_PLS_LEV0 | ||
| 42 | #define STM32_HSI_ENABLED TRUE | ||
| 43 | #define STM32_LSI_ENABLED TRUE | ||
| 44 | #define STM32_HSE_ENABLED TRUE | ||
| 45 | #define STM32_LSE_ENABLED FALSE | ||
| 46 | #define STM32_SW STM32_SW_PLL | ||
| 47 | #define STM32_PLLSRC STM32_PLLSRC_HSE | ||
| 48 | #define STM32_PREDIV_VALUE 1 | ||
| 49 | #define STM32_PLLMUL_VALUE 9 | ||
| 50 | #define STM32_HPRE STM32_HPRE_DIV1 | ||
| 51 | #define STM32_PPRE1 STM32_PPRE1_DIV2 | ||
| 52 | #define STM32_PPRE2 STM32_PPRE2_DIV2 | ||
| 53 | #define STM32_MCOSEL STM32_MCOSEL_NOCLOCK | ||
| 54 | #define STM32_ADC12PRES STM32_ADC12PRES_DIV1 | ||
| 55 | #define STM32_ADC34PRES STM32_ADC34PRES_DIV1 | ||
| 56 | #define STM32_USART1SW STM32_USART1SW_PCLK | ||
| 57 | #define STM32_USART2SW STM32_USART2SW_PCLK | ||
| 58 | #define STM32_USART3SW STM32_USART3SW_PCLK | ||
| 59 | #define STM32_UART4SW STM32_UART4SW_PCLK | ||
| 60 | #define STM32_UART5SW STM32_UART5SW_PCLK | ||
| 61 | #define STM32_I2C1SW STM32_I2C1SW_SYSCLK | ||
| 62 | #define STM32_I2C2SW STM32_I2C2SW_SYSCLK | ||
| 63 | #define STM32_TIM1SW STM32_TIM1SW_PCLK2 | ||
| 64 | #define STM32_TIM8SW STM32_TIM8SW_PCLK2 | ||
| 65 | #define STM32_RTCSEL STM32_RTCSEL_LSI | ||
| 66 | #define STM32_USB_CLOCK_REQUIRED TRUE | ||
| 67 | #define STM32_USBPRE STM32_USBPRE_DIV1P5 | ||
| 68 | |||
| 69 | #undef STM32_HSE_BYPASS | ||
| 70 | // #error "oh no" | ||
| 71 | // #endif | ||
| 72 | |||
| 73 | /* | ||
| 74 | * ADC driver system settings. | ||
| 75 | */ | ||
| 76 | #define STM32_ADC_DUAL_MODE FALSE | ||
| 77 | #define STM32_ADC_COMPACT_SAMPLES FALSE | ||
| 78 | #define STM32_ADC_USE_ADC1 FALSE | ||
| 79 | #define STM32_ADC_USE_ADC2 FALSE | ||
| 80 | #define STM32_ADC_USE_ADC3 FALSE | ||
| 81 | #define STM32_ADC_USE_ADC4 FALSE | ||
| 82 | #define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) | ||
| 83 | #define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) | ||
| 84 | #define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) | ||
| 85 | #define STM32_ADC_ADC4_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) | ||
| 86 | #define STM32_ADC_ADC1_DMA_PRIORITY 2 | ||
| 87 | #define STM32_ADC_ADC2_DMA_PRIORITY 2 | ||
| 88 | #define STM32_ADC_ADC3_DMA_PRIORITY 2 | ||
| 89 | #define STM32_ADC_ADC4_DMA_PRIORITY 2 | ||
| 90 | #define STM32_ADC_ADC12_IRQ_PRIORITY 5 | ||
| 91 | #define STM32_ADC_ADC3_IRQ_PRIORITY 5 | ||
| 92 | #define STM32_ADC_ADC4_IRQ_PRIORITY 5 | ||
| 93 | #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 5 | ||
| 94 | #define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 5 | ||
| 95 | #define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 5 | ||
| 96 | #define STM32_ADC_ADC4_DMA_IRQ_PRIORITY 5 | ||
| 97 | #define STM32_ADC_ADC12_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1 | ||
| 98 | #define STM32_ADC_ADC34_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1 | ||
| 99 | |||
| 100 | /* | ||
| 101 | * CAN driver system settings. | ||
| 102 | */ | ||
| 103 | #define STM32_CAN_USE_CAN1 FALSE | ||
| 104 | #define STM32_CAN_CAN1_IRQ_PRIORITY 11 | ||
| 105 | |||
| 106 | /* | ||
| 107 | * DAC driver system settings. | ||
| 108 | */ | ||
| 109 | #define STM32_DAC_DUAL_MODE FALSE | ||
| 110 | #define STM32_DAC_USE_DAC1_CH1 TRUE | ||
| 111 | #define STM32_DAC_USE_DAC1_CH2 TRUE | ||
| 112 | #define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10 | ||
| 113 | #define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10 | ||
| 114 | #define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 | ||
| 115 | #define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 | ||
| 116 | |||
| 117 | /* | ||
| 118 | * EXT driver system settings. | ||
| 119 | */ | ||
| 120 | #define STM32_EXT_EXTI0_IRQ_PRIORITY 6 | ||
| 121 | #define STM32_EXT_EXTI1_IRQ_PRIORITY 6 | ||
| 122 | #define STM32_EXT_EXTI2_IRQ_PRIORITY 6 | ||
| 123 | #define STM32_EXT_EXTI3_IRQ_PRIORITY 6 | ||
| 124 | #define STM32_EXT_EXTI4_IRQ_PRIORITY 6 | ||
| 125 | #define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6 | ||
| 126 | #define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6 | ||
| 127 | #define STM32_EXT_EXTI16_IRQ_PRIORITY 6 | ||
| 128 | #define STM32_EXT_EXTI17_IRQ_PRIORITY 6 | ||
| 129 | #define STM32_EXT_EXTI18_IRQ_PRIORITY 6 | ||
| 130 | #define STM32_EXT_EXTI19_IRQ_PRIORITY 6 | ||
| 131 | #define STM32_EXT_EXTI20_IRQ_PRIORITY 6 | ||
| 132 | #define STM32_EXT_EXTI21_22_29_IRQ_PRIORITY 6 | ||
| 133 | #define STM32_EXT_EXTI30_32_IRQ_PRIORITY 6 | ||
| 134 | #define STM32_EXT_EXTI33_IRQ_PRIORITY 6 | ||
| 135 | |||
| 136 | /* | ||
| 137 | * GPT driver system settings. | ||
| 138 | */ | ||
| 139 | #define STM32_GPT_USE_TIM1 FALSE | ||
| 140 | #define STM32_GPT_USE_TIM2 FALSE | ||
| 141 | #define STM32_GPT_USE_TIM3 FALSE | ||
| 142 | #define STM32_GPT_USE_TIM4 FALSE | ||
| 143 | #define STM32_GPT_USE_TIM6 TRUE | ||
| 144 | #define STM32_GPT_USE_TIM7 TRUE | ||
| 145 | #define STM32_GPT_USE_TIM8 TRUE | ||
| 146 | #define STM32_GPT_TIM1_IRQ_PRIORITY 7 | ||
| 147 | #define STM32_GPT_TIM2_IRQ_PRIORITY 7 | ||
| 148 | #define STM32_GPT_TIM3_IRQ_PRIORITY 7 | ||
| 149 | #define STM32_GPT_TIM4_IRQ_PRIORITY 7 | ||
| 150 | #define STM32_GPT_TIM6_IRQ_PRIORITY 7 | ||
| 151 | #define STM32_GPT_TIM7_IRQ_PRIORITY 7 | ||
| 152 | #define STM32_GPT_TIM8_IRQ_PRIORITY 7 | ||
| 153 | |||
| 154 | /* | ||
| 155 | * I2C driver system settings. | ||
| 156 | */ | ||
| 157 | #define STM32_I2C_USE_I2C1 TRUE | ||
| 158 | #define STM32_I2C_USE_I2C2 FALSE | ||
| 159 | #define STM32_I2C_BUSY_TIMEOUT 50 | ||
| 160 | #define STM32_I2C_I2C1_IRQ_PRIORITY 10 | ||
| 161 | #define STM32_I2C_I2C2_IRQ_PRIORITY 10 | ||
| 162 | #define STM32_I2C_USE_DMA TRUE | ||
| 163 | #define STM32_I2C_I2C1_DMA_PRIORITY 1 | ||
| 164 | #define STM32_I2C_I2C2_DMA_PRIORITY 1 | ||
| 165 | #define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") | ||
| 166 | |||
| 167 | /* | ||
| 168 | * ICU driver system settings. | ||
| 169 | */ | ||
| 170 | #define STM32_ICU_USE_TIM1 FALSE | ||
| 171 | #define STM32_ICU_USE_TIM2 FALSE | ||
| 172 | #define STM32_ICU_USE_TIM3 FALSE | ||
| 173 | #define STM32_ICU_USE_TIM4 FALSE | ||
| 174 | #define STM32_ICU_USE_TIM8 FALSE | ||
| 175 | #define STM32_ICU_TIM1_IRQ_PRIORITY 7 | ||
| 176 | #define STM32_ICU_TIM2_IRQ_PRIORITY 7 | ||
| 177 | #define STM32_ICU_TIM3_IRQ_PRIORITY 7 | ||
| 178 | #define STM32_ICU_TIM4_IRQ_PRIORITY 7 | ||
| 179 | #define STM32_ICU_TIM8_IRQ_PRIORITY 7 | ||
| 180 | |||
| 181 | /* | ||
| 182 | * PWM driver system settings. | ||
| 183 | */ | ||
| 184 | #define STM32_PWM_USE_ADVANCED FALSE | ||
| 185 | #define STM32_PWM_USE_TIM1 FALSE | ||
| 186 | #define STM32_PWM_USE_TIM2 TRUE | ||
| 187 | #define STM32_PWM_USE_TIM3 TRUE | ||
| 188 | #define STM32_PWM_USE_TIM4 FALSE | ||
| 189 | #define STM32_PWM_USE_TIM8 FALSE | ||
| 190 | #define STM32_PWM_TIM1_IRQ_PRIORITY 7 | ||
| 191 | #define STM32_PWM_TIM2_IRQ_PRIORITY 7 | ||
| 192 | #define STM32_PWM_TIM3_IRQ_PRIORITY 7 | ||
| 193 | #define STM32_PWM_TIM4_IRQ_PRIORITY 7 | ||
| 194 | #define STM32_PWM_TIM8_IRQ_PRIORITY 7 | ||
| 195 | |||
| 196 | /* | ||
| 197 | * SERIAL driver system settings. | ||
| 198 | */ | ||
| 199 | #define STM32_SERIAL_USE_USART1 FALSE | ||
| 200 | #define STM32_SERIAL_USE_USART2 TRUE | ||
| 201 | #define STM32_SERIAL_USE_USART3 FALSE | ||
| 202 | #define STM32_SERIAL_USE_UART4 FALSE | ||
| 203 | #define STM32_SERIAL_USE_UART5 FALSE | ||
| 204 | #define STM32_SERIAL_USART1_PRIORITY 12 | ||
| 205 | #define STM32_SERIAL_USART2_PRIORITY 12 | ||
| 206 | #define STM32_SERIAL_USART3_PRIORITY 12 | ||
| 207 | #define STM32_SERIAL_UART4_PRIORITY 12 | ||
| 208 | #define STM32_SERIAL_UART5_PRIORITY 12 | ||
| 209 | |||
| 210 | /* | ||
| 211 | * SPI driver system settings. | ||
| 212 | */ | ||
| 213 | #define STM32_SPI_USE_SPI1 FALSE | ||
| 214 | #define STM32_SPI_USE_SPI2 FALSE | ||
| 215 | #define STM32_SPI_USE_SPI3 FALSE | ||
| 216 | #define STM32_SPI_SPI1_DMA_PRIORITY 1 | ||
| 217 | #define STM32_SPI_SPI2_DMA_PRIORITY 1 | ||
| 218 | #define STM32_SPI_SPI3_DMA_PRIORITY 1 | ||
| 219 | #define STM32_SPI_SPI1_IRQ_PRIORITY 10 | ||
| 220 | #define STM32_SPI_SPI2_IRQ_PRIORITY 10 | ||
| 221 | #define STM32_SPI_SPI3_IRQ_PRIORITY 10 | ||
| 222 | #define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") | ||
| 223 | |||
| 224 | /* | ||
| 225 | * ST driver system settings. | ||
| 226 | */ | ||
| 227 | #define STM32_ST_IRQ_PRIORITY 8 | ||
| 228 | #define STM32_ST_USE_TIMER 2 | ||
| 229 | |||
| 230 | /* | ||
| 231 | * UART driver system settings. | ||
| 232 | */ | ||
| 233 | #define STM32_UART_USE_USART1 FALSE | ||
| 234 | #define STM32_UART_USE_USART2 FALSE | ||
| 235 | #define STM32_UART_USE_USART3 FALSE | ||
| 236 | #define STM32_UART_USART1_IRQ_PRIORITY 12 | ||
| 237 | #define STM32_UART_USART2_IRQ_PRIORITY 12 | ||
| 238 | #define STM32_UART_USART3_IRQ_PRIORITY 12 | ||
| 239 | #define STM32_UART_USART1_DMA_PRIORITY 0 | ||
| 240 | #define STM32_UART_USART2_DMA_PRIORITY 0 | ||
| 241 | #define STM32_UART_USART3_DMA_PRIORITY 0 | ||
| 242 | #define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") | ||
| 243 | |||
| 244 | /* | ||
| 245 | * USB driver system settings. | ||
| 246 | */ | ||
| 247 | #define STM32_USB_USE_USB1 TRUE | ||
| 248 | #define STM32_USB_LOW_POWER_ON_SUSPEND FALSE | ||
| 249 | #define STM32_USB_USB1_HP_IRQ_PRIORITY 13 | ||
| 250 | #define STM32_USB_USB1_LP_IRQ_PRIORITY 14 | ||
| 251 | |||
| 252 | /* | ||
| 253 | * WDG driver system settings. | ||
| 254 | */ | ||
| 255 | #define STM32_WDG_USE_IWDG FALSE | ||
| 256 | |||
| 257 | #endif /* MCUCONF_H */ | ||
diff --git a/keyboards/hadron/ver3/rev3.h b/keyboards/hadron/ver3/rev3.h new file mode 100644 index 000000000..2cbd53ace --- /dev/null +++ b/keyboards/hadron/ver3/rev3.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #ifndef REV3_H | ||
| 17 | #define REV3_H | ||
| 18 | |||
| 19 | #include "hadron.h" | ||
| 20 | |||
| 21 | #endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver3/rules.mk b/keyboards/hadron/ver3/rules.mk new file mode 100644 index 000000000..8375efdd3 --- /dev/null +++ b/keyboards/hadron/ver3/rules.mk | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | # project specific files | ||
| 2 | SRC = matrix.c | ||
| 3 | |||
| 4 | ## chip/board settings | ||
| 5 | # - the next two should match the directories in | ||
| 6 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
| 7 | MCU_FAMILY = STM32 | ||
| 8 | MCU_SERIES = STM32F3xx | ||
| 9 | |||
| 10 | # Linker script to use | ||
| 11 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | ||
| 12 | # or <this_dir>/ld/ | ||
| 13 | MCU_LDSCRIPT = STM32F303xC | ||
| 14 | |||
| 15 | # Startup code to use | ||
| 16 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
| 17 | MCU_STARTUP = stm32f3xx | ||
| 18 | |||
| 19 | # Board: it should exist either in <chibios>/os/hal/boards/ | ||
| 20 | # or <this_dir>/boards | ||
| 21 | BOARD = GENERIC_STM32_F303XC | ||
| 22 | |||
| 23 | # Cortex version | ||
| 24 | MCU = cortex-m4 | ||
| 25 | |||
| 26 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
| 27 | ARMV = 7 | ||
| 28 | |||
| 29 | USE_FPU = yes | ||
| 30 | |||
| 31 | # Vector table for application | ||
| 32 | # 0x00000000-0x00001000 area is occupied by bootlaoder.*/ | ||
| 33 | # The CORTEX_VTOR... is needed only for MCHCK/Infinity KB | ||
| 34 | # OPT_DEFS = -DCORTEX_VTOR_INIT=0x08005000 | ||
| 35 | OPT_DEFS = | ||
| 36 | |||
| 37 | # Options to pass to dfu-util when flashing | ||
| 38 | DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave | ||
| 39 | |||
| 40 | # Build Options | ||
| 41 | # comment out to disable the options. | ||
| 42 | # | ||
| 43 | BACKLIGHT_ENABLE = no | ||
| 44 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | ||
| 45 | ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) | ||
| 46 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 47 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 48 | CONSOLE_ENABLE = no # Console for debug | ||
| 49 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 50 | #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | ||
| 51 | NKRO_ENABLE = yes # USB Nkey Rollover | ||
| 52 | CUSTOM_MATRIX = yes # Custom matrix file | ||
| 53 | AUDIO_ENABLE = yes | ||
| 54 | RGBLIGHT_ENABLE = no | ||
| 55 | HAPTIC_ENABLE = DRV2605L | ||
| 56 | QWIIC_ENABLE += MICRO_OLED | ||
| 57 | # SERIAL_LINK_ENABLE = yes | ||
diff --git a/keyboards/hadron/ver3/ver3.c b/keyboards/hadron/ver3/ver3.c new file mode 100644 index 000000000..5e5e3e009 --- /dev/null +++ b/keyboards/hadron/ver3/ver3.c | |||
| @@ -0,0 +1,196 @@ | |||
| 1 | /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include "ver3.h" | ||
| 17 | #include "qwiic.h" | ||
| 18 | #include "action_layer.h" | ||
| 19 | #include "matrix.h" | ||
| 20 | #include "DRV2605L.h" | ||
| 21 | |||
| 22 | #ifdef QWIIC_MICRO_OLED_ENABLE | ||
| 23 | |||
| 24 | /* screen off after this many milliseconds */ | ||
| 25 | #include "timer.h" | ||
| 26 | #define ScreenOffInterval 60000 /* milliseconds */ | ||
| 27 | static uint16_t last_flush; | ||
| 28 | |||
| 29 | volatile uint8_t led_numlock = false; | ||
| 30 | volatile uint8_t led_capslock = false; | ||
| 31 | volatile uint8_t led_scrolllock = false; | ||
| 32 | |||
| 33 | static uint8_t layer; | ||
| 34 | static bool queue_for_send = false; | ||
| 35 | static uint8_t encoder_value = 32; | ||
| 36 | |||
| 37 | __attribute__ ((weak)) | ||
| 38 | void draw_ui(void) { | ||
| 39 | clear_buffer(); | ||
| 40 | last_flush = timer_read(); | ||
| 41 | send_command(DISPLAYON); | ||
| 42 | |||
| 43 | /* Layer indicator is 41 x 10 pixels */ | ||
| 44 | #define LAYER_INDICATOR_X 0 | ||
| 45 | #define LAYER_INDICATOR_Y 0 | ||
| 46 | |||
| 47 | draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0); | ||
| 48 | draw_rect_filled_soft(LAYER_INDICATOR_X + 32, LAYER_INDICATOR_Y + 1, 9, 9, PIXEL_ON, NORM); | ||
| 49 | draw_char(LAYER_INDICATOR_X + 34, LAYER_INDICATOR_Y + 2, layer + 0x30, PIXEL_ON, XOR, 0); | ||
| 50 | |||
| 51 | /* Matrix display is 19 x 9 pixels */ | ||
| 52 | #define MATRIX_DISPLAY_X 0 | ||
| 53 | #define MATRIX_DISPLAY_Y 18 | ||
| 54 | |||
| 55 | for (uint8_t x = 0; x < MATRIX_ROWS; x++) { | ||
| 56 | for (uint8_t y = 0; y < MATRIX_COLS; y++) { | ||
| 57 | draw_pixel(MATRIX_DISPLAY_X + y + 2, MATRIX_DISPLAY_Y + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | draw_rect_soft(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y, 19, 9, PIXEL_ON, NORM); | ||
| 61 | /* hadron oled location on thumbnail */ | ||
| 62 | draw_rect_filled_soft(MATRIX_DISPLAY_X + 14, MATRIX_DISPLAY_Y + 2, 3, 1, PIXEL_ON, NORM); | ||
| 63 | /* | ||
| 64 | draw_rect_soft(0, 13, 64, 6, PIXEL_ON, NORM); | ||
| 65 | draw_line_vert(encoder_value, 13, 6, PIXEL_ON, NORM); | ||
| 66 | |||
| 67 | */ | ||
| 68 | |||
| 69 | /* Mod display is 41 x 16 pixels */ | ||
| 70 | #define MOD_DISPLAY_X 30 | ||
| 71 | #define MOD_DISPLAY_Y 18 | ||
| 72 | |||
| 73 | uint8_t mods = get_mods(); | ||
| 74 | if (mods & MOD_LSFT) { | ||
| 75 | draw_rect_filled_soft(MOD_DISPLAY_X + 0, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); | ||
| 76 | draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_OFF, NORM, 0); | ||
| 77 | } else { | ||
| 78 | draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_ON, NORM, 0); | ||
| 79 | } | ||
| 80 | if (mods & MOD_LCTL) { | ||
| 81 | draw_rect_filled_soft(MOD_DISPLAY_X + 10, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); | ||
| 82 | draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_OFF, NORM, 0); | ||
| 83 | } else { | ||
| 84 | draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_ON, NORM, 0); | ||
| 85 | } | ||
| 86 | if (mods & MOD_LALT) { | ||
| 87 | draw_rect_filled_soft(MOD_DISPLAY_X + 20, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); | ||
| 88 | draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_OFF, NORM, 0); | ||
| 89 | } else { | ||
| 90 | draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_ON, NORM, 0); | ||
| 91 | } | ||
| 92 | if (mods & MOD_LGUI) { | ||
| 93 | draw_rect_filled_soft(MOD_DISPLAY_X + 30, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); | ||
| 94 | draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_OFF, NORM, 0); | ||
| 95 | } else { | ||
| 96 | draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_ON, NORM, 0); | ||
| 97 | } | ||
| 98 | |||
| 99 | /* Lock display is 23 x 32 */ | ||
| 100 | #define LOCK_DISPLAY_X 100 | ||
| 101 | #define LOCK_DISPLAY_Y 0 | ||
| 102 | |||
| 103 | if (led_numlock == true) { | ||
| 104 | draw_rect_filled_soft(LOCK_DISPLAY_X, LOCK_DISPLAY_Y, 5 + (3 * 6), 9, PIXEL_ON, NORM); | ||
| 105 | draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_OFF, NORM, 0); | ||
| 106 | } else if (led_numlock == false) { | ||
| 107 | draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_ON, NORM, 0); | ||
| 108 | } | ||
| 109 | if (led_capslock == true) { | ||
| 110 | draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 11, 5 + (3 * 6), 9, PIXEL_ON, NORM); | ||
| 111 | draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_OFF, NORM, 0); | ||
| 112 | } else if (led_capslock == false) { | ||
| 113 | draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_ON, NORM, 0); | ||
| 114 | } | ||
| 115 | |||
| 116 | if (led_scrolllock == true) { | ||
| 117 | draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 22, 5 + (3 * 6), 9, PIXEL_ON, NORM); | ||
| 118 | draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_OFF, NORM, 0); | ||
| 119 | } else if (led_scrolllock == false) { | ||
| 120 | draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_ON, NORM, 0); | ||
| 121 | } | ||
| 122 | send_buffer(); | ||
| 123 | } | ||
| 124 | |||
| 125 | void read_host_led_state(void) { | ||
| 126 | uint8_t leds = host_keyboard_leds(); | ||
| 127 | if (leds & (1 << USB_LED_NUM_LOCK)) { | ||
| 128 | if (led_numlock == false){ | ||
| 129 | led_numlock = true;} | ||
| 130 | } else { | ||
| 131 | if (led_numlock == true){ | ||
| 132 | led_numlock = false;} | ||
| 133 | } | ||
| 134 | if (leds & (1 << USB_LED_CAPS_LOCK)) { | ||
| 135 | if (led_capslock == false){ | ||
| 136 | led_capslock = true;} | ||
| 137 | } else { | ||
| 138 | if (led_capslock == true){ | ||
| 139 | led_capslock = false;} | ||
| 140 | } | ||
| 141 | if (leds & (1 << USB_LED_SCROLL_LOCK)) { | ||
| 142 | if (led_scrolllock == false){ | ||
| 143 | led_scrolllock = true;} | ||
| 144 | } else { | ||
| 145 | if (led_scrolllock == true){ | ||
| 146 | led_scrolllock = false;} | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | uint32_t layer_state_set_kb(uint32_t state) { | ||
| 151 | state = layer_state_set_user(state); | ||
| 152 | layer = biton32(state); | ||
| 153 | queue_for_send = true; | ||
| 154 | return state; | ||
| 155 | } | ||
| 156 | |||
| 157 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 158 | queue_for_send = true; | ||
| 159 | return process_record_user(keycode, record); | ||
| 160 | } | ||
| 161 | |||
| 162 | void encoder_update_kb(uint8_t index, bool clockwise) { | ||
| 163 | encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64; | ||
| 164 | queue_for_send = true; | ||
| 165 | } | ||
| 166 | |||
| 167 | #endif | ||
| 168 | |||
| 169 | void matrix_init_kb(void) { | ||
| 170 | #ifdef DRV2605L | ||
| 171 | DRV_init(); | ||
| 172 | #endif | ||
| 173 | queue_for_send = true; | ||
| 174 | matrix_init_user(); | ||
| 175 | } | ||
| 176 | |||
| 177 | void matrix_scan_kb(void) { | ||
| 178 | |||
| 179 | if (queue_for_send) { | ||
| 180 | #ifdef DRV2605L | ||
| 181 | DRV_EFFECT play_eff = strong_click; | ||
| 182 | DRV_pulse(play_eff); | ||
| 183 | #endif | ||
| 184 | #ifdef QWIIC_MICRO_OLED_ENABLE | ||
| 185 | read_host_led_state(); | ||
| 186 | draw_ui(); | ||
| 187 | #endif | ||
| 188 | queue_for_send = false; | ||
| 189 | } | ||
| 190 | #ifdef QWIIC_MICRO_OLED_ENABLE | ||
| 191 | if (timer_elapsed(last_flush) > ScreenOffInterval) { | ||
| 192 | send_command(DISPLAYOFF); /* 0xAE */ | ||
| 193 | } | ||
| 194 | #endif | ||
| 195 | matrix_scan_user(); | ||
| 196 | } | ||
diff --git a/keyboards/hadron/ver3/ver3.h b/keyboards/hadron/ver3/ver3.h new file mode 100644 index 000000000..516f7b9a1 --- /dev/null +++ b/keyboards/hadron/ver3/ver3.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #ifndef VER3_H | ||
| 17 | #define VER3_H | ||
| 18 | |||
| 19 | #include "hadron.h" | ||
| 20 | |||
| 21 | #endif \ No newline at end of file | ||
diff --git a/keyboards/helix/rev1/keymaps/OLED_sample/rules.mk b/keyboards/helix/rev1/keymaps/OLED_sample/rules.mk deleted file mode 100644 index c56d6f37e..000000000 --- a/keyboards/helix/rev1/keymaps/OLED_sample/rules.mk +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | |||
| 2 | # Build Options | ||
| 3 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 4 | # the appropriate keymap folder that will get included automatically | ||
| 5 | # | ||
| 6 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 7 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
| 8 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 9 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 10 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 11 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 12 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 13 | MIDI_ENABLE = no # MIDI controls | ||
| 14 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 15 | UNICODE_ENABLE = no # Unicode | ||
| 16 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 17 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. | ||
| 18 | SWAP_HANDS_ENABLE = no # Enable one-hand typing | ||
| 19 | |||
| 20 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 21 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 22 | |||
| 23 | ifndef QUANTUM_DIR | ||
| 24 | include ../../../../Makefile | ||
| 25 | endif | ||
diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h index 6d48321f9..f1551d251 100644 --- a/tmk_core/common/action_layer.h +++ b/tmk_core/common/action_layer.h | |||
| @@ -82,12 +82,10 @@ void layer_xor(uint32_t state); | |||
| 82 | #define layer_or(state) | 82 | #define layer_or(state) |
| 83 | #define layer_and(state) | 83 | #define layer_and(state) |
| 84 | #define layer_xor(state) | 84 | #define layer_xor(state) |
| 85 | #endif | ||
| 85 | 86 | ||
| 86 | __attribute__((weak)) | ||
| 87 | uint32_t layer_state_set_user(uint32_t state); | 87 | uint32_t layer_state_set_user(uint32_t state); |
| 88 | __attribute__((weak)) | ||
| 89 | uint32_t layer_state_set_kb(uint32_t state); | 88 | uint32_t layer_state_set_kb(uint32_t state); |
| 90 | #endif | ||
| 91 | 89 | ||
| 92 | /* pressed actions cache */ | 90 | /* pressed actions cache */ |
| 93 | #if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) | 91 | #if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) |
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index a6a5fb56b..6f659b244 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -72,6 +72,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 72 | #ifdef HD44780_ENABLE | 72 | #ifdef HD44780_ENABLE |
| 73 | # include "hd44780.h" | 73 | # include "hd44780.h" |
| 74 | #endif | 74 | #endif |
| 75 | #ifdef QWIIC_ENABLE | ||
| 76 | # include "qwiic.h" | ||
| 77 | #endif | ||
| 75 | 78 | ||
| 76 | #ifdef MATRIX_HAS_GHOST | 79 | #ifdef MATRIX_HAS_GHOST |
| 77 | extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | 80 | extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; |
| @@ -161,6 +164,9 @@ bool is_keyboard_master(void) { | |||
| 161 | void keyboard_init(void) { | 164 | void keyboard_init(void) { |
| 162 | timer_init(); | 165 | timer_init(); |
| 163 | matrix_init(); | 166 | matrix_init(); |
| 167 | #ifdef QWIIC_ENABLE | ||
| 168 | qwiic_init(); | ||
| 169 | #endif | ||
| 164 | #ifdef PS2_MOUSE_ENABLE | 170 | #ifdef PS2_MOUSE_ENABLE |
| 165 | ps2_mouse_init(); | 171 | ps2_mouse_init(); |
| 166 | #endif | 172 | #endif |
| @@ -270,6 +276,10 @@ void keyboard_task(void) | |||
| 270 | 276 | ||
| 271 | MATRIX_LOOP_END: | 277 | MATRIX_LOOP_END: |
| 272 | 278 | ||
| 279 | #ifdef QWIIC_ENABLE | ||
| 280 | qwiic_task(); | ||
| 281 | #endif | ||
| 282 | |||
| 273 | #ifdef MOUSEKEY_ENABLE | 283 | #ifdef MOUSEKEY_ENABLE |
| 274 | // mousekey repeat & acceleration | 284 | // mousekey repeat & acceleration |
| 275 | mousekey_task(); | 285 | mousekey_task(); |
