Added macro functions

New macros:
F1 - call-151
F2 - WeaknessPoint by Martin Haye
F3 - Joystick calibration
This commit is contained in:
Charles Mangin 2014-02-02 08:22:48 -05:00
parent 49ec8d22d8
commit 3ca006d483
6 changed files with 61 additions and 18 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -10,11 +10,7 @@ http://www.pjrc.com/teensy/teensyduino.html
/*
Declares the matrix rows/cols of the Apple IIe keyboard.
More information here:
http://apple2.info/wiki/index.php?title=Pinouts#Apple_.2F.2Fe_Motherboard_keyboard_connector
Declares the matrix rows/cols of the Apple IIc keyboard.
*/

View File

@ -80,7 +80,7 @@ J9 pinout
20 Y3
21 GROUND ???
22 X2
23 GROUND ???
23 5V ???
24 X1
25 POWER LED (5v)
26 OPEN APPLE

Binary file not shown.

View File

@ -521,7 +521,7 @@ class KbdRptParser : public KeyboardReportParser
{
void PrintKey(uint8_t mod, uint8_t key);
void PrintLine();
void PrintLine(int macro);
protected:
virtual void OnKeyDown (uint8_t mod, uint8_t key);
@ -529,13 +529,25 @@ protected:
virtual void OnKeyPressed(uint8_t key);
};
void KbdRptParser::PrintLine()
char* macrostrings[4]= {
"CALL -151\n",
"8:20 35 FD 20 ED FD 4C 8 0 8G WeaknessPoint Minus by Martin Haye\n",
"5 rem Joystick Calibration \n10 print pdl(0) \" \" pdl(1) \" \" peek(-16287) \" \" peek(-16286) : goto 10\n run\n",
"2000:20 35 FD C9 95 D0 2 B1\n :28 C9 94 D0 9 98 69 3\n :29 FC 85 24 D0 EA C9 8E\n :D0 8 A5 32 49 C0 85 32\n :D0 DE 20 ED FD 18 90 D8 \n"
};
void KbdRptParser::PrintLine(int macro)
{
int CharDelay = 50;
String TestWord = "10 print pdl(0) \" \" pdl(1) \" \" peek(-16287) \" \" peek(-16286)"; //{97,98,67,68}; //abCD
char SHIFTDOWN = 0;
int CharDelay = 60;
//10 print pdl(0) " " pdl(1) " " peek(-16287) " " peek(-16286) : goto 10
String TestWord = macrostrings[macro];
char SHIFTDOWN = 0;
// break up word into array of characters
// for each character in array
@ -545,10 +557,10 @@ void KbdRptParser::PrintLine()
// send keydown, wait X miliseconds, send keyup
for(int letters=0; letters < TestWord.length(); letters++ ) {
Serial.print(KEYMAP[TestWord[letters]][0]); // look up the USB byte from the KEYMAP array.
// Serial.print(KEYMAP[TestWord[letters]][0]); // look up the USB byte from the KEYMAP array.
if(KEYMAP[TestWord[letters]][1] == 1) {
Serial.print("!"); // hold shift
// Serial.print("!"); // hold shift
SHIFTDOWN = 2;
} else {
SHIFTDOWN = 0;
@ -710,9 +722,20 @@ Serial.print( "SEARCH_ROW = " );
// trying a sample macro:
if(key == 68) { // 0x44 == 68 == key_F11
PrintLine();
if(key == 58) { // 0x3A == 58 == key_F1
PrintLine(0);
}
if(key == 59) { // == key_F2
PrintLine(1);
}
if(key == 60) { // == key_F3
PrintLine(2);
}
if(key == 61) { // == key_F4
PrintLine(3);
}

View File

@ -9,9 +9,33 @@ Function Keys
The F12 key sends CTRL+Reset.
F11 is a demo of macros, which are experimental at this point. It sends a short BASIC program useful for testing and calibrating joysticks.
10 print pdl(0) " " pdl(1) " " peek(-16287) " " peek(-16286)
Macros
======
There are currently three handy macros included in the Keyboard Interface firmware. The are triggered by the F-keys F1 through F3.
_F1: enter the Monitor_
CALL -151
_F2: WeaknessPoint Minus by Martin Haye_
8:20 35 FD 20 ED FD 4C 8 0 8G
This is Martin's minimal presentation interface (i.e. "Not PowerPoint")
To clear the screen and begin typing, hit ESC, then @.
To navigate the screen, hit ESC, then I,J,K, or M. Then ESC again to edit.
_F3: Calibrate joysticks_
10 print pdl(0) " " pdl(1) " " peek(-16287) " " peek(-16286) : goto 10
Center on your joystick should read (approximately) 127 127.
The third and fourth numbers in the display are the joystick buttons. Pressed, they should read higher than 128, and lower than 128 when not pressed.
Hardware Buttons