Added shifter code
This commit is contained in:
parent
d1f56f0f70
commit
bfa639d5a2
|
@ -8,6 +8,8 @@
|
||||||
attribute.
|
attribute.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
|
@ -70,6 +72,23 @@ void Config::setLineSpeed(linespeed speed) {
|
||||||
|
|
||||||
void Config::setVoltage(ttlvoltage voltage) {
|
void Config::setVoltage(ttlvoltage voltage) {
|
||||||
currentVoltage = voltage;
|
currentVoltage = voltage;
|
||||||
|
int shiftNumber = shiftOff;
|
||||||
|
switch (voltage) {
|
||||||
|
case 1: // onePointEight
|
||||||
|
shiftNumber = shift18V;
|
||||||
|
break;
|
||||||
|
case 2: // threePointThree
|
||||||
|
shiftNumber = shift33V;
|
||||||
|
break;
|
||||||
|
case 3: // five
|
||||||
|
shiftNumber = shift50V;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use bit shifter to activate the proper voltage regulator
|
||||||
|
digitalWrite(shifterLatchPin, LOW);
|
||||||
|
shiftOut(shifterDataPin, shifterClockPin, MSBFIRST, shiftNumber);
|
||||||
|
digitalWrite(shifterLatchPin, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::setTimeout(timeout aTimeout) {
|
void Config::setTimeout(timeout aTimeout) {
|
||||||
|
|
|
@ -22,7 +22,10 @@ private:
|
||||||
timeout currentTimeout;
|
timeout currentTimeout;
|
||||||
bool uiEnabled;
|
bool uiEnabled;
|
||||||
|
|
||||||
|
const static int shiftOff = 0;
|
||||||
|
const static int shift18V = 1;
|
||||||
|
const static int shift33V = 2;
|
||||||
|
const static int shift50V = 4;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Config();
|
Config();
|
||||||
|
|
|
@ -13,20 +13,27 @@
|
||||||
|
|
||||||
#define DEBUG true // For controlling debug output via serial
|
#define DEBUG true // For controlling debug output via serial
|
||||||
|
|
||||||
// Pinout / things that need configuration
|
// Buttons / Joystick / Input Hardware Pinouts
|
||||||
#define okButtonPin 22
|
#define okButtonPin 22
|
||||||
#define okButtonLed 23
|
#define okButtonLed 23
|
||||||
#define cancelButtonPin 24
|
#define cancelButtonPin 24
|
||||||
#define cancelButtonLed 25
|
#define cancelButtonLed 25
|
||||||
#define pspXPin 0 // After GND / @ edge
|
#define pspXPin 0 // After GND / @ edge
|
||||||
#define pspYPin 1 // Between VCC and gnd
|
#define pspYPin 1 // Between VCC and gnd
|
||||||
// LCD Pinouts
|
|
||||||
|
// LCD Pinout
|
||||||
#define LCD_LITE 26 // Backlight pin
|
#define LCD_LITE 26 // Backlight pin
|
||||||
#define SD_CS 7 // Chip select line for SD card
|
#define SD_CS 7 // Chip select line for SD card
|
||||||
#define LCD_CS 53 // Chip select line for TFT display
|
#define LCD_CS 53 // Chip select line for TFT display
|
||||||
#define LCD_DC 9 // Data/command line for TFT
|
#define LCD_DC 9 // Data/command line for TFT
|
||||||
#define LCD_RST 8 // Reset line for TFT (or connect to +5V)
|
#define LCD_RST 8 // Reset line for TFT (or connect to +5V)
|
||||||
|
|
||||||
|
// 74HC595 Bit Shifter Pinout
|
||||||
|
#define shifterLatchPin 2 //Pin connected to ST_CP of 74HC595
|
||||||
|
#define shifterClockPin 5 //Pin connected to SH_CP of 74HC595
|
||||||
|
#define shifterDataPin 4 //Pin connected to DS of 74HC595
|
||||||
|
|
||||||
|
// Colors / theme of UI
|
||||||
#define SPLASH_BACKGROUND ST7735_WHITE
|
#define SPLASH_BACKGROUND ST7735_WHITE
|
||||||
#define BACKGROUND ST7735_BLACK
|
#define BACKGROUND ST7735_BLACK
|
||||||
#define TEXT ST7735_WHITE
|
#define TEXT ST7735_WHITE
|
||||||
|
|
Reference in a new issue