Skip to content

Commit

Permalink
Adding a bunch of files and pictures and source code and a circuit an…
Browse files Browse the repository at this point in the history
…d a bunch else.
  • Loading branch information
DEVTEKLLC committed Oct 2, 2017
1 parent 2a0f6b8 commit 93e8006
Show file tree
Hide file tree
Showing 47 changed files with 666 additions and 3,216 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
fabric.properties
*.autosave
Binary file added Teensy/card2b.pdf
Binary file not shown.
Binary file added Teensy/teensy.TCLib
Binary file not shown.
555 changes: 555 additions & 0 deletions numpad/circuit/circuit.dsn

Large diffs are not rendered by default.

Binary file added numpad/circuit/circuit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 102 additions & 0 deletions numpad/firmware/numpad/numpad.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
//Pin setup
int ledPin = PIN_D6;
bool ledStatus = HIGH;

//C0->C3, R0->R4
int columnPins[] = { PIN_B0, PIN_B1, PIN_B2, PIN_B3 };
int rowPins[] = { PIN_D1, PIN_D2, PIN_D3, PIN_C6, PIN_C7 };
int columnCount = sizeof(columnPins)/sizeof(int);
int rowCount = sizeof(rowPins)/sizeof(int);

//How quickly to poll each key, in ms
int pollDelay = 1000/30;
int columnPollTime = 10; //I don't know what a good number is

//What are the keys in the numpad
//Left to right, top to bottom C0->C3, R0->R4
int columns[][5] = {
{ KEY_NUM_LOCK, KEYPAD_7, KEYPAD_4, KEYPAD_1, KEYPAD_0 },
{ KEYPAD_SLASH, KEYPAD_8, KEYPAD_5, KEYPAD_2, 0},
{ KEYPAD_ASTERIX, KEYPAD_9, KEYPAD_6, KEYPAD_3, KEYPAD_PERIOD },
{ KEYPAD_MINUS, 0, KEYPAD_PLUS, 0, KEYPAD_ENTER }
};

void setup() {

//Initialize I/O
for(int columnIndex = 0; columnIndex < columnCount; ++columnIndex){
//Set the pin and turn it off
int columnPin = columnPins[columnIndex];
pinMode(columnPin, INPUT_PULLUP);
}
for(int rowIndex = 0; rowIndex < rowCount; ++rowIndex){
//Set the pin
int rowPin = rowPins[rowIndex];
pinMode(rowPin, OUTPUT);
digitalWrite(rowPin, HIGH);
}

//Initialize the keyboard
Keyboard.begin();
Serial.begin(9600);
}


void loop() {

//Poll all the rows
pollRows();

//We've pressed all the keys, or as many as we can
//Send the message
Keyboard.send_now();

//Toggle the LED
digitalWrite(ledPin, ledStatus);
ledStatus = !ledStatus;

//Wait for the next poll
delay(pollDelay);

//Pause for debug
//delay(5000);
}

void pollRows(){
//For each row
for(int rowIndex = 0; rowIndex < rowCount; ++rowIndex){
//Drive the row low
int rowPin = rowPins[rowIndex];
digitalWrite(rowPin, LOW);

//Wait for things to settle(?)
//delay(columnPollTime);

//Now read each row
pollColumns(rowIndex);

//Turn off the pin!
digitalWrite(rowPin, HIGH);
}
}

void pollColumns(int rowIndex){
//Read all the columns and get the keys that are pressed
for(int columnIndex = 0; columnIndex < columnCount; ++columnIndex){
//Is it high?
int columnPin = columnPins[columnIndex];
bool activated = !digitalRead(columnPin);
int key = columns[columnIndex][rowIndex];
if(key != 0){
if(activated){
//We need to get that character for the numpad
//Serial.println(key);
Keyboard.press(key);
}else{
//Don't press that key
Keyboard.release(key);
}
}
}
}

30 changes: 3 additions & 27 deletions numpad/numpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,13 @@
import os
from BoardBuilder.BoardBuilder import BoardBuilder

import sys
'''
parser.add_argument('-j', '--json', type=str, default='', required=True,
help="JSON file to load. Raw data download from keyboard-layout-editor.com.")
parser.add_argument('-o', '--output_dir', type=str, default='.',
help="Directory into which the resulting .scad files will be generated.")
parser.add_argument('-s', '--stabs', choices=['both', 'cherry', 'costar'], default='both',
help="Specify the style of stabilizers to generate.")
parser.add_argument('-hp', '--horizontal_pad', type=float, default=0.0, help="Horizontal padding per side.")
parser.add_argument('-vp', '--vertical_pad', type=float, default=0.0, help="Vertical padding per side.")
parser.add_argument('-c', '--corner_radius', type=float, default=0.0, help="Corner radius.")
parser.add_argument('-n', '--num_holes', type=int, default=0, help="Number of screw holes.")
parser.add_argument('-hd', '--hole_diameter', type=float, default=0.0, help="Screw hole diameter.")
parser.add_argument('-sp', '--show_points', action="store_true",
help="Debug aid. Add floating red points for key space rectangles.")
'''

#Get the current directory
#Get the current directory and files
file_directory = os.path.dirname(os.path.realpath(__file__))

#Builder script path
script_module = "BoardBuilder"
script_name = "BoardBuilder.py"
script_path = os.path.join(file_directory, '..', script_module, script_name)


layout_name = "numpad-layout.json"
layout_path = os.path.join(file_directory, layout_name)
output_dir = './out/'

#Set up the parameters
layout_path = os.path.join(file_directory, layout_name)
stabilizers = "costar"
horizontal_padding = '12'
vertical_padding = '35,12'
Expand All @@ -41,7 +18,6 @@
screw_diameter = 5
screw_padding = 6
screw_side_count = 6
output_dir = './out/'

#Build the board
board = BoardBuilder(layout_path, horizontal_padding, vertical_padding, corner_radius, screw_count, screw_diameter, False, stabilizers, screw_padding, screw_side_count)
Expand Down
Binary file modified numpad/out/3mm_middle_hole_correct.lyz
Binary file not shown.
8 changes: 4 additions & 4 deletions numpad/out/3mm_middle_hole_correct.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 93e8006

Please sign in to comment.