add support for PICOMPUTERMAX

pull/9/head
jean-marcharvengt 2021-08-20 17:25:50 +02:00
rodzic 65a5fa3785
commit e93881aaed
32 zmienionych plików z 239 dodań i 30 usunięć

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -26,6 +26,7 @@
#define TFT_DC 28
#define TFT_CS 13 // 255 for LORES ST7789 (NO CS)
#define TFT_RST 255 // 255 for ILI/ST if connected to 3.3V
#define TFT_BACKLIGHT 255 // hardwired to 3.3v
// SD (see SPI0 in code!!!)
#define SD_SPIREG spi0
@ -67,9 +68,15 @@
#define TFT_SCLK 18
#define TFT_MOSI 19
#define TFT_MISO 255 // Not required, used for DC...
#define TFT_DC 16 //28
#define TFT_CS 255 //17 // 255 for LORES ST7789 (NO CS)
#define TFT_RST 21 //255 // 255 for ILI/ST if connected to 3.3V, required by 256x256 ST
#define TFT_DC 16
#define TFT_RST 21
#ifdef PICOMPUTERMAX
#define TFT_CS 17
#define TFT_BACKLIGHT 20
#else
#define TFT_CS 255
#define TFT_BACKLIGHT 255
#endif
// SD (see SPI0 in code!!!)
#define SD_SPIREG spi1

Wyświetl plik

@ -7,10 +7,10 @@
//#define PICOMPUTER 1
#define MCUME_REV1 1
#define PICOMPUTERMAX 1
//#define MCUME_REV1 1
//#define MCUME_REV2 1
#ifdef PICOMPUTER
#define ST7789 1
#define LOHRES 1
@ -19,6 +19,16 @@
#define HAS_SND 1
#endif
#ifdef PICOMPUTERMAX
#undef LOHRES
#undef FLIP_SCREEN
#define ST7789 1
#define ST7789_POL 1
#define INVX 1
#define HAS_SND 1
#define PICOMPUTER 1
#endif
#ifdef MCUME_REV1
#define USE_VGA 1
#define INVX 1
@ -26,8 +36,8 @@
#endif
#ifdef MCUME_REV2
#define USE_VGA 1
//#define ILI9341 1
//#define USE_VGA 1
#define ILI9341 1
#define INVX 1
#define HAS_SND 1
#endif

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -38,16 +38,17 @@ const unsigned short key_map1[] = {
*/
const unsigned short key_map1[] = {
20,26,8,21,23,28,25,12,18,19,0,
0, 4, 9, 7,22, 4,11,13,14,15,40,
0,6,27,29,224,5,17,16,225,44,
0,0,0,0
20,26,8,21,23, 28,25,12,18, 19,0x100+39,
0x100+30, 4, 9,7, 22, 10,11,13,14, 15,40,
0, 6,27,29,224,5, 17,16,225,44,
0x100+36,0x100+34,0x100+37,0x100+35
};
const unsigned short key_map2[] = {
30,31,32,33,34,35,36,37,38,39,0,
0,0,0,0,0,0,0,0,0,0,0,
0, 0,0,0,0,0,0,0,0,0,
30,31,32,33,34,35,36,37,38,39,0x100+19,
// 0x100+20, 0x100+26,0x100+8, 0x100+21, 0x100+23,0x100+28,0x100+25,0x100+12, 0x100+18,0x100+19,0,
0x100+31, 0x100+4 ,0x100+9, 0x100+7, 0x100+22,0x100+10,0x100+11,0x100+13, 0x100+14,0x100+15,0x100+40,
0,0,0,0,0,0x100+5, 0x100+17,0x100+16,0x100+225,0x100+44,
0,0,0,0
};

Wyświetl plik

@ -21,7 +21,17 @@ TFT_T_DMA tft;
static int skip=0;
#include "hardware/clocks.h"
#include "hardware/vreg.h"
int main(void) {
vreg_set_voltage(VREG_VOLTAGE_1_05);
set_sys_clock_khz(125000, true);
// set_sys_clock_khz(150000, true);
// set_sys_clock_khz(133000, true);
// set_sys_clock_khz(200000, true);
// set_sys_clock_khz(225000, true);
// set_sys_clock_khz(250000, true);
stdio_init_all();
#ifdef USE_VGA
tft.begin(VGA_MODE_320x240);

Wyświetl plik

@ -241,14 +241,16 @@ static void updateKeyboard (void)
}
else {
// scan all possibilities
int key = hk & 0xff;
for (int j=0;j<8;j++) {
for(int i=0;i<5;i++){
if ( (k == map_qw[j][i]) || (hk == map_qw[j][i]) ) {
if ( (k == map_qw[j][i]) || (key == map_qw[j][i]) ) {
keyboard[j] &= ~ (1<<(4-i));
nb_keys++;
}
}
}
}
if (hk & 0x100) keyboard[0] &= ~ 1;
}
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -296,6 +296,20 @@ int emu_ReadKeys(void)
// gpio_set_dir(cols[i], GPIO_IN);
keymatrix[i]=row;
//if (row) keymatrix_hitrow=i;
}
#ifdef PICOMPUTERMAX
// Swap ALT and DEL
unsigned char alt = keymatrix[0] & 0x02;
unsigned char del = keymatrix[5] & 0x20;
keymatrix[0] &= ~0x02;
keymatrix[5] &= ~0x20;
if (alt) keymatrix[5] |= 0x20;
if (del) keymatrix[0] |= 0x02;
#endif
for (int i=0;i<6;i++){
row = keymatrix[i];
if (row) keymatrix_hitrow=i;
}
@ -820,7 +834,6 @@ void emu_init(void)
{
sd_init_driver();
FRESULT fr = f_mount(&fatfs, "0:", 1);
//emu_FileSystemInit();
strcpy(romspath,ROMSDIR);
nbFiles = readNbFiles(romspath);
@ -835,6 +848,10 @@ void emu_init(void)
joySwapped = false;
#endif
// Flip screen if UP pressed
if (emu_ReadKeys() & MASK_JOY2_UP)
tft.flipscreen(true);
toggleMenu(true);
}

Wyświetl plik

@ -15,8 +15,12 @@
#define SPICLOCK 60000000
#ifdef ST7789
#ifdef ST7789_POL
#define SPI_MODE SPI_CPOL_0
#else
#define SPI_MODE SPI_CPOL_1
#endif
#endif
#ifdef ILI9341
#define SPI_MODE SPI_CPOL_0
#endif
@ -215,12 +219,18 @@ TFT_T_DMA::TFT_T_DMA()
_mosi = TFT_MOSI;
_sclk = TFT_SCLK;
//_miso = TFT_MISO;
_bkl = TFT_BACKLIGHT;
gpio_init(_dc);
gpio_set_dir(_dc, GPIO_OUT);
gpio_init(_cs);
gpio_set_dir(_cs, GPIO_OUT);
digitalWrite(_cs, 1);
digitalWrite(_dc, 1);
if (_bkl != 0xff) {
gpio_init(_bkl);
gpio_set_dir(_bkl, GPIO_OUT);
digitalWrite(_bkl, 1);
}
}
@ -282,7 +292,6 @@ void TFT_T_DMA::begin(void) {
sleep_ms(200);
}
const uint8_t *addr = init_commands;
digitalWrite(_cs, 0);
#ifdef ILI9341
@ -313,7 +322,7 @@ void TFT_T_DMA::begin(void) {
digitalWrite(_dc, 1);
digitalWrite(_cs, 1);
#endif
#ifdef ST7789
#ifdef ST7789
uint8_t numCommands, numArgs;
uint16_t ms;
numCommands = *addr++; // Number of commands to follow
@ -357,7 +366,7 @@ void TFT_T_DMA::begin(void) {
#ifdef ST7789
if (TFT_REALWIDTH != TFT_REALHEIGHT)
{
flipscreen(true);
//flipscreen(true);
}
#endif
};

Wyświetl plik

@ -209,7 +209,7 @@ class TFT_T_DMA
protected:
uint8_t _rst, _cs, _dc;
uint8_t _miso, _mosi, _sclk;
uint8_t _miso, _mosi, _sclk, _bkl;
bool flipped=false;
void wait(void);