diff options
Diffstat (limited to 'keyboards/jc65')
-rw-r--r-- | keyboards/jc65/v32a/config.h | 2 | ||||
-rw-r--r-- | keyboards/jc65/v32a/i2c.c | 106 | ||||
-rw-r--r-- | keyboards/jc65/v32a/i2c.h | 27 | ||||
-rw-r--r-- | keyboards/jc65/v32a/keymaps/rys/keymap.c | 23 | ||||
-rw-r--r-- | keyboards/jc65/v32a/keymaps/rys/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/jc65/v32a/rules.mk | 42 | ||||
-rw-r--r-- | keyboards/jc65/v32a/usbconfig.h | 12 | ||||
-rw-r--r-- | keyboards/jc65/v32a/v32a.c | 56 | ||||
-rw-r--r-- | keyboards/jc65/v32u4/keymaps/default/rules.mk | 0 | ||||
-rw-r--r-- | keyboards/jc65/v32u4/rules.mk | 55 |
10 files changed, 64 insertions, 261 deletions
diff --git a/keyboards/jc65/v32a/config.h b/keyboards/jc65/v32a/config.h index a5ec23ae4d..444ebad077 100644 --- a/keyboards/jc65/v32a/config.h +++ b/keyboards/jc65/v32a/config.h @@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define VENDOR_ID 0x1234 #define PRODUCT_ID 0x5679 +#define DEVICE_VER 0x0200 #define MANUFACTURER winkeyless.kr #define PRODUCT JC65 PS2AVRGB @@ -28,7 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_ROWS 8 #define MATRIX_COLS 16 -#define NO_BACKLIGHT_CLOCK #define BACKLIGHT_LEVELS 1 #define RGBLED_NUM 16 #define RGBLIGHT_ANIMATIONS diff --git a/keyboards/jc65/v32a/i2c.c b/keyboards/jc65/v32a/i2c.c deleted file mode 100644 index a4f9521352..0000000000 --- a/keyboards/jc65/v32a/i2c.c +++ /dev/null @@ -1,106 +0,0 @@ -/* -Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com> - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -// Please do not modify this file - -#include <avr/io.h> -#include <util/twi.h> - -#include "i2c.h" - -void i2c_set_bitrate(uint16_t bitrate_khz) { - uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz); - if (bitrate_div >= 16) { - bitrate_div = (bitrate_div - 16) / 2; - } - TWBR = bitrate_div; -} - -void i2c_init(void) { - // set pull-up resistors on I2C bus pins - PORTC |= 0b11; - - i2c_set_bitrate(400); - - // enable TWI (two-wire interface) - TWCR |= (1 << TWEN); - - // enable TWI interrupt and slave address ACK - TWCR |= (1 << TWIE); - TWCR |= (1 << TWEA); -} - -uint8_t i2c_start(uint8_t address) { - // reset TWI control register - TWCR = 0; - - // begin transmission and wait for it to end - TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); - while (!(TWCR & (1<<TWINT))); - - // check if the start condition was successfully transmitted - if ((TWSR & 0xF8) != TW_START) { - return 1; - } - - // transmit address and wait - TWDR = address; - TWCR = (1<<TWINT) | (1<<TWEN); - while (!(TWCR & (1<<TWINT))); - - // check if the device has acknowledged the READ / WRITE mode - uint8_t twst = TW_STATUS & 0xF8; - if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) { - return 1; - } - - return 0; -} - -void i2c_stop(void) { - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); -} - -uint8_t i2c_write(uint8_t data) { - TWDR = data; - - // transmit data and wait - TWCR = (1<<TWINT) | (1<<TWEN); - while (!(TWCR & (1<<TWINT))); - - if ((TWSR & 0xF8) != TW_MT_DATA_ACK) { - return 1; - } - - return 0; -} - -uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) { - if (i2c_start(address)) { - return 1; - } - - for (uint16_t i = 0; i < length; i++) { - if (i2c_write(data[i])) { - return 1; - } - } - - i2c_stop(); - - return 0; -} diff --git a/keyboards/jc65/v32a/i2c.h b/keyboards/jc65/v32a/i2c.h deleted file mode 100644 index 93a69c94da..0000000000 --- a/keyboards/jc65/v32a/i2c.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com> - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -// Please do not modify this file - -#ifndef __I2C_H__ -#define __I2C_H__ - -void i2c_init(void); -void i2c_set_bitrate(uint16_t bitrate_khz); -uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length); - -#endif diff --git a/keyboards/jc65/v32a/keymaps/rys/keymap.c b/keyboards/jc65/v32a/keymaps/rys/keymap.c new file mode 100644 index 0000000000..f946c8eebf --- /dev/null +++ b/keyboards/jc65/v32a/keymaps/rys/keymap.c @@ -0,0 +1,23 @@ +#include QMK_KEYBOARD_H + +enum layers { + _BASE, + _FUNC +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_NUBS, KC_DEL, KC_GRV, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, + KC_NUHS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXXX, KC_ENT, KC_PGDN, + KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, MO(_FUNC), + KC_LCTL, KC_LALT, KC_LGUI, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_FUNC] = LAYOUT( + RGB_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, RESET, + RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_HUD, RGB_SAD, RGB_VAD + ) +}; diff --git a/keyboards/jc65/v32a/keymaps/rys/rules.mk b/keyboards/jc65/v32a/keymaps/rys/rules.mk new file mode 100644 index 0000000000..d7463419b4 --- /dev/null +++ b/keyboards/jc65/v32a/keymaps/rys/rules.mk @@ -0,0 +1,2 @@ +RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = yes diff --git a/keyboards/jc65/v32a/rules.mk b/keyboards/jc65/v32a/rules.mk index fac85172ec..18e7f1de9d 100644 --- a/keyboards/jc65/v32a/rules.mk +++ b/keyboards/jc65/v32a/rules.mk @@ -1,33 +1,14 @@ -# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - # MCU name MCU = atmega32a -PROTOCOL = VUSB - -# unsupported features for now -NO_UART = yes -NO_SUSPEND_POWER_DOWN = yes -# processor frequency -F_CPU = 12000000 - -# Bootloader -# This definition is optional, and if your keyboard supports multiple bootloaders of -# different sizes, comment this out, and the correct address will be loaded -# automatically (+60). See bootloader.mk for all options. +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp BOOTLOADER = bootloadHID # build options @@ -38,13 +19,10 @@ CONSOLE_ENABLE = yes COMMAND_ENABLE = yes BACKLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes -RGBLIGHT_CUSTOM_DRIVER = yes +WS2812_DRIVER = i2c OPT_DEFS = -DDEBUG_LEVEL=0 # custom matrix setup CUSTOM_MATRIX = yes -SRC = matrix.c i2c.c - -# programming options -PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex +SRC = matrix.c diff --git a/keyboards/jc65/v32a/usbconfig.h b/keyboards/jc65/v32a/usbconfig.h index d2d848fcdc..85a915bb46 100644 --- a/keyboards/jc65/v32a/usbconfig.h +++ b/keyboards/jc65/v32a/usbconfig.h @@ -109,20 +109,10 @@ 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 -/* 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 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 -/* 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 /* 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 @@ -238,7 +228,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_VERSION 0x00, 0x02 +#define USB_CFG_DEVICE_VERSION (DEVICE_VER & 0xFF), ((DEVICE_VER >> 8) & 0xFF) /* 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' diff --git a/keyboards/jc65/v32a/v32a.c b/keyboards/jc65/v32a/v32a.c index 8176ade0a1..9b1e07274c 100644 --- a/keyboards/jc65/v32a/v32a.c +++ b/keyboards/jc65/v32a/v32a.c @@ -16,56 +16,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "v32a.h" -#ifdef BACKLIGHT_ENABLE -#include "backlight.h" -#endif -#ifdef RGBLIGHT_ENABLE -#include "rgblight.h" -#endif - -#include <avr/pgmspace.h> - -#include "action_layer.h" -#include "i2c.h" -#include "quantum.h" - -#ifdef RGBLIGHT_ENABLE -extern rgblight_config_t rgblight_config; - -void rgblight_set(void) { - if (!rgblight_config.enable) { - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - led[i].r = 0; - led[i].g = 0; - led[i].b = 0; - } - } - - i2c_init(); - i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); -} -#endif __attribute__ ((weak)) -void matrix_scan_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_task(); -#endif -} +void matrix_scan_user(void) {} #ifdef BACKLIGHT_ENABLE void backlight_init_ports(void) { - DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6); - PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6); + setPinOutput(D0); + setPinOutput(D1); + setPinOutput(D4); + setPinOutput(D6); + + writePinLow(D0); + writePinLow(D1); + writePinLow(D4); + writePinLow(D6); } void backlight_set(uint8_t level) { if (level == 0) { // Turn out the lights - PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6); + writePinLow(D0); + writePinLow(D1); + writePinLow(D4); + writePinLow(D6); } else { // Turn on the lights - PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6); + writePinHigh(D0); + writePinHigh(D1); + writePinHigh(D4); + writePinHigh(D6); } } #endif diff --git a/keyboards/jc65/v32u4/keymaps/default/rules.mk b/keyboards/jc65/v32u4/keymaps/default/rules.mk deleted file mode 100644 index e69de29bb2..0000000000 --- a/keyboards/jc65/v32u4/keymaps/default/rules.mk +++ /dev/null diff --git a/keyboards/jc65/v32u4/rules.mk b/keyboards/jc65/v32u4/rules.mk index c2c02b6147..e1498325cc 100644 --- a/keyboards/jc65/v32u4/rules.mk +++ b/keyboards/jc65/v32u4/rules.mk @@ -1,52 +1,15 @@ # MCU name -#MCU = at90usb1287 MCU = atmega32u4 -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This will be an integer division of F_USB below, as it is sourced by -# F_USB after it has run through any CPU prescalers. Note that this value -# does not *change* the processor frequency - it should merely be updated to -# reflect the processor speed set externally so that the code can use accurate -# software delays. -F_CPU = 16000000 - - -# -# LUFA specific -# -# Target architecture (see library "Board Types" documentation). -ARCH = AVR8 - -# Input clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency (before any prescaling is performed) in Hz. This value may -# differ from F_CPU if prescaling is used on the latter, and is required as the -# raw input clock is fed directly to the PLL sections of the AVR for high speed -# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' -# at the end, this will be done automatically to create a 32-bit value in your -# source code. -# -# If no clock division is performed on the input clock inside the AVR (via the -# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. -F_USB = $(F_CPU) - -# Interrupt driven control endpoint task(+60) -OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - - -# Boot Section Size in *bytes* -# Teensy halfKay 512 -# Teensy++ halfKay 1024 -# Atmel DFU loader 4096 -# LUFA bootloader 4096 -# USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=4096 - +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = atmel-dfu # Build Options # change yes to no to disable |