Skip to content

Commit

Permalink
WIP hb qmk#2 firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbooks committed Dec 9, 2017
1 parent 399ad8c commit d51386d
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 107 deletions.
6 changes: 3 additions & 3 deletions keyboards/hbno2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DESCRIPTION QMK keyboard firmware for HBNO2

/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 13
#define MATRIX_ROWS 13
#define MATRIX_COLS 5
#define MATRIX_COLS_RIGHT 7

#define MOUSEKEY_INTERVAL 20
Expand Down Expand Up @@ -96,7 +96,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* runs seeming to need it. This may change when configuration for
* this is more directly exposed.
*/
#define DEBOUNCE 15
#define DEBOUNCE 5

#define PREVENT_STUCK_MODIFIERS

Expand Down
30 changes: 15 additions & 15 deletions keyboards/hbno2/hbno2.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ extern inline void ergodox_led_all_off(void);
bool i2c_initialized = 0;
uint8_t mcp23018_status = 0x20;

void matrix_init_kb(void) {
/* // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md") */
/* TCCR1A = 0b10101001; // set and configure fast PWM */
/* TCCR1B = 0b00001001; // set and configure fast PWM */
/* TCCR4D = 0b00001001; // set and configure fast PWM */
/* void matrix_init_kb(void) { */
/* /1* // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md") *1/ */
/* /1* TCCR1A = 0b10101001; // set and configure fast PWM *1/ */
/* /1* TCCR1B = 0b00001001; // set and configure fast PWM *1/ */
/* /1* TCCR4D = 0b00001001; // set and configure fast PWM *1/ */

/* ergodox_board_led_on(); */
/* _delay_ms(500); */
/* ergodox_board_led_off(); */
/* /1* ergodox_board_led_on(); *1/ */
/* /1* _delay_ms(500); *1/ */
/* /1* ergodox_board_led_off(); *1/ */

/* matrix_init_user(); */
/* /1* matrix_init_user(); *1/ */

init_mcp23018();
}
/* init_mcp23018(); */
/* } */

uint8_t init_mcp23018(void) {
mcp23018_status = 0x20;
Expand All @@ -45,8 +45,8 @@ uint8_t init_mcp23018(void) {
/* // - driving : output : 0 */
mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(IODIRA); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b10000000); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11000000); if (mcp23018_status) goto out;
i2c_stop();

/* // set pull-up */
Expand All @@ -55,8 +55,8 @@ uint8_t init_mcp23018(void) {
/* // - driving : off : 0 */
mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(GPPUA); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b01111111); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out;

out:
i2c_stop();
Expand Down
40 changes: 26 additions & 14 deletions keyboards/hbno2/hbno2.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ inline void ergodox_board_led_on(void) {
}

inline void ergodox_board_led_off(void) {
DDRB &= ~(1<<5);
PORTB &= ~(1<<6);
}

Expand All @@ -57,19 +56,32 @@ inline void ergodox_led_all_off(void)
}

#define KEYMAP( \
k00,k05,k10,k15,k20,k25, k30,k35,k40,k45,k50,k55, \
k01,k06,k11,k16,k21,k26, k31,k36,k41,k46,k51,k56, \
k02,k07,k12,k17,k22,k27, k32,k37,k42,k47,k52,k57, \
k03,k08,k13,k18,k23,k28, k33,k38,k43,k48,k53,k58, \
k04,k09,k14,k19,k24,k29, k34,k39,k44,k49,k54,k59, \
k60, k61, k62, k63 ) { \
{ k00, k05, k10, k15, k20, k25, k30, k35, k40, k45, k50, k55, k60 }, \
{ k01, k06, k11, k16, k21, k26, k31, k36, k41, k46, k51, k56, k61 }, \
{ k02, k07, k12, k17, k22, k27, k32, k37, k42, k47, k52, k57, k62 }, \
{ k03, k08, k13, k18, k23, k28, k33, k38, k43, k48, k53, k58, k63 }, \
{ k04, k09, k14, k19, k24, k29, k34, k39, k44, k49, k54, k59, KC_NO }, \
k00,k05,k10,k15,k20,k25, \
k01,k06,k11,k16,k21,k26, \
k02,k07,k12,k17,k22,k27, \
k03,k08,k13,k18,k23,k28, \
k04,k09,k14,k19,k24,k29, \
\
k30,k35,k40,k45,k50,k55, \
k31,k36,k41,k46,k51,k56, \
k32,k37,k42,k47,k52,k57, \
k33,k38,k43,k48,k53,k58, \
k34,k39,k44,k49,k54,k59, \
\
k60, k61, k63, k62 ) { \
{ k00, k01, k02, k03, k04 }, \
{ k05, k06, k07, k08, k09 }, \
{ k10, k11, k12, k13, k14 }, \
{ k15, k16, k17, k18, k19 }, \
{ k20, k21, k22, k23, k24 }, \
{ k25, k26, k27, k28, k29 }, \
{ k30, k31, k32, k33, k34 }, \
{ k35, k36, k37, k38, k39 }, \
{ k40, k41, k42, k43, k44 }, \
{ k45, k46, k47, k48, k49 }, \
{ k50, k51, k52, k53, k54 }, \
{ k55, k56, k57, k58, k59 }, \
{ k60, k61, k62, k63, KC_NO } \
}

#define LAYOUT_ergodox KEYMAP

#endif
20 changes: 13 additions & 7 deletions keyboards/hbno2/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@ enum custom_keycodes {

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = KEYMAP( // layer 0 : default
// left hand
CTL_T(KC_ESC), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, CTL_T(KC_ESC),
KC_LGUI, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RGUI,
KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_RCTRL,
KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_RSHIFT,
KC_NO, KC_LALT, KC_LSHIFT, KC_LGUI, KC_LCTRL, KC_BSPACE, KC_TAB, KC_RCTRL, KC_RGUI, KC_RSHIFT, KC_RALT, KC_NO,
// left hand
CTL_T(KC_ESC), KC_1, KC_2, KC_3, KC_4, KC_5,
KC_LGUI, KC_Q, KC_W, KC_E, KC_R, KC_T,
KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B,
KC_NO, KC_LALT, KC_LSHIFT, KC_LGUI, KC_LCTRL, KC_BSPACE,

KC_SPACE, KC_NO, KC_NO, KC_ENTER)
KC_6, KC_7, KC_8, KC_9, KC_0, CTL_T(KC_ESC),
KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RGUI,
KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_RCTRL,
KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_RSHIFT,
KC_TAB, KC_RCTRL, KC_RGUI, KC_RSHIFT, KC_RALT, KC_NO,

KC_SPACE, KC_NO, KC_NO, KC_ENTER)
};

const uint16_t PROGMEM fn_actions[] = {
Expand Down
Loading

0 comments on commit d51386d

Please sign in to comment.