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

Port DIRECT_PINS from split_common/matrix.c to matrix.c #5091

Merged
merged 8 commits into from
Apr 11, 2019
2 changes: 2 additions & 0 deletions docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ This is a C header file that is one of the first things included, and will persi
* define is matrix has ghost (unlikely)
* `#define DIODE_DIRECTION COL2ROW`
* COL2ROW or ROW2COL - how your matrix is configured. COL2ROW means the black mark on your diode is facing to the rows, and between the switch and the rows.
* `#define DIRECT_PINS { { F1, F0, B0, C7 }, { F4, F5, F6, F7 } }`
* pins mapped to rows and columns, from left to right. Defines a matrix where each switch is connected to a separate pin and ground.
* `#define AUDIO_VOICES`
* turns on the alternate audio voices (to cycle through)
* `#define C4_AUDIO`
Expand Down
18 changes: 18 additions & 0 deletions docs/hardware_avr.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ Finally, you can specify the direction your diodes point. This can be `COL2ROW`,
#define DIODE_DIRECTION COL2ROW
```

#### Direct Pin Matrix
To configure a keyboard where each switch is connected to a separate pin and ground instead of sharing row and column pins, use `DIRECT_PINS`. The mapping defines the pins of each switch in rows and columns, from left to right. Must conform to the sizes within `MATRIX_ROWS` and `MATRIX_COLS`, use `NO_PIN` to fill in blank spaces. Overrides the behaviour of `DIODE_DIRECTION`, `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`.

```c
// #define MATRIX_ROW_PINS { D0, D5 }
// #define MATRIX_COL_PINS { F1, F0, B0 }
#define DIRECT_PINS { \
{ F1, E6, B0, B2, B3 }, \
{ F5, F0, B1, B7, D2 }, \
{ F6, F7, C7, D5, D3 }, \
{ B5, C6, B6, NO_PIN, NO_PIN } \
}
#define UNUSED_PINS

/* COL2ROW, ROW2COL */
//#define DIODE_DIRECTION
```

### Backlight Configuration

By default QMK supports backlighting on pins `B5`, `B6`, and `B7`. If you are using one of those you can simply enable it here. For more details see the [Backlight Documentation](feature_backlight.md).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each r

For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect.

To configure a keyboard where each switch is connected to a separate pin and ground instead of sharing row and column pins, use `DIRECT_PINS`. The mapping defines the pins of each switch in rows and columns, from left to right. Must conform to the sizes within `MATRIX_ROWS` and `MATRIX_COLS`, use `NO_PIN` to fill in blank spaces. Overrides the behaviour of `DIODE_DIRECTION`, `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`.

`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported.

`BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap.
Expand Down
27 changes: 22 additions & 5 deletions keyboards/40percentclub/nano/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 2
#define MATRIX_COLS 4

/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
* NO_DIODE = switches are directly connected to AVR pins
*
*/
// #define MATRIX_ROW_PINS { D0, D5 }
// #define MATRIX_COL_PINS { F1, F0, B0 }
#define DIRECT_PINS { \
{ F4, F5, F6, F7 }, \
{ D1, D0, D4, C6 }, \
}
#define UNUSED_PINS

/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
//#define DIODE_DIRECTION CUSTOM_MATRIX

/* ws2812 RGB LED */
#define RGB_DI_PIN D3
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 6 // Number of LEDs

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW

#define TAPPING_TERM 200
159 changes: 0 additions & 159 deletions keyboards/40percentclub/nano/matrix.c

This file was deleted.

4 changes: 3 additions & 1 deletion keyboards/40percentclub/nano/nano.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

#include "quantum.h"

#define LAYOUT( \
#define LAYOUT_ortho_2x4( \
k01, k02, k03, k04, \
k05, k06, k07, k08 \
) { \
{ k01, k02, k03, k04 }, \
{ k05, k06, k07, k08 } \
}

#define LAYOUT LAYOUT_ortho_2x4
4 changes: 0 additions & 4 deletions keyboards/40percentclub/nano/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,3 @@ RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.

# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

# custom matrix setup
SRC = matrix.c
CUSTOM_MATRIX = yes
Loading