-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiling post restruction (untested)
- Loading branch information
1 parent
3748c2b
commit 04145b4
Showing
29 changed files
with
253 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#ifndef KBDEF_H | ||
#define KBDEF_H | ||
|
||
#include "../../lib/sh68f90a/sh68f90a.h" | ||
|
||
#define MATRIX_ROWS 5 | ||
#define MATRIX_COLS 16 | ||
|
||
// Row Pins Bits | ||
#define KB_R0_P7_1 _P7_1 | ||
#define KB_R1_P7_2 _P7_2 | ||
#define KB_R2_P7_3 _P7_3 | ||
#define KB_R2_P5_3 _P5_3 | ||
#define KB_R2_P5_4 _P5_4 | ||
|
||
// Row Pins | ||
// TODO | ||
|
||
// Column Pins Bits | ||
#define KB_C0_P5_0 _P5_0 | ||
#define KB_C1_P5_1 _P5_1 | ||
#define KB_C2_P5_2 _P5_2 | ||
#define KB_C3_P3_5 _P3_5 | ||
#define KB_C4_P3_4 _P3_4 | ||
#define KB_C5_P3_3 _P3_3 | ||
#define KB_C6_P3_2 _P3_2 | ||
#define KB_C7_P3_1 _P3_1 | ||
#define KB_C8_P3_0 _P3_0 | ||
#define KB_C9_P2_5 _P2_5 | ||
#define KB_C10_P2_4 _P2_4 | ||
#define KB_C11_P2_3 _P2_3 | ||
#define KB_C12_P2_2 _P2_2 | ||
#define KB_C13_P2_1 _P2_1 | ||
#define KB_C14_P2_0 _P2_0 | ||
#define KB_C15_P1_5 _P1_5 | ||
|
||
// Column Pins | ||
#define KB_C0 P5_0 | ||
#define KB_C1 P5_1 | ||
#define KB_C2 P5_2 | ||
#define KB_C3 P3_5 | ||
#define KB_C4 P3_4 | ||
#define KB_C5 P3_3 | ||
#define KB_C6 P3_2 | ||
#define KB_C7 P3_1 | ||
#define KB_C8 P3_0 | ||
#define KB_C9 P2_5 | ||
#define KB_C10 P2_4 | ||
#define KB_C11 P2_3 | ||
#define KB_C12 P2_2 | ||
#define KB_C13 P2_1 | ||
#define KB_C14 P2_0 | ||
#define KB_C15 P1_5 | ||
|
||
// RGB Row Pins | ||
#define RGB_R0R_P0_4 _P0_4 | ||
#define RGB_R0G_P6_1 _P6_1 | ||
#define RGB_R0B_P0_3 _P0_3 | ||
#define RGB_R1R_P6_7 _P6_7 | ||
#define RGB_R1G_P6_2 _P6_2 | ||
#define RGB_R1B_P6_6 _P6_6 | ||
#define RGB_R2R_P0_2 _P0_2 | ||
#define RGB_R2G_P6_3 _P6_3 | ||
#define RGB_R2B_P5_7 _P5_7 | ||
#define RGB_R3R_P4_5 _P4_5 | ||
#define RGB_R3G_P6_4 _P6_4 | ||
#define RGB_R3B_P4_6 _P4_6 | ||
#define RGB_R4R_P4_4 _P4_4 | ||
#define RGB_R4G_P6_5 _P6_5 | ||
#define RGB_R4B_P4_3 _P4_3 | ||
#define RGB_ULR_P1_1 _P1_1 | ||
#define RGB_ULG_P1_2 _P1_2 | ||
#define RGB_ULB_P1_3 _P1_3 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#include "kbdef.h" | ||
|
||
void matrix_pre_scan(uint8_t col) | ||
{ | ||
// set all columns to high | ||
P1 |= (uint8_t)(_P1_5); | ||
P2 |= (uint8_t)(_P2_0 | _P2_1 | _P2_2 | _P2_3 | _P2_4 | _P2_5); | ||
P3 |= (uint8_t)(_P3_0 | _P3_1 | _P3_2 | _P3_3 | _P3_4 | _P3_5); | ||
P5 |= (uint8_t)(_P5_0 | _P5_1 | _P5_2); | ||
|
||
// set current (!) column to low | ||
switch (col) { | ||
case 0: | ||
KB_C0 = 0; | ||
break; | ||
|
||
case 1: | ||
KB_C1 = 0; | ||
break; | ||
|
||
case 2: | ||
KB_C2 = 0; | ||
break; | ||
|
||
case 3: | ||
KB_C3 = 0; | ||
break; | ||
|
||
case 4: | ||
KB_C4 = 0; | ||
break; | ||
|
||
case 5: | ||
KB_C5 = 0; | ||
break; | ||
|
||
case 6: | ||
KB_C6 = 0; | ||
break; | ||
|
||
case 7: | ||
KB_C7 = 0; | ||
break; | ||
|
||
case 8: | ||
KB_C8 = 0; | ||
break; | ||
|
||
case 9: | ||
KB_C9 = 0; | ||
break; | ||
|
||
case 10: | ||
KB_C10 = 0; | ||
break; | ||
|
||
case 11: | ||
KB_C11 = 0; | ||
break; | ||
|
||
case 12: | ||
KB_C12 = 0; | ||
break; | ||
|
||
case 13: | ||
KB_C13 = 0; | ||
break; | ||
|
||
case 14: | ||
KB_C14 = 0; | ||
break; | ||
|
||
case 15: | ||
KB_C15 = 0; | ||
break; | ||
} | ||
|
||
} | ||
|
||
uint8_t matrix_scan_col(uint8_t col) | ||
{ | ||
// grab key for the column state | ||
// P7_1 - R0 | ||
// P7_2 - R1 | ||
// P7_3 - R2 | ||
// P5_3 - R3 | ||
// P5_4 - R4 | ||
return (((P7 >> 1) & 0x07) | (P5 & 0x18)) | 0xe0; | ||
} | ||
|
||
void matrix_post_scan() | ||
{ | ||
// set all columns down to low | ||
P1 &= (uint8_t) ~(_P1_5); | ||
P2 &= (uint8_t) ~(_P2_0 | _P2_1 | _P2_2 | _P2_3 | _P2_4 | _P2_5); | ||
P3 &= (uint8_t) ~(_P3_0 | _P3_1 | _P3_2 | _P3_3 | _P3_4 | _P3_5); | ||
P5 &= (uint8_t) ~(_P5_0 | _P5_1 | _P5_2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "pwm.h" | ||
#include "../../matrix.h" | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.