2013-03-10 19:06:30 +00:00
|
|
|
/*
|
|
|
|
Serial Adapter Project: Dynamic serial TTY passthroughs
|
|
|
|
by: Mike Crosson
|
|
|
|
Nusku Networks
|
|
|
|
date: 2013/03/09
|
|
|
|
license: CC-BY SA 3.0 - Creative commons share-alike 3.0
|
|
|
|
use this code however you'd like, just keep this license and
|
|
|
|
attribute.
|
|
|
|
*/
|
2013-03-10 18:26:41 +00:00
|
|
|
|
2013-04-26 18:17:21 +00:00
|
|
|
#include <SerialPort.h>
|
|
|
|
|
2013-04-05 16:41:21 +00:00
|
|
|
#ifndef Project_h
|
|
|
|
#define Project_h
|
|
|
|
|
2013-04-25 23:29:14 +00:00
|
|
|
#define DEBUG 1 // NONE = 0; MINIMAL = 1; FULL = 2;
|
2013-04-06 20:31:44 +00:00
|
|
|
|
2013-04-27 18:57:28 +00:00
|
|
|
// Whether or not the Arduino Mega 2560 is used as the base board
|
|
|
|
#define ARD_MEGA_2560 true
|
|
|
|
|
2013-04-09 21:40:12 +00:00
|
|
|
// Buttons / Joystick / Input Hardware Pinouts
|
2013-04-06 20:31:44 +00:00
|
|
|
#define okButtonPin 22
|
|
|
|
#define okButtonLed 23
|
|
|
|
#define cancelButtonPin 24
|
|
|
|
#define cancelButtonLed 25
|
2013-04-05 15:25:23 +00:00
|
|
|
#define pspXPin 0 // After GND / @ edge
|
|
|
|
#define pspYPin 1 // Between VCC and gnd
|
2013-04-09 21:40:12 +00:00
|
|
|
|
|
|
|
// LCD Pinout
|
2013-04-07 05:32:42 +00:00
|
|
|
#define LCD_LITE 26 // Backlight pin
|
2013-04-06 06:44:59 +00:00
|
|
|
#define SD_CS 7 // Chip select line for SD card
|
|
|
|
#define LCD_CS 53 // Chip select line for TFT display
|
|
|
|
#define LCD_DC 9 // Data/command line for TFT
|
|
|
|
#define LCD_RST 8 // Reset line for TFT (or connect to +5V)
|
2013-04-05 15:25:23 +00:00
|
|
|
|
2013-04-17 02:02:09 +00:00
|
|
|
// Voltage Pinouts
|
|
|
|
#define voltagePinOnePointEight 40 // Pin controlling 1.8V TTL logic
|
|
|
|
#define voltagePinThreePointThree 41 // Pin controlling 3.3V TTL logic
|
|
|
|
#define voltagePinFivePointZero 42 // Pin controlling 5V TTL logic
|
2013-04-09 21:40:12 +00:00
|
|
|
|
2013-04-25 02:49:26 +00:00
|
|
|
// Timer pins
|
|
|
|
#define timerThreePin 2 // Maps to Mega pin 12
|
|
|
|
|
2013-04-26 01:38:21 +00:00
|
|
|
// Splash screen related
|
|
|
|
#define splashScreenFileName "splash.bmp"
|
|
|
|
|
2013-04-09 21:40:12 +00:00
|
|
|
// Colors / theme of UI
|
2013-04-07 00:42:58 +00:00
|
|
|
#define SPLASH_BACKGROUND ST7735_WHITE
|
|
|
|
#define BACKGROUND ST7735_BLACK
|
|
|
|
#define TEXT ST7735_WHITE
|
|
|
|
#define HILIGHT ST7735_YELLOW
|
|
|
|
|
2013-04-05 15:25:23 +00:00
|
|
|
// Don't change anything below here
|
|
|
|
// -----------------------------------------------------------------------------
|
2013-03-10 18:26:41 +00:00
|
|
|
|
2013-04-07 00:42:58 +00:00
|
|
|
#define FONT_WIDTH 6
|
|
|
|
#define FONT_HEIGHT 8
|
|
|
|
|
2013-04-26 18:17:21 +00:00
|
|
|
// Serial ports
|
2013-04-27 18:57:28 +00:00
|
|
|
#if ARD_MEGA_2560
|
|
|
|
extern SerialPort<0, 512, 512> serialPort0;
|
|
|
|
extern SerialPort<1, 512, 512> serialPort1;
|
|
|
|
extern SerialPort<2, 512, 512> serialPort2;
|
|
|
|
extern SerialPort<3, 512, 512> serialPort3;
|
|
|
|
#else
|
|
|
|
extern SerialPort<0, 4096, 4096> serialPort0;
|
|
|
|
extern SerialPort<1, 4096, 4096> serialPort1;
|
|
|
|
extern SerialPort<2, 4096, 4096> serialPort2;
|
|
|
|
extern SerialPort<3, 4096, 4096> serialPort3;
|
|
|
|
#endif
|
2013-04-26 18:17:21 +00:00
|
|
|
|
2013-03-10 18:26:41 +00:00
|
|
|
// Serial modes supported
|
|
|
|
// Abused in for loops / lookup tables -- DO NOT CHANGE none or set values
|
|
|
|
enum serialmode {
|
2013-04-06 06:51:10 +00:00
|
|
|
ttl,
|
2013-03-10 18:26:41 +00:00
|
|
|
db9_null,
|
|
|
|
cisco,
|
2013-04-07 02:24:15 +00:00
|
|
|
maxserialmode,
|
2013-03-10 18:26:41 +00:00
|
|
|
none=-1
|
|
|
|
};
|
|
|
|
|
|
|
|
// Map a mode -> text value
|
2013-03-13 20:29:54 +00:00
|
|
|
extern char* modeToText[];
|
2013-03-10 18:26:41 +00:00
|
|
|
|
2013-03-10 20:23:07 +00:00
|
|
|
// Line speeds supported
|
|
|
|
// Abused in for loops / lookup talbes -- DO NOT CHANGE none or set values
|
|
|
|
enum linespeed {
|
|
|
|
twentyFourHundredBaud,
|
|
|
|
ninetySixHundredBaud,
|
|
|
|
nineteenTwoK,
|
|
|
|
thirtyeightFourK,
|
|
|
|
fiftysevenFiveK,
|
2013-04-17 02:02:09 +00:00
|
|
|
oneFifteenTwoK,
|
2013-03-11 01:56:36 +00:00
|
|
|
maxlinespeed,
|
2013-03-10 20:23:07 +00:00
|
|
|
zero=-1
|
|
|
|
};
|
|
|
|
|
2013-04-07 03:20:17 +00:00
|
|
|
enum ttlvoltage {
|
2013-04-06 06:51:10 +00:00
|
|
|
onePointEight,
|
|
|
|
threePointThree,
|
|
|
|
five,
|
2013-04-07 02:24:15 +00:00
|
|
|
maxvoltage,
|
2013-04-06 20:31:44 +00:00
|
|
|
negOne=-1
|
2013-04-06 06:51:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern char* voltageToText[];
|
|
|
|
|
2013-03-10 20:23:07 +00:00
|
|
|
// Description / speed scruct to use in lookup table
|
|
|
|
struct linespeedinfo {
|
2013-03-11 01:56:36 +00:00
|
|
|
char* description;
|
2013-03-10 20:23:07 +00:00
|
|
|
int linespeed;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Known and supported line speeds
|
2013-03-13 20:29:54 +00:00
|
|
|
extern linespeedinfo linespeeds[];
|
2013-03-10 20:23:07 +00:00
|
|
|
|
2013-04-07 04:49:23 +00:00
|
|
|
enum timeout {
|
|
|
|
tenseconds,
|
|
|
|
thirtyseconds,
|
|
|
|
oneminute,
|
|
|
|
fiveminutes,
|
|
|
|
never,
|
|
|
|
maxtimeout
|
|
|
|
};
|
|
|
|
|
|
|
|
extern char* timeoutToText[];
|
|
|
|
|
2013-04-05 16:41:21 +00:00
|
|
|
#endif
|