Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Dygma Raise #13543

Merged
merged 14 commits into from
Jan 9, 2022
23 changes: 23 additions & 0 deletions keyboards/dygma/raise/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once
ibash marked this conversation as resolved.
Show resolved Hide resolved

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID 0x1209
#define PRODUCT_ID 0x2201
#define DEVICE_VER 0x0001
#define MANUFACTURER Dygma
#define PRODUCT Raise

/* key matrix size */
// rows are doubled for split
#define MATRIX_ROWS 10
#define MATRIX_COLS 8

#define USE_I2CV1
#define I2C1_CLOCK_SPEED 100000

ibash marked this conversation as resolved.
Show resolved Hide resolved
/* The scanners already debounce for us */
#define DEBOUNCE 0

#define DRIVER_LED_TOTAL 132
77 changes: 77 additions & 0 deletions keyboards/dygma/raise/create-led-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* Copyright (C) 2021 Islam Sharabash
ibash marked this conversation as resolved.
Show resolved Hide resolved
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/

// Calculates the physical led positions and flags using a bazecor svg
// Open a bazecor layout with an svg and drop this code in the console
function compute() {

const keys = Array.from(document.querySelectorAll('#keyshapes > *')).map((el) => ({el: el, type: 'key'}))
const underglow = Array.from(document.querySelectorAll('#Areas > *')).map((el) => ({el: el, type: 'glow'}))

let elements = keys.concat(underglow)

elements.forEach((x) => {
const box = x.el.getBBox()
x.x = box.x + (box.width / 2)
x.y = box.y + (box.height / 2)
x.box = box
x.ledIndex = parseInt(x.el.dataset.ledIndex, 10)
})

const minX = Math.min.apply(null, elements.map((x) => x.x))
const maxX = Math.max.apply(null, elements.map((x) => x.x))
const minY = Math.min.apply(null, elements.map((x) => x.y))
const maxY = Math.max.apply(null, elements.map((x) => x.y))

// we choose the smaller x or y scale so that aspect ratio is preserved
const scale = Math.min(254 / (maxX - minX), 64 / (maxY - minY))

// offset is for centering after scaling
const offsetX = (254 - ((maxX - minX) * scale)) / 2
const offsetY = (64 - ((maxY - minY) * scale)) / 2

elements.forEach((x) => {
// scale so it fits within 254x64, then offset to center, finally floor to
// round
x.normX = Math.floor(((x.x - minX) * scale) + offsetX)
x.normY = Math.floor(((x.y - minY) * scale) + offsetY)
})


const positions = []
const flags = []

elements.forEach((x) => {
positions[x.ledIndex] = [x.normX, x.normY]
// assume glow if not key
flags[x.ledIndex] = x.type === 'key' ? 4 : 2
})

return { elements, positions, flags}
}

function go() {
const results = compute()
const positions = results.positions.map((x) => `{${x[0]}, ${x[1]}}`).join(', ')
const flags = results.flags.join(', ')

console.log('positions')
console.log(positions)
console.log('flags')
console.log(flags)
}

;(go())
21 changes: 21 additions & 0 deletions keyboards/dygma/raise/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright (C) 2021 QMK
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/

#pragma once

#define HAL_USE_I2C TRUE

#include_next <halconf.h>
Loading