hardware initialisation

This commit is contained in:
Stephen Crane 2014-10-19 15:19:06 +01:00
parent 46d70ca242
commit 8ac8ad1edf
2 changed files with 39 additions and 0 deletions

32
hardware.cpp Normal file
View File

@ -0,0 +1,32 @@
#include <UTFT.h>
#include <SD.h>
#include "ps2drv.h"
#include "memory.h"
#include "spiram.h"
#include "hardware.h"
Memory memory;
PS2Driver ps2;
spiram sram(SPIRAM_SIZE);
UTFT utft(TFT_MODEL, TFT_RS, TFT_WR, TFT_CS, TFT_RST);
bool hardware_init() {
ps2.begin(KBD_DATA, KBD_IRQ);
pinMode(SD_CS, OUTPUT);
bool sd = SD.begin(SD_CS, 3, SD_SPI);
#if defined(TFT_BACKLIGHT)
pinMode(TFT_BACKLIGHT, OUTPUT);
digitalWrite(TFT_BACKLIGHT, HIGH);
#endif
utft.InitLCD();
extern uint8_t SmallFont[];
utft.setFont(SmallFont);
sram.begin(SPIRAM_CS, SPIRAM_SPI);
return sd;
}

View File

@ -32,4 +32,11 @@
#define SD_CS PF_3
#define SD_SPI 1
bool hardware_init(void);
extern class PS2Driver ps2;
extern class spiram sram;
extern class UTFT utft;
extern class Memory memory;
#endif