diff options
Diffstat (limited to 'quantum/template')
-rw-r--r-- | quantum/template/avr/config.h | 22 | ||||
-rw-r--r-- | quantum/template/base/keymaps/default/keymap.c | 61 | ||||
-rw-r--r-- | quantum/template/base/template.h | 10 | ||||
-rw-r--r-- | quantum/template/ps2avrgb/config.h | 21 | ||||
-rw-r--r-- | quantum/template/ps2avrgb/template.c | 36 | ||||
-rw-r--r-- | quantum/template/ps2avrgb/usbconfig.h | 96 |
6 files changed, 117 insertions, 129 deletions
diff --git a/quantum/template/avr/config.h b/quantum/template/avr/config.h index 0fc7cf9cb9..713d6be3a5 100644 --- a/quantum/template/avr/config.h +++ b/quantum/template/avr/config.h @@ -20,12 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "config_common.h" /* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x0000 -#define DEVICE_VER 0x0001 -#define MANUFACTURER %YOUR_NAME% -#define PRODUCT %KEYBOARD% -#define DESCRIPTION A custom keyboard +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER % YOUR_NAME % +#define PRODUCT % KEYBOARD % +#define DESCRIPTION A custom keyboard /* key matrix size */ #define MATRIX_ROWS 2 @@ -40,9 +40,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * -*/ -#define MATRIX_ROW_PINS { D0, D5 } -#define MATRIX_COL_PINS { F1, F0, B0 } + */ +#define MATRIX_ROW_PINS \ + { D0, D5 } +#define MATRIX_COL_PINS \ + { F1, F0, B0 } #define UNUSED_PINS /* COL2ROW, ROW2COL*/ @@ -51,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. */ -#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 +#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 // #define BACKLIGHT_PIN B7 // #define BACKLIGHT_BREATHING diff --git a/quantum/template/base/keymaps/default/keymap.c b/quantum/template/base/keymaps/default/keymap.c index 5eeedd45ef..308cb92a77 100644 --- a/quantum/template/base/keymaps/default/keymap.c +++ b/quantum/template/base/keymaps/default/keymap.c @@ -16,48 +16,37 @@ #include QMK_KEYBOARD_H // Defines the keycodes used by our macros in process_record_user -enum custom_keycodes { - QMKBEST = SAFE_RANGE, - QMKURL -}; +enum custom_keycodes { QMKBEST = SAFE_RANGE, QMKURL }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT( /* Base */ - KC_A, KC_1, KC_H, - KC_TAB, KC_SPC - ), + [0] = LAYOUT(/* Base */ + KC_A, KC_1, KC_H, KC_TAB, KC_SPC), }; bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QMKBEST: - if (record->event.pressed) { - // when keycode QMKBEST is pressed - SEND_STRING("QMK is the best thing ever!"); - } else { - // when keycode QMKBEST is released - } - break; - case QMKURL: - if (record->event.pressed) { - // when keycode QMKURL is pressed - SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER)); - } else { - // when keycode QMKURL is released - } - break; - } - return true; + switch (keycode) { + case QMKBEST: + if (record->event.pressed) { + // when keycode QMKBEST is pressed + SEND_STRING("QMK is the best thing ever!"); + } else { + // when keycode QMKBEST is released + } + break; + case QMKURL: + if (record->event.pressed) { + // when keycode QMKURL is pressed + SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER)); + } else { + // when keycode QMKURL is released + } + break; + } + return true; } -void matrix_init_user(void) { - -} +void matrix_init_user(void) {} -void matrix_scan_user(void) { +void matrix_scan_user(void) {} -} - -void led_set_user(uint8_t usb_led) { - -} +void led_set_user(uint8_t usb_led) {} diff --git a/quantum/template/base/template.h b/quantum/template/base/template.h index 2e531b1fd4..595da73c60 100644 --- a/quantum/template/base/template.h +++ b/quantum/template/base/template.h @@ -25,11 +25,5 @@ * The second converts the arguments into a two-dimensional array which * represents the switch matrix. */ -#define LAYOUT( \ - k00, k01, k02, \ - k10, k11 \ -) \ -{ \ - { k00, k01, k02 }, \ - { k10, KC_NO, k11 }, \ -} +#define LAYOUT(k00, k01, k02, k10, k11) \ + { {k00, k01, k02}, {k10, KC_NO, k11}, } diff --git a/quantum/template/ps2avrgb/config.h b/quantum/template/ps2avrgb/config.h index 3ab841d745..a780a10afc 100644 --- a/quantum/template/ps2avrgb/config.h +++ b/quantum/template/ps2avrgb/config.h @@ -19,22 +19,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "config_common.h" -#define VENDOR_ID 0x20A0 -#define PRODUCT_ID 0x422D -#define DEVICE_VER 0x0001 -#define MANUFACTURER You -#define PRODUCT %KEYBOARD% -#define DESCRIPTION A custom keyboard +#define VENDOR_ID 0x20A0 +#define PRODUCT_ID 0x422D +#define DEVICE_VER 0x0001 +#define MANUFACTURER You +#define PRODUCT % KEYBOARD % +#define DESCRIPTION A custom keyboard #define RGBLED_NUM 16 #define MATRIX_ROWS 8 #define MATRIX_COLS 11 -#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 } -#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5 } +#define MATRIX_ROW_PINS \ + { B0, B1, B2, B3, B4, B5, B6, B7 } +#define MATRIX_COL_PINS \ + { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5 } // #define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, C1, C0, D7 } -#define UNUSED_PINS {} +#define UNUSED_PINS \ + {} #define DIODE_DIRECTION COL2ROW #define DEBOUNCE 5 diff --git a/quantum/template/ps2avrgb/template.c b/quantum/template/ps2avrgb/template.c index 07f27bbb22..efc8517485 100644 --- a/quantum/template/ps2avrgb/template.c +++ b/quantum/template/ps2avrgb/template.c @@ -18,38 +18,38 @@ #ifdef RGBLIGHT_ENABLE -#include <string.h> -#include "i2c_master.h" -#include "rgblight.h" +# include <string.h> +# include "i2c_master.h" +# include "rgblight.h" extern rgblight_config_t rgblight_config; void matrix_init_kb(void) { - i2c_init(); - // call user level keymaps, if any - matrix_init_user(); + i2c_init(); + // call user level keymaps, if any + matrix_init_user(); } // custom RGB driver void rgblight_set(void) { - if (!rgblight_config.enable) { - memset(led, 0, 3 * RGBLED_NUM); - } + if (!rgblight_config.enable) { + memset(led, 0, 3 * RGBLED_NUM); + } - i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); + i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); } bool rgb_init = false; void matrix_scan_kb(void) { - // if LEDs were previously on before poweroff, turn them back on - if (rgb_init == false && rgblight_config.enable) { - i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); - rgb_init = true; - } - - rgblight_task(); - matrix_scan_user(); + // if LEDs were previously on before poweroff, turn them back on + if (rgb_init == false && rgblight_config.enable) { + i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); + rgb_init = true; + } + + rgblight_task(); + matrix_scan_user(); } #endif diff --git a/quantum/template/ps2avrgb/usbconfig.h b/quantum/template/ps2avrgb/usbconfig.h index 465db3a134..9ef232f045 100644 --- a/quantum/template/ps2avrgb/usbconfig.h +++ b/quantum/template/ps2avrgb/usbconfig.h @@ -14,15 +14,15 @@ section at the end of this file). /* ---------------------------- Hardware Config ---------------------------- */ -#define USB_CFG_IOPORTNAME D +#define USB_CFG_IOPORTNAME D /* This is the port where the USB bus is connected. When you configure it to * "B", the registers PORTB, PINB and DDRB will be used. */ -#define USB_CFG_DMINUS_BIT 3 +#define USB_CFG_DMINUS_BIT 3 /* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. * This may be any bit in the port. */ -#define USB_CFG_DPLUS_BIT 2 +#define USB_CFG_DPLUS_BIT 2 /* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. * This may be any bit in the port. Please note that D+ must also be connected * to interrupt pin INT0! [You can also use other interrupts, see section @@ -31,7 +31,7 @@ section at the end of this file). * interrupt, the USB interrupt will also be triggered at Start-Of-Frame * markers every millisecond.] */ -#define USB_CFG_CLOCK_KHZ (F_CPU/1000) +#define USB_CFG_CLOCK_KHZ (F_CPU / 1000) /* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code * require no crystal, they tolerate +/- 1% deviation from the nominal @@ -40,7 +40,7 @@ section at the end of this file). * Since F_CPU should be defined to your actual clock rate anyway, you should * not need to modify this setting. */ -#define USB_CFG_CHECK_CRC 0 +#define USB_CFG_CHECK_CRC 0 /* Define this to 1 if you want that the driver checks integrity of incoming * data packets (CRC checks). CRC checks cost quite a bit of code size and are * currently only available for 18 MHz crystal clock. You must choose @@ -63,18 +63,18 @@ section at the end of this file). /* --------------------------- Functional Range ---------------------------- */ -#define USB_CFG_HAVE_INTRIN_ENDPOINT 1 +#define USB_CFG_HAVE_INTRIN_ENDPOINT 1 /* Define this to 1 if you want to compile a version with two endpoints: The * default control endpoint 0 and an interrupt-in endpoint (any other endpoint * number). */ -#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1 +#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1 /* Define this to 1 if you want to compile a version with three endpoints: The * default control endpoint 0, an interrupt-in endpoint 3 (or the number * configured below) and a catch-all default interrupt-in endpoint as above. * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. */ -#define USB_CFG_EP3_NUMBER 3 +#define USB_CFG_EP3_NUMBER 3 /* If the so-called endpoint 3 is used, it can now be configured to any other * endpoint number (except 0) with this macro. Default if undefined is 3. */ @@ -84,13 +84,13 @@ section at the end of this file). * Since the token is toggled BEFORE sending any data, the first packet is * sent with the oposite value of this configuration! */ -#define USB_CFG_IMPLEMENT_HALT 0 +#define USB_CFG_IMPLEMENT_HALT 0 /* Define this to 1 if you also want to implement the ENDPOINT_HALT feature * for endpoint 1 (interrupt endpoint). Although you may not need this feature, * it is required by the standard. We have made it a config option because it * bloats the code considerably. */ -#define USB_CFG_SUPPRESS_INTR_CODE 0 +#define USB_CFG_SUPPRESS_INTR_CODE 0 /* Define this to 1 if you want to declare interrupt-in endpoints, but don't * want to send any data over them. If this macro is defined to 1, functions * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if @@ -98,48 +98,48 @@ section at the end of this file). * (e.g. HID), but never want to send any data. This option saves a couple * of bytes in flash memory and the transmit buffers in RAM. */ -#define USB_CFG_INTR_POLL_INTERVAL 1 +#define USB_CFG_INTR_POLL_INTERVAL 1 /* If you compile a version with endpoint 1 (interrupt-in), this is the poll * interval. The value is in milliseconds and must not be less than 10 ms for * low speed devices. */ -#define USB_CFG_IS_SELF_POWERED 0 +#define USB_CFG_IS_SELF_POWERED 0 /* Define this to 1 if the device has its own power supply. Set it to 0 if the * device is powered from the USB bus. */ -#define USB_CFG_MAX_BUS_POWER 500 +#define USB_CFG_MAX_BUS_POWER 500 /* Set this variable to the maximum USB bus power consumption of your device. * The value is in milliamperes. [It will be divided by two since USB * communicates power requirements in units of 2 mA.] */ -#define USB_CFG_IMPLEMENT_FN_WRITE 1 +#define USB_CFG_IMPLEMENT_FN_WRITE 1 /* Set this to 1 if you want usbFunctionWrite() to be called for control-out * transfers. Set it to 0 if you don't need it and want to save a couple of * bytes. */ -#define USB_CFG_IMPLEMENT_FN_READ 0 +#define USB_CFG_IMPLEMENT_FN_READ 0 /* Set this to 1 if you need to send control replies which are generated * "on the fly" when usbFunctionRead() is called. If you only want to send * data from a static buffer, set it to 0 and return the data from * usbFunctionSetup(). This saves a couple of bytes. */ -#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 +#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 /* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. * You must implement the function usbFunctionWriteOut() which receives all * interrupt/bulk data sent to any endpoint other than 0. The endpoint number * can be found in 'usbRxToken'. */ -#define USB_CFG_HAVE_FLOWCONTROL 0 +#define USB_CFG_HAVE_FLOWCONTROL 0 /* Define this to 1 if you want flowcontrol over USB data. See the definition * of the macros usbDisableAllRequests() and usbEnableAllRequests() in * usbdrv.h. */ -#define USB_CFG_DRIVER_FLASH_PAGE 0 +#define USB_CFG_DRIVER_FLASH_PAGE 0 /* If the device has more than 64 kBytes of flash, define this to the 64 k page * where the driver's constants (descriptors) are located. Or in other words: * Define this to 1 for boot loaders on the ATMega128. */ -#define USB_CFG_LONG_TRANSFERS 0 +#define USB_CFG_LONG_TRANSFERS 0 /* Define this to 1 if you want to send/receive blocks of more than 254 bytes * in a single control-in or control-out transfer. Note that the capability * for long transfers increases the driver size. @@ -160,7 +160,7 @@ section at the end of this file). /* This macro (if defined) is executed when a USB SET_ADDRESS request was * received. */ -#define USB_COUNT_SOF 1 +#define USB_COUNT_SOF 1 /* define this macro to 1 if you need the global variable "usbSofCount" which * counts SOF packets. This feature requires that the hardware interrupt is * connected to D- instead of D+. @@ -184,7 +184,7 @@ section at the end of this file). * Please note that Start Of Frame detection works only if D- is wired to the * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! */ -#define USB_CFG_CHECK_DATA_TOGGLING 0 +#define USB_CFG_CHECK_DATA_TOGGLING 0 /* define this macro to 1 if you want to filter out duplicate data packets * sent by the host. Duplicates occur only as a consequence of communication * errors, when the host does not receive an ACK. Please note that you need to @@ -192,11 +192,11 @@ section at the end of this file). * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable * for each control- and out-endpoint to check for duplicate packets. */ -#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 +#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 /* define this macro to 1 if you want the function usbMeasureFrameLength() * compiled in. This function can be used to calibrate the AVR's RC oscillator. */ -#define USB_USE_FAST_CRC 0 +#define USB_USE_FAST_CRC 0 /* The assembler module has two implementations for the CRC algorithm. One is * faster, the other is smaller. This CRC routine is only used for transmitted * messages where timing is not critical. The faster routine needs 31 cycles @@ -207,7 +207,7 @@ section at the end of this file). /* -------------------------- Device Description --------------------------- */ -#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF) +#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF) /* USB vendor ID for the device, low byte first. If you have registered your * own Vendor ID, define it here. Otherwise you may use one of obdev's free * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules! @@ -216,7 +216,7 @@ section at the end of this file). * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand * the implications! */ -#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF) +#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF) /* This is the ID of the product, low byte first. It is interpreted in the * scope of the vendor ID. If you have registered your own VID with usb.org * or if you have licensed a PID from somebody else, define it here. Otherwise @@ -227,10 +227,10 @@ section at the end of this file). * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand * the implications! */ -#define USB_CFG_DEVICE_VERSION 0x00, 0x02 +#define USB_CFG_DEVICE_VERSION 0x00, 0x02 /* Version number of the device: Minor number first, then major number. */ -#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r' +#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r' #define USB_CFG_VENDOR_NAME_LEN 13 /* These two values define the vendor name returned by the USB device. The name * must be given as a list of characters under single quotes. The characters @@ -240,7 +240,7 @@ section at the end of this file). * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for * details. */ -#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B' +#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B' #define USB_CFG_DEVICE_NAME_LEN 8 /* Same as above for the device name. If you don't want a device name, undefine * the macros. See the file USB-IDs-for-free.txt before you assign a name if @@ -255,20 +255,20 @@ section at the end of this file). * to fine tune control over USB descriptors such as the string descriptor * for the serial number. */ -#define USB_CFG_DEVICE_CLASS 0 -#define USB_CFG_DEVICE_SUBCLASS 0 +#define USB_CFG_DEVICE_CLASS 0 +#define USB_CFG_DEVICE_SUBCLASS 0 /* See USB specification if you want to conform to an existing device class. * Class 0xff is "vendor specific". */ -#define USB_CFG_INTERFACE_CLASS 3 /* HID */ -#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */ -#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */ +#define USB_CFG_INTERFACE_CLASS 3 /* HID */ +#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */ +#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */ /* See USB specification if you want to conform to an existing device class or * protocol. The following classes must be set at interface level: * HID class is 3, no subclass and protocol required (but may be useful!) * CDC class is 2, use subclass 2 and protocol 1 for ACM */ -#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 +#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 /* Define this to the length of the HID report descriptor, if you implement * an HID device. Otherwise don't define it or define it to 0. * If you use this define, you must add a PROGMEM character array named @@ -333,19 +333,19 @@ section at the end of this file). * }; */ -#define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC +#define USB_CFG_DESCR_PROPS_DEVICE 0 +#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC //#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 -#define USB_CFG_DESCR_PROPS_STRINGS 0 -#define USB_CFG_DESCR_PROPS_STRING_0 0 -#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 -#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 -#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 -#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC +#define USB_CFG_DESCR_PROPS_STRINGS 0 +#define USB_CFG_DESCR_PROPS_STRING_0 0 +#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 +#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 +#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 +#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC //#define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC +#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC //#define USB_CFG_DESCR_PROPS_HID_REPORT 0 -#define USB_CFG_DESCR_PROPS_UNKNOWN 0 +#define USB_CFG_DESCR_PROPS_UNKNOWN 0 #define usbMsgPtr_t unsigned short /* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to @@ -374,10 +374,10 @@ section at the end of this file). /* Set INT1 for D- falling edge to count SOF */ /* #define USB_INTR_CFG EICRA */ -#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10)) +#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10)) /* #define USB_INTR_CFG_CLR 0 */ /* #define USB_INTR_ENABLE EIMSK */ -#define USB_INTR_ENABLE_BIT INT1 +#define USB_INTR_ENABLE_BIT INT1 /* #define USB_INTR_PENDING EIFR */ -#define USB_INTR_PENDING_BIT INTF1 -#define USB_INTR_VECTOR INT1_vect +#define USB_INTR_PENDING_BIT INTF1 +#define USB_INTR_VECTOR INT1_vect |