瀏覽代碼

Adding initial HP150 and IBMConvertible scan modules.

- HP150 is not ready
- IBMConvertible is ready to start testing
simple
Jacob Alexander 11 年之前
父節點
當前提交
0c39927268

+ 296
- 0
Keymap/hp150.h 查看文件

@@ -0,0 +1,296 @@
/* Copyright (C) 2012 by Jacob Alexander
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef __HP150_H
#define __HP150_H

// This file contains various key layouts for the HP150 Keyboard


// ----- Variables -----
static uint8_t hp150_ModifierMask[] = { 0x20, 0x2D, 0x2E, 0x30, 0x3E, 0x60 };

static uint8_t hp150_DefaultMap[] = {
0, // 0x00
0, // 0x01
0, // 0x02
0, // 0x03
0, // 0x04
0, // 0x05
0, // 0x06
0, // 0x07
0, // 0x08
0, // 0x09
0, // 0x0A
0, // 0x0B
0, // 0x0C
0, // 0x0D
0, // 0x0E
0, // 0x0F
0, // 0x10
0, // 0x11
0, // 0x12
0, // 0x13
0, // 0x14
0, // 0x15
0, // 0x16
0, // 0x17
0, // 0x18
0, // 0x19
0, // 0x1A
0, // 0x1B
0, // 0x1C
0, // 0x1D
0, // 0x1E
0, // 0x1F
KEY_LEFT_SHIFT, // 0x20
0, // 0x21
KEY_Z, // 0x22
KEY_X, // 0x23
KEY_C, // 0x24
KEY_V, // 0x25
KEY_B, // 0x26
KEY_N, // 0x27
KEY_M, // 0x28
KEY_COMMA, // 0x29
KEY_PERIOD, // 0x2A
KEY_SLASH, // 0x2B
0, // 0x2C
KEY_RIGHT_SHIFT, // 0x2D
KEY_LEFT_ALT, // 0x2E
KEY_SPACE, // 0x2F
KEY_LEFT_CTRL, // 0x30
KEY_A, // 0x31
KEY_S, // 0x32
KEY_D, // 0x33
KEY_F, // 0x34
KEY_G, // 0x35
KEY_H, // 0x36
KEY_J, // 0x37
KEY_K, // 0x38
KEY_L, // 0x39
KEY_SEMICOLON, // 0x3A
KEY_QUOTE, // 0x3B
0, // 0x3C
KEY_ENTER, // 0x3D
KEY_RIGHT_GUI, // 0x3E
KEY_LEFT, // 0x3F (KEYPAD_1)
KEY_TAB, // 0x40
KEY_Q, // 0x41
KEY_W, // 0x42
KEY_E, // 0x43
KEY_R, // 0x44
KEY_T, // 0x45
KEY_Y, // 0x46
KEY_U, // 0x47
KEY_I, // 0x48
KEY_O, // 0x49
KEY_P, // 0x4A
KEY_LEFT_BRACE, // 0x4B
KEY_RIGHT_BRACE, // 0x4C
KEY_BACKSLASH, // 0x4D
KEY_DELETE, // 0x4E
KEYPAD_4, // 0x4F
KEY_ESC, // 0x50
KEY_1, // 0x51
KEY_2, // 0x52
KEY_3, // 0x53
KEY_4, // 0x54
KEY_5, // 0x55
KEY_6, // 0x56
KEY_7, // 0x57
KEY_8, // 0x58
KEY_9, // 0x59
KEY_0, // 0x5A
KEY_MINUS, // 0x5B
KEY_EQUAL, // 0x5C
KEY_TILDE, // 0x5D
KEY_BACKSPACE, // 0x5E
KEY_NUM_LOCK, // 0x5F
KEY_LEFT_GUI, // 0x60
KEY_HOME, // 0x61
KEY_END, // 0x62
KEY_INSERT, // 0x63
KEY_DELETE, // 0x64
KEY_F1, // 0x65
KEY_F2, // 0x66
KEY_F3, // 0x67
KEY_F4, // 0x68
KEY_F5, // 0x69
KEY_F6, // 0x6A
KEY_F7, // 0x6B
KEY_F8, // 0x6C
KEY_F9, // 0x6D
KEY_F10, // 0x6E
KEY_PRINTSCREEN, // 0x6F
KEY_PAGE_UP, // 0x70
KEY_PAGE_DOWN, // 0x71
KEY_F11, // 0x72
KEYPAD_7, // 0x73
KEYPAD_8, // 0x74
KEYPAD_9, // 0x75
KEY_UP, // 0x76 (KEYPAD_5)
KEYPAD_6, // 0x77
KEY_DOWN, // 0x78 (KEYPAD_2)
KEY_RIGHT, // 0x79 (KEYPAD_3)
KEYPAD_0, // 0x7A
KEYPAD_00, // 0x7B
KEYPAD_ENTER, // 0x7C
0, // 0x7D
0, // 0x7E
0, // 0x7F
};

static uint8_t hp150_ColemakMap[] = {
0, // 0x00
0, // 0x01
0, // 0x02
0, // 0x03
0, // 0x04
0, // 0x05
0, // 0x06
0, // 0x07
0, // 0x08
0, // 0x09
0, // 0x0A
0, // 0x0B
0, // 0x0C
0, // 0x0D
0, // 0x0E
0, // 0x0F
0, // 0x10
0, // 0x11
0, // 0x12
0, // 0x13
0, // 0x14
0, // 0x15
0, // 0x16
0, // 0x17
0, // 0x18
0, // 0x19
0, // 0x1A
0, // 0x1B
0, // 0x1C
0, // 0x1D
0, // 0x1E
0, // 0x1F
KEY_LEFT_SHIFT, // 0x20
0, // 0x21
KEY_Z, // 0x22
KEY_X, // 0x23
KEY_C, // 0x24
KEY_V, // 0x25
KEY_B, // 0x26
KEY_K, // 0x27
KEY_M, // 0x28
KEY_COMMA, // 0x29
KEY_PERIOD, // 0x2A
KEY_SLASH, // 0x2B
0, // 0x2C
KEY_RIGHT_SHIFT, // 0x2D
KEY_LEFT_ALT, // 0x2E
KEY_SPACE, // 0x2F
KEY_LEFT_CTRL, // 0x30
KEY_A, // 0x31
KEY_R, // 0x32
KEY_S, // 0x33
KEY_T, // 0x34
KEY_D, // 0x35
KEY_H, // 0x36
KEY_N, // 0x37
KEY_E, // 0x38
KEY_I, // 0x39
KEY_O, // 0x3A
KEY_QUOTE, // 0x3B
0, // 0x3C
KEY_ENTER, // 0x3D
KEY_RIGHT_GUI, // 0x3E
KEY_LEFT, // 0x3F (KEYPAD_1)
KEY_TAB, // 0x40
KEY_Q, // 0x41
KEY_W, // 0x42
KEY_F, // 0x43
KEY_P, // 0x44
KEY_G, // 0x45
KEY_J, // 0x46
KEY_L, // 0x47
KEY_U, // 0x48
KEY_Y, // 0x49
KEY_SEMICOLON, // 0x4A
KEY_LEFT_BRACE, // 0x4B
KEY_RIGHT_BRACE, // 0x4C
KEY_BACKSLASH, // 0x4D
KEY_DELETE, // 0x4E
KEYPAD_4, // 0x4F
KEY_ESC, // 0x50
KEY_1, // 0x51
KEY_2, // 0x52
KEY_3, // 0x53
KEY_4, // 0x54
KEY_5, // 0x55
KEY_6, // 0x56
KEY_7, // 0x57
KEY_8, // 0x58
KEY_9, // 0x59
KEY_0, // 0x5A
KEY_MINUS, // 0x5B
KEY_EQUAL, // 0x5C
KEY_TILDE, // 0x5D
KEY_BACKSPACE, // 0x5E
KEY_NUM_LOCK, // 0x5F
KEY_LEFT_GUI, // 0x60
KEY_HOME, // 0x61
KEY_END, // 0x62
KEY_INSERT, // 0x63
KEY_DELETE, // 0x64
KEY_F1, // 0x65
KEY_F2, // 0x66
KEY_F3, // 0x67
KEY_F4, // 0x68
KEY_F5, // 0x69
KEY_F6, // 0x6A
KEY_F7, // 0x6B
KEY_F8, // 0x6C
KEY_F9, // 0x6D
KEY_F10, // 0x6E
KEY_PRINTSCREEN, // 0x6F
KEY_PAGE_UP, // 0x70
KEY_PAGE_DOWN, // 0x71
KEY_F11, // 0x72
KEYPAD_7, // 0x73
KEYPAD_8, // 0x74
KEYPAD_9, // 0x75
KEY_UP, // 0x76 (KEYPAD_5)
KEYPAD_6, // 0x77
KEY_DOWN, // 0x78 (KEYPAD_2)
KEY_RIGHT, // 0x79 (KEYPAD_3)
KEYPAD_0, // 0x7A
KEYPAD_00, // 0x7B
KEYPAD_ENTER, // 0x7C
0, // 0x7D
0, // 0x7E
0, // 0x7F
};



#endif


+ 206
- 0
Keymap/ibmconvertible.h 查看文件

@@ -0,0 +1,206 @@
/* Copyright (C) 2012 by Jacob Alexander
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef __IBMCONV_H
#define __IBMCONV_H

// This file contains various key layouts for the IBM Convertible keyboard


// ----- Variables -----

static uint8_t ibmconv_ModifierMask [] = { 0x2C, 0x38, 0x3A, 0x3B, 0x3C, 0x3E };

// Default 1-indexed key mappings
static uint8_t ibmconv_DefaultMap[] = {
0, // 0x00
KEY_TILDE, // 0x01
KEY_1, // 0x02
KEY_2, // 0x03
KEY_3, // 0x04
KEY_4, // 0x05
KEY_5, // 0x06
KEY_6, // 0x07
KEY_7, // 0x08 (7)
KEY_8, // 0x09 (8)
KEY_9, // 0x0A (9)
KEY_0, // 0x0B
KEY_MINUS, // 0x0C (-)
KEY_EQUAL, // 0x0D (+)
KEY_BACKSLASH, // 0x0E
KEY_BACKSPACE, // 0x0F
KEY_TAB, // 0x10
KEY_Q, // 0x11
KEY_W, // 0x12
KEY_E, // 0x13
KEY_R, // 0x14
KEY_T, // 0x15
KEY_Y, // 0x16
KEY_U, // 0x17 (4)
KEY_I, // 0x18 (5)
KEY_O, // 0x19 (6)
KEY_P, // 0x1A
KEY_LEFT_BRACE, // 0x1B
KEY_RIGHT_BRACE, // 0x1C
0, // 0x1D
KEY_CAPS_LOCK, // 0x1E
KEY_A, // 0x1F
KEY_S, // 0x20
KEY_D, // 0x21
KEY_F, // 0x22
KEY_G, // 0x23
KEY_H, // 0x24
KEY_J, // 0x25 (1)
KEY_K, // 0x26 (2)
KEY_L, // 0x27 (3)
KEY_SEMICOLON, // 0x28
KEY_QUOTE, // 0x29
0, // 0x2A (1/4)
KEY_ENTER, // 0x2B
KEY_LEFT_SHIFT, // 0x2C
0, // 0x2D
KEY_Z, // 0x2E
KEY_X, // 0x2F
KEY_C, // 0x30
KEY_V, // 0x31
KEY_B, // 0x32
KEY_N, // 0x33
KEY_M, // 0x34 (0)
KEY_COMMA, // 0x35
KEY_PERIOD, // 0x36 (Decimal)
KEY_SLASH, // 0x37 (/)
KEY_RIGHT_SHIFT, // 0x38
KEY_PRINTSCREEN, // 0x39 (*)
KEY_LEFT_CTRL, // 0x3A
KEY_LEFT_GUI, // 0x3B
KEY_LEFT_ALT, // 0x3C
KEY_SPACE, // 0x3D
KEY_RIGHT_ALT, // 0x3E
KEY_LEFT, // 0x3F (Home)
KEY_UP, // 0x40 (PgUp)
KEY_DOWN, // 0x41 (PgDn)
KEY_RIGHT, // 0x42 (End)
KEY_ESC, // 0x43
KEY_F1, // 0x44
KEY_F2, // 0x45
KEY_F3, // 0x46
KEY_F4, // 0x47
KEY_F5, // 0x48
KEY_F6, // 0x49
KEY_F7, // 0x4A
KEY_F8, // 0x4B
KEY_F9, // 0x4C
KEY_F10, // 0x4D
KEY_NUM_LOCK, // 0x4E
KEY_SCROLL_LOCK, // 0x4F
KEY_INSERT, // 0x50
KEY_DELETE, // 0x51
};

static uint8_t ibmconv_ColemakMap[] = {
0, // 0x00
KEY_TILDE, // 0x01
KEY_1, // 0x02
KEY_2, // 0x03
KEY_3, // 0x04
KEY_4, // 0x05
KEY_5, // 0x06
KEY_6, // 0x07
KEY_7, // 0x08 (7)
KEY_8, // 0x09 (8)
KEY_9, // 0x0A (9)
KEY_0, // 0x0B
KEY_MINUS, // 0x0C (-)
KEY_EQUAL, // 0x0D (+)
KEY_BACKSLASH, // 0x0E
KEY_BACKSPACE, // 0x0F
KEY_TAB, // 0x10
KEY_Q, // 0x11
KEY_W, // 0x12
KEY_F, // 0x13
KEY_P, // 0x14
KEY_G, // 0x15
KEY_J, // 0x16
KEY_L, // 0x17 (4)
KEY_U, // 0x18 (5)
KEY_Y, // 0x19 (6)
KEY_SEMICOLON, // 0x1A
KEY_LEFT_BRACE, // 0x1B
KEY_RIGHT_BRACE, // 0x1C
0, // 0x1D
KEY_CAPS_LOCK, // 0x1E
KEY_A, // 0x1F
KEY_R, // 0x20
KEY_S, // 0x21
KEY_T, // 0x22
KEY_D, // 0x23
KEY_H, // 0x24
KEY_N, // 0x25 (1)
KEY_E, // 0x26 (2)
KEY_I, // 0x27 (3)
KEY_O, // 0x28
KEY_QUOTE, // 0x29
0, // 0x2A (1/4)
KEY_ENTER, // 0x2B
KEY_LEFT_SHIFT, // 0x2C
0, // 0x2D
KEY_Z, // 0x2E
KEY_X, // 0x2F
KEY_C, // 0x30
KEY_V, // 0x31
KEY_B, // 0x32
KEY_K, // 0x33
KEY_M, // 0x34 (0)
KEY_COMMA, // 0x35
KEY_PERIOD, // 0x36 (Decimal)
KEY_SLASH, // 0x37 (/)
KEY_RIGHT_SHIFT, // 0x38
KEY_PRINTSCREEN, // 0x39 (*)
KEY_LEFT_CTRL, // 0x3A
KEY_LEFT_GUI, // 0x3B
KEY_LEFT_ALT, // 0x3C
KEY_SPACE, // 0x3D
KEY_RIGHT_ALT, // 0x3E
KEY_LEFT, // 0x3F (Home)
KEY_UP, // 0x40 (PgUp)
KEY_DOWN, // 0x41 (PgDn)
KEY_RIGHT, // 0x42 (End)
KEY_ESC, // 0x43
KEY_F1, // 0x44
KEY_F2, // 0x45
KEY_F3, // 0x46
KEY_F4, // 0x47
KEY_F5, // 0x48
KEY_F6, // 0x49
KEY_F7, // 0x4A
KEY_F8, // 0x4B
KEY_F9, // 0x4C
KEY_F10, // 0x4D
KEY_NUM_LOCK, // 0x4E
KEY_SCROLL_LOCK, // 0x4F
KEY_INSERT, // 0x50
KEY_DELETE, // 0x51
};



#endif


+ 2
- 0
Keymap/keymap.h 查看文件

@@ -45,6 +45,8 @@
#include "budkeypad.h"
#include "epsonqx10.h"
#include "heathzenith.h"
#include "hp150.h"
#include "ibmconvertible.h"
#include "kaypro1.h"
#include "microswitch8304.h"
#include "skm67001.h"

+ 239
- 0
Scan/HP150/scan_loop.c 查看文件

@@ -0,0 +1,239 @@
/* Copyright (C) 2012 by Jacob Alexander
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

// ----- Includes -----

// AVR Includes
#include <avr/interrupt.h>
#include <avr/io.h>
#include <util/delay.h>

// Project Includes
#include <led.h>
#include <print.h>

// Local Includes
#include "scan_loop.h"



// ----- Defines -----

// Pinout Defines
#define DATA_PORT PORTC
#define DATA_DDR DDRC
#define DATA_PIN 7

#define CLOCK_PORT PORTC
#define CLOCK_DDR DDRC
#define CLOCK_PIN 6

#define RESET_PORT PORTF
#define RESET_DDR DDRF
#define RESET_PIN 7


// ----- Macros -----

// Make sure we haven't overflowed the buffer
#define bufferAdd(byte) \
if ( KeyIndex_BufferUsed < KEYBOARD_BUFFER ) \
KeyIndex_Buffer[KeyIndex_BufferUsed++] = byte



// ----- Variables -----

// Buffer used to inform the macro processing module which keys have been detected as pressed
volatile uint8_t KeyIndex_Buffer[KEYBOARD_BUFFER];
volatile uint8_t KeyIndex_BufferUsed;
volatile uint8_t KeyIndex_Add_InputSignal; // Used to pass the (click/input value) to the keyboard for the clicker

volatile uint8_t currentWaveState = 0;


// Buffer Signals
volatile uint8_t BufferReadyToClear;



// ----- Function Declarations -----

void processKeyValue( uint8_t keyValue );
void removeKeyValue( uint8_t keyValue );



// ----- Interrupt Functions -----

// Generates a constant external clock
ISR( TIMER1_COMPA_vect )
{
if ( currentWaveState )
{
CLOCK_PORT &= ~(1 << CLOCK_PIN);
currentWaveState--;
}
else
{
CLOCK_PORT |= (1 << CLOCK_PIN);
currentWaveState++;
}
}



// ----- Functions -----

// Setup
inline void scan_setup()
{
// Setup Timer Pulse (16 bit)

// TODO Clock can be adjusted to whatever (read chip datasheets for limits)
// 16 MHz / (2 * Prescaler * (1 + OCR1A)) = 1200.1 baud
// Prescaler is 1
// Twice every 1200 baud (actually 1200.1, timer isn't accurate enough)
// This is close to 820 us, but a bit slower
cli();
TCCR1B = 0x09;
OCR1AH = 0x01;
OCR1AL = 0x09;
TIMSK1 = (1 << OCIE1A);
CLOCK_DDR = (1 << CLOCK_PIN);
sei();


// Initially buffer doesn't need to be cleared (it's empty...)
BufferReadyToClear = 0;

// InputSignal is off by default
KeyIndex_Add_InputSignal = 0x00;

// Reset the keyboard before scanning, we might be in a wierd state
scan_resetKeyboard();
}


// Main Detection Loop
// Since this function is non-interruptable, we can do checks here on what stage of the
// output clock we are at (0 or 1)
// We are looking for a start of packet
// If detected, all subsequent bits are then logged into a variable
// Once the end of the packet has been detected (always the same length), decode the pressed keys
inline uint8_t scan_loop()
{
return 0;
}

void processKeyValue( uint8_t keyValue )
{
// Interpret scan code
switch ( keyValue )
{
case 0x00: // Break code from input?
break;
default:
// Make sure the key isn't already in the buffer
for ( uint8_t c = 0; c < KeyIndex_BufferUsed + 1; c++ )
{
// Key isn't in the buffer yet
if ( c == KeyIndex_BufferUsed )
{
bufferAdd( keyValue );

// Only send data if enabled
if ( KeyIndex_Add_InputSignal )
scan_sendData( KeyIndex_Add_InputSignal );
break;
}

// Key already in the buffer
if ( KeyIndex_Buffer[c] == keyValue )
break;
}
break;
}
}

void removeKeyValue( uint8_t keyValue )
{
// Check for the released key, and shift the other keys lower on the buffer
uint8_t c;
for ( c = 0; c < KeyIndex_BufferUsed; c++ )
{
// Key to release found
if ( KeyIndex_Buffer[c] == keyValue )
{
// Shift keys from c position
for ( uint8_t k = c; k < KeyIndex_BufferUsed - 1; k++ )
KeyIndex_Buffer[k] = KeyIndex_Buffer[k + 1];

// Decrement Buffer
KeyIndex_BufferUsed--;

break;
}
}

// Error case (no key to release)
if ( c == KeyIndex_BufferUsed + 1 )
{
errorLED( 1 );
char tmpStr[6];
hexToStr( keyValue, tmpStr );
erro_dPrint( "Could not find key to release: ", tmpStr );
}
}

// Send data
uint8_t scan_sendData( uint8_t dataPayload )
{
return 0;
}

// Signal KeyIndex_Buffer that it has been properly read
void scan_finishedWithBuffer( void )
{
}

// Signal that the keys have been properly sent over USB
void scan_finishedWithUSBBuffer( void )
{
}

// Reset/Hold keyboard
// NOTE: Does nothing with the BETKB
void scan_lockKeyboard( void )
{
}

// NOTE: Does nothing with the BETKB
void scan_unlockKeyboard( void )
{
}

// Reset Keyboard
void scan_resetKeyboard( void )
{
// TODO Determine the scan period, and the interval to scan each bit
}


+ 67
- 0
Scan/HP150/scan_loop.h 查看文件

@@ -0,0 +1,67 @@
/* Copyright (C) 2012 by Jacob Alexander
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef __SCAN_LOOP_H
#define __SCAN_LOOP_H

// ----- Includes -----

// Compiler Includes
#include <stdint.h>

// Local Includes



// ----- Defines -----

#define KEYBOARD_SIZE 0x7F // 127 - Size of the array space for the keyboard(max index)
#define KEYBOARD_BUFFER 24 // Max number of key signals to buffer



// ----- Variables -----

extern volatile uint8_t KeyIndex_Buffer[KEYBOARD_BUFFER];
extern volatile uint8_t KeyIndex_BufferUsed;
extern volatile uint8_t KeyIndex_Add_InputSignal;



// ----- Functions -----

// Functions used by main.c
void scan_setup( void );
uint8_t scan_loop( void );


// Functions available to macro.c
uint8_t scan_sendData( uint8_t dataPayload );

void scan_finishedWithBuffer( void );
void scan_finishedWithUSBBuffer( void );
void scan_lockKeyboard( void );
void scan_unlockKeyboard( void );
void scan_resetKeyboard( void );


#endif // __SCAN_LOOP_H


+ 48
- 0
Scan/HP150/setup.cmake 查看文件

@@ -0,0 +1,48 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2011 for the Kiibohd Controller
#
# Released into the Public Domain
#
# For the HP150 Keyboard (Fujitsu Leaf Spring)
#
###


###
# Module C files
#

set( SCAN_SRCS
scan_loop.c
)


###
# Module H files
#
set( SCAN_HDRS
scan_loop.h
)


###
# File Dependency Setup
#
ADD_FILE_DEPENDENCIES( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( scan_loop.c ${SCAN_HDRS} )
#add_file_dependencies( macro.c keymap.h microswitch8304.h )


###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )

#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=hp150_ModifierMask
#-DKEYINDEX_MASK=hp150_ColemakMap
-DKEYINDEX_MASK=hp150_DefaultMap
)


+ 73
- 0
Scan/IBMConvertible/matrix.h 查看文件

@@ -0,0 +1,73 @@
/* Copyright (C) 2012 by Jacob Alexander
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef __MATRIX_H
#define __MATRIX_H

// ----- Includes -----

// Compiler Includes
#include <stdint.h>



// ----- Scan Mode Setting (See matrix_scan.h for more details) -----
#define scanMode scanCol_powrRow



// ----- Key Settings -----

#define KEYBOARD_SIZE 90 // # of keys (It actually has 78, but there are markings up to 81 on the PCB and scan lines enough for 90
#define MAX_ROW_SIZE 6 // # of rows
#define MAX_COL_SIZE 15 // # of columns



// ----- Matrix Configuration -----
static const uint8_t matrix_pinout[][MAX_COL_SIZE + 1] = {


// GND Pins
// Board Pins: 2, 8, 14, 20, 24
// OO2 Labels: 3, 7, 13, 19, 25

// IBM Convertible PCB Matrix
// Board Pins labeled as ()
// Board Pins: 26 25 23 22 21 19 17 15 13 11 9 7 5 3 1
// OO2 Labels: 1 2 4 5 6 8 10 12 14 16 18 20 22 24 26
// C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15
{ scanMode, pinC0, pinC1, pinC2, pinC3, pinC4, pinC5, pinC6, pinC7, pinF0, pinF1, pinF2, pinF3, pinF4, pinF5, pinF6 },
{ pinE1, 80, 79, 78, 81, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, }, // R1 - 9 (18)
{ pinE2, 14, 13, 12, 15, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, }, // R2 - 11 (16)
{ pinE3, 0, 28, 27, 0, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, }, // R3 - 15 (12)
{ pinE4, 43, 0, 41, 0, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, }, // R4 - 17 (10)
{ pinE5, 57, 0, 56, 0, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 44, }, // R5 - 21 (6)
{ pinE6, 65, 0, 64, 66, 63, 62, 0, 0, 0, 61, 0, 0, 60, 59, 58, }, // R6 - 23 (4)



};



#endif // __MATRIX_H


+ 35
- 0
Scan/IBMConvertible/setup.cmake 查看文件

@@ -0,0 +1,35 @@
###| CMake Kiibohd Controller Scan Module |###
#
# Written by Jacob Alexander in 2012 for the Kiibohd Controller
#
# Released into the Public Domain
#
###


###
# Module C files
#

#| XXX Requires the ../ due to how the paths are constructed
set( SCAN_SRCS
../matrix/matrix_scan.c
../matrix/scan_loop.c
)


###
# Module Specific Options
#
add_definitions( -I${HEAD_DIR}/Keymap )
add_definitions(
-I${HEAD_DIR}/Scan/matrix
)

#| Keymap Settings
add_definitions(
-DMODIFIER_MASK=ibmconv_ModifierMask
#-DKEYINDEX_MASK=ibmconv_DefaultMap
-DKEYINDEX_MASK=ibmconv_ColemakMap
)


+ 2
- 0
Scan/matrix/matrix_scan.c 查看文件

@@ -145,6 +145,8 @@ uint8_t ddrF = 0x00;


// ----- Functions -----
void matrix_debugPins(void);

// Pin Setup Debug
inline void matrix_debugPins()
{

+ 1
- 1
setup.cmake 查看文件

@@ -20,7 +20,7 @@
#| Please the {Scan,Macro,USB,Debug}/module.txt for information on the modules and how to create new ones

##| Deals with acquiring the keypress information and turning it into a key index
set( ScanModule "SKM67001" )
set( ScanModule "IBMConvertible" )

##| Uses the key index and potentially applies special conditions to it, mapping it to a usb key code
set( MacroModule "buffer" )