Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************************************************************************
- * In config.h
- ********************************************************************************/
- #define MATRIX_ROWS 5
- #define MATRIX_COLS 14
- /********************************************************************************
- * In keymap_common.h
- ********************************************************************************/
- #define KEYMAP( \
- K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
- K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
- K20, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
- K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
- K42, K43, K44, K45, K46, K49, K4A, K4B, K4C, K4D \
- ) { \
- { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \
- { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \
- { KC_##K20, KC_NO, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \
- { KC_NO, KC_NO, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \
- { KC_NO, KC_NO, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \
- }
- /********************************************************************************
- * In matrix.c
- ********************************************************************************/
- static void init_cols(void)
- {
- // Input with pull-up(DDR:0, PORT:1)
- DDRF &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
- PORTF |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
- // DDRE &= ~(1<<6);
- // PORTE |= (1<<6);
- DDRD &= ~(1<<7 | 1<<3 | 1<<2 | 1<<1);
- PORTD |= (1<<7 | 1<<3 | 1<<2 | 1<<1);
- DDRC &= ~(1<<6);
- PORTC |= (1<<6);
- DDRB &= ~(1<<6 | 1<<5 | 1<<4);
- PORTB |= (1<<6 | 1<<5 | 1<<4);
- }
- static matrix_row_t read_cols(void)
- {
- return (PINF&(1<<0) ? 0 : (1<<0)) |
- (PINF&(1<<1) ? 0 : (1<<1)) |
- (PINF&(1<<4) ? 0 : (1<<2)) |
- (PINF&(1<<5) ? 0 : (1<<3)) |
- (PINF&(1<<6) ? 0 : (1<<4)) |
- (PINF&(1<<7) ? 0 : (1<<5)) |
- (PINB&(1<<6) ? 0 : (1<<6)) |
- (PINB&(1<<5) ? 0 : (1<<7)) |
- (PINB&(1<<4) ? 0 : (1<<8)) | // Rev.A and B
- (PIND&(1<<7) ? 0 : (1<<9)) |
- (PINC&(1<<6) ? 0 : (1<<10)) |
- (PIND&(1<<3) ? 0 : (1<<11)) |
- (PIND&(1<<2) ? 0 : (1<<12)) |
- (PIND&(1<<1) ? 0 : (1<<13));
- }
- static void unselect_rows(void)
- {
- // Hi-Z(DDR:0, PORT:0) to unselect
- DDRB &= ~0b10001111;
- PORTB &= ~0b10001111;
- }
- static void select_row(uint8_t row)
- {
- // Output low(DDR:1, PORT:0) to select
- switch (row) {
- case 0:
- DDRB |= (1<<0);
- PORTB &= ~(1<<0);
- break;
- case 1:
- DDRB |= (1<<1);
- PORTB &= ~(1<<1);
- break;
- case 2:
- DDRB |= (1<<2);
- PORTB &= ~(1<<2);
- break;
- case 3:
- DDRB |= (1<<3);
- PORTB &= ~(1<<3);
- break;
- case 4:
- DDRB |= (1<<7);
- PORTB &= ~(1<<7);
- break;
- }
- }
- /********************************************************************************
- * In keymap_poker.c
- ********************************************************************************/
- const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- /* 0: All letter A for testing... */
- KEYMAP(
- A, A, A, A, A, A, A, A, A, A, A, A, A, A, \
- A, A, A, A, A, A, A, A, A, A, A, A, A, A, \
- A, A, A, A, A, A, A, A, A, A, A, A, A, \
- A, A, A, A, A, A, A, A, A, A, A, A, \
- A, A, A, A, A, A, A, A, A, A),
- };
- const uint16_t PROGMEM fn_actions[] = {
- };
- /********************************************************************************
- * In led.c -- I don't have an LED setup so I just set it to an unused pin
- ********************************************************************************/
- if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
- // output low
- DDRD |= (1<<0);
- PORTD &= ~(1<<0);
- } else {
- // Hi-Z
- DDRD &= ~(1<<0);
- PORTD &= ~(1<<0);
- }
- /********************************************************************************
- * In Makefile
- ********************************************************************************/
- MCU = atmega32u4
- F_CPU = 16000000
- ARCH = AVR8
- OPT_DEFS += -DBOOTLOADER_SIZE=4096
- BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
- #MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
- #EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
- CONSOLE_ENABLE = yes # Console for debug(+400)
- COMMAND_ENABLE = yes # Commands for debug and configuration
- #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
- NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement