|
|
|
|
| 基板種類 | 最大 I/O数 |
| ATmega32u4 Pro Micro | 18本 |
| ATmega32u4 Elite-C V4 | 24本 |
| RP2040 Raspberry Pi Pico基板 | 26本 |
| STM32 Blue Pill基板等 | 33本 |
| 74HC4051 | 8 bit | 8:1 | 1-channel analog mutliplexer |
| 74HC4067 | 16 bit | 16:1 | 1-channel analog multiplexer |
今回購入![]() 8チャンネル74HC4051アナログマルチプレクサーデマルチプレクサーモジュールラズベリーパイ用単極オクタルスローアナログスイッチ ASIN: B07ZCP69KS |
今回購入![]() Ren He 3個セット CD74HC4067 高速 CMOS 16チャンネル デジタル アナログ マルチプレクサ 多重 ブレイクアウト ボード モジュール Arduinoと互換 ASIN: B0953LPVKJ 注意:黄色の接続ピンは付属しません |
![]() ACEIRMC CD74HC4067 16チャンネル アナログデジタルマルチプレクサー ブレークアウトボードモジュール Arduino 2V-6V マイクロコントローラー用 16デバイス RXライン 10個 ASIN: B08XV26WPS |
| PCF8574 | 8 bit | 8-bit I2C/SMBus I/O expander with interrupt |
| PCF8575 | 16 bit | 16-bit I2C/SMBus I/O expander with interrupt |
| TCA9555 | 16 bit | 16-bit I2C/SMBus I/O expander with interrupt weak pull-up & config registers |
| TCA6424 | 24 bit | 24-bit translating I2C/SMBus I/O expander with interrupt reset & config registers |
| MCP23017 | 16 bit | 16-Bit I2C I/O Expander with Serial Interface |
![]() 3個セット PCF8574 IO拡張ボード I2C Arduino用 開発ボード ASIN: B07BW3VL3C |
![]() GAOHOU新しいオープンスマートPCF8575 IO拡張ボードモジュールArduino TW用I2C?16IO ASIN: B073XJ263Q |
![]() WINGONEER MCP23017-E/SS I2Cインターフェイス16チャンネルIO拡張モジュール互換 C51 IIC入力および出力拡張ボード ASIN: B081ZYXW88 |
![]() HiLetgo TCA9548A I2C IIC マルチプレクサ ブレークアウト ボード 8チャンネル 拡張ボード ASIN: B078W4YLFG |
CUSTOM_MATRIX = lite SRC += matrix.c
void matrix_init_custom(void) {
// TODO: initialize hardware here
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool matrix_has_changed = false;
// TODO: add matrix scanning routine here
return matrix_has_changed;
}
| 用語 | 英語 | 略称 | 意味 | 代表的なロジック IC |
| マルチプレクサ | multiplexer | mux | セレクト入力に従い複数の入力のどれか1つを選択して出力する | 74HC4051や 74HC4067等で COM端子を出力で使用 |
| デマルチプレクサ | demultiplexer | demux | セレクト入力に従い1つの入力を複数の出力ラインのどれか 1つに出力する | 74HC4051や 74HC4067等で COM端子を入力で使用 |
| デコーダ | decoder | dec | セレクト入力に従い複数の出力ラインのどれか 1つをデコードする | 74HC138や 74HC154 |











| /E端子 | S0 | S1 | S2 | Zとの接続 |
| 0 | 0 | 0 | 0 | Y0 |
| 0 | 0 | 0 | 1 | Y1 |
| 0 | 0 | 1 | 0 | Y2 |
| 0 | 0 | 1 | 1 | Y3 |
| 0 | 1 | 0 | 0 | Y4 |
| 0 | 1 | 0 | 1 | Y5 |
| 0 | 1 | 1 | 0 | Y6 |
| 0 | 1 | 1 | 1 | Y7 |
| 1 | x | x | x | 無し |



// Copyright 2021 Y.Sakamoto (@FREEWING-JP)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "matrix.h"
#include "gpio.h"
// Row Input selector I0-I15 16bit
// #define MATRIX_ROW_PINS { B6, B2, B3, B1 } = { E6 }
static void select_col(uint8_t col) {
writePin(F5, (col & 1));
writePin(F6, (col & 2));
writePin(F7, (col & 4));
matrix_io_delay();
}
// Row I0-I17 18bit
// { E6 } + { B4, B5 }
static void select_row(uint8_t row) {
writePin(B6, (row & 1));
writePin(B2, (row & 2));
writePin(B3, (row & 4));
writePin(B1, (row & 8));
}
// Row I0-I17 18bit
// { E6 } + { B4, B5 }
static matrix_row_t read_rows(uint8_t row) {
int inputPin;
if (row < 16) {
// I0-I15
select_row(row);
inputPin = E6;
} else
if (row == 16) {
// I16
inputPin = B4;
} else
if (row == 17) {
// I17
inputPin = B5;
}
matrix_row_t rows = 0;
for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
// MSB = col 7, LSB = col 0
select_col(MATRIX_COLS - 1 - col);
matrix_io_delay();
rows <<= 1;
rows |= (readPin(inputPin) ? 0 : 1);
}
return rows;
}
void matrix_init_custom(void) {
/* Col pin configuration
* 74HC138 3-to-8 line decoder/demultiplexer
* 74HC4051 3-to-8 analog multiplexer/demultiplexer
* pin: xx F7 F6 F5
* Z 1 x x x
* /Y0 0 0 0 0
* /Y1 0 0 0 1
* /Y2 0 0 1 0
* /Y3 0 0 1 1
* /Y4 0 1 0 0
* /Y5 0 1 0 1
* /Y6 0 1 1 0
* /Y7 0 1 1 1
* 74HC4051 COM = GND = 'L'
*/
setPinOutput(F5); // Bit0 1
setPinOutput(F6); // Bit1 2
setPinOutput(F7); // Bit2 4
// setPinOutput(xx); // /Enable
// writePinHigh(xx); // Disable
/* Row pin configuration
* 74HC4067 16-channel analog multiplexer/demultiplexer
* pin: B1 B3 B2 B6
* I0 0 0 0 0
* I1 0 0 0 1
* I2 0 0 1 0
* I3 0 0 1 1
* I4 0 1 0 0
* I5 0 1 0 1
* I6 0 1 1 0
* I7 0 1 1 1
* I8 1 0 0 0
* I9 1 0 0 1
* I10 1 0 1 0
* I11 1 0 1 1
* I12 1 1 0 0
* I13 1 1 0 1
* I14 1 1 1 0
* I15 1 1 1 1
*/
setPinOutput(B6); // Bit0 1
setPinOutput(B2); // Bit1 2
setPinOutput(B3); // Bit2 4
setPinOutput(B1); // Bit3 8
// Row pin Input I0-I15 74HC4067 Common 'L' active
setPinInputHigh(E6);
// Row pin Input I16 'L' active
setPinInputHigh(B4);
// Row pin Input I17 'L' active
setPinInputHigh(B5);
}
// MATRIX_ROWS = 18
// MATRIX_COLS = 8
// matrix_row_t = uint8_t
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool matrix_has_changed = false;
// writePinLow(xx); // Enable
matrix_row_t* p = current_matrix;
for (uint8_t row = 0; row < MATRIX_ROWS; ++row) {
matrix_row_t now_rows = read_rows(row);
if (*p != now_rows) {
*p = now_rows;
matrix_has_changed = true;
}
++p;
}
// writePinHigh(xx); // Disable
return matrix_has_changed;
}
市販のフルキーボード改造用に MATRIX_ROWSを 18で定義していますが、余った 2本は直接 Pro Microの I/Oピン(B4、B5)に接続します。
// Copyright 2021 Y.Sakamoto (@FREEWING-JP)
// SPDX-License-Identifier: GPL-2.0-or-later
/* key matrix size */
#define MATRIX_ROWS 18
#define MATRIX_COLS 8
/*
* 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)
*
*/
#define MATRIX_ROW_PINS { NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
#define MATRIX_COL_PINS { NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
// #define UNUSED_PINS
/* COL2ROW, ROW2COL */
// #define DIODE_DIRECTION COL2ROW
☒ handwired/freewing/fcm084: MATRIX_COLS is inconsistent with the size of MATRIX_COL_PINS: 0 != 8 ☒ handwired/freewing/fcm084: MATRIX_ROWS is inconsistent with the size of MATRIX_ROW_PINS: 0 != 18 Making handwired/freewing/fcm084 with keymap default
/* key matrix size */
#define MATRIX_ROWS 18
#define MATRIX_COLS 8
#define MATRIX_ROW_PINS { NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
#define MATRIX_COL_PINS { NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
Compiling: quantum/dynamic_keymap.c
quantum/dynamic_keymap.c:75:6: error: #error Dynamic keymaps are configured to use more EEPROM than is available.
# error Dynamic keymaps are configured to use more EEPROM than is available.
^
[ERRORS]
// #error Dynamic keymaps are configured to use more EEPROM than is available. // Change 4 to 3 // #define DYNAMIC_KEYMAP_LAYER_COUNT 4 #define DYNAMIC_KEYMAP_LAYER_COUNT 3





