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
package its.view; | |
import javax.swing.JFrame; | |
import javax.swing.JScrollPane; | |
import javax.swing.JSplitPane; | |
public class GUIWindow extends JFrame{ | |
private static final long serialVersionUID = 4159491956760989038L; | |
private static final double VERSION = 0.1; | |
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
uint16_t TimeSlice = 0; | |
uint16_t TimeSlicePrevious = (uint16_t) - 1; | |
void loop() | |
{ | |
// Record the beginning of the timeslice | |
uint32_t startTime = micros(); | |
// Update the current timeslice | |
TimeSlicePrevious = TimeSlice; |
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
import serial | |
from uinput import * | |
class Controller: | |
"""docstring for Controller""" | |
NumButtons = 8 | |
def __init__(self, devName, devKeys): | |
self.devPath = "/dev/" + devName |
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
enum DPad {RIGHT = 2, UP = 3, LEFT = 4, DOWN = 5}; | |
enum Buttons {A = 6, B = 7, X = 8, Y = 9}; | |
void setup() { | |
// Set the DPad buttons to pullup inputs | |
pinMode(RIGHT, INPUT_PULLUP); | |
pinMode(UP, INPUT_PULLUP); | |
pinMode(LEFT, INPUT_PULLUP); | |
pinMode(DOWN, INPUT_PULLUP); | |
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
enum DPad {RIGHT = 2, UP = 3, LEFT = 4, DOWN = 5}; | |
enum Buttons {A = 6, B = 7, X = 8, Y = 9}; |
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
// Set the DPad buttons to pullup inputs | |
pinMode(RIGHT, INPUT_PULLUP); | |
pinMode(UP, INPUT_PULLUP); | |
pinMode(LEFT, INPUT_PULLUP); | |
pinMode(DOWN, INPUT_PULLUP); | |
// Set the action buttons to pullup inputs | |
pinMode(A, INPUT_PULLUP); | |
pinMode(B, INPUT_PULLUP); | |
pinMode(X, INPUT_PULLUP); |
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
// Print the Key packet | |
// DPad | |
Serial.print("K:"); | |
Serial.print(digitalRead(RIGHT)); | |
Serial.print(digitalRead(UP)); | |
Serial.print(digitalRead(LEFT)); | |
Serial.print(digitalRead(DOWN)); | |
// Action buttons | |
Serial.print(digitalRead(A)); |
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
delay(10); |
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
class Controller: | |
"""docstring for Controller""" | |
NumButtons = 8 | |
def __init__(self, devName, devKeys): | |
self.devPath = "/dev/" + devName | |
try: | |
print "Connecting to " + self.devPath | |
self.serial = serial.Serial(self.devPath, 9600, timeout=10) |
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
ValidKeys = [ KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, | |
KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, | |
KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z,] |
OlderNewer