diff --git a/MCUME_pico/bin/PICOMPUTER/.DS_Store b/MCUME_pico/bin/PICOMPUTER/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/MCUME_pico/bin/PICOMPUTER/.DS_Store and /dev/null differ diff --git a/MCUME_pico/bin/PICOMPUTER/mcume_pico64.uf2 b/MCUME_pico/bin/PICOMPUTER/mcume_pico64.uf2 index f7c143b..a5ef68c 100644 Binary files a/MCUME_pico/bin/PICOMPUTER/mcume_pico64.uf2 and b/MCUME_pico/bin/PICOMPUTER/mcume_pico64.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTER/mcume_pico800.uf2 b/MCUME_pico/bin/PICOMPUTER/mcume_pico800.uf2 index 1344231..f096956 100644 Binary files a/MCUME_pico/bin/PICOMPUTER/mcume_pico800.uf2 and b/MCUME_pico/bin/PICOMPUTER/mcume_pico800.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTER/mcume_pico81.uf2 b/MCUME_pico/bin/PICOMPUTER/mcume_pico81.uf2 index e20ca47..0c73eaf 100644 Binary files a/MCUME_pico/bin/PICOMPUTER/mcume_pico81.uf2 and b/MCUME_pico/bin/PICOMPUTER/mcume_pico81.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTER/mcume_picocolem.uf2 b/MCUME_pico/bin/PICOMPUTER/mcume_picocolem.uf2 index 5a2c50b..9d6ca6b 100644 Binary files a/MCUME_pico/bin/PICOMPUTER/mcume_picocolem.uf2 and b/MCUME_pico/bin/PICOMPUTER/mcume_picocolem.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTER/mcume_picoo2em.uf2 b/MCUME_pico/bin/PICOMPUTER/mcume_picoo2em.uf2 index f2f2dcf..1503cfd 100644 Binary files a/MCUME_pico/bin/PICOMPUTER/mcume_picoo2em.uf2 and b/MCUME_pico/bin/PICOMPUTER/mcume_picoo2em.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTER/mcume_picospeccy.uf2 b/MCUME_pico/bin/PICOMPUTER/mcume_picospeccy.uf2 index 4e730db..1decbca 100644 Binary files a/MCUME_pico/bin/PICOMPUTER/mcume_picospeccy.uf2 and b/MCUME_pico/bin/PICOMPUTER/mcume_picospeccy.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTER/mcume_picovcs.uf2 b/MCUME_pico/bin/PICOMPUTER/mcume_picovcs.uf2 index fd46e65..ba43b50 100644 Binary files a/MCUME_pico/bin/PICOMPUTER/mcume_picovcs.uf2 and b/MCUME_pico/bin/PICOMPUTER/mcume_picovcs.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico64.uf2 b/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico64.uf2 new file mode 100644 index 0000000..070fd0f Binary files /dev/null and b/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico64.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico800.uf2 b/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico800.uf2 new file mode 100644 index 0000000..762236a Binary files /dev/null and b/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico800.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico81.uf2 b/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico81.uf2 new file mode 100644 index 0000000..30854ea Binary files /dev/null and b/MCUME_pico/bin/PICOMPUTERMAX/mcume_pico81.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTERMAX/mcume_picocolem.uf2 b/MCUME_pico/bin/PICOMPUTERMAX/mcume_picocolem.uf2 new file mode 100644 index 0000000..62f1ab7 Binary files /dev/null and b/MCUME_pico/bin/PICOMPUTERMAX/mcume_picocolem.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTERMAX/mcume_picoo2em.uf2 b/MCUME_pico/bin/PICOMPUTERMAX/mcume_picoo2em.uf2 new file mode 100644 index 0000000..f238821 Binary files /dev/null and b/MCUME_pico/bin/PICOMPUTERMAX/mcume_picoo2em.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTERMAX/mcume_picospeccy.uf2 b/MCUME_pico/bin/PICOMPUTERMAX/mcume_picospeccy.uf2 new file mode 100644 index 0000000..f029e3a Binary files /dev/null and b/MCUME_pico/bin/PICOMPUTERMAX/mcume_picospeccy.uf2 differ diff --git a/MCUME_pico/bin/PICOMPUTERMAX/mcume_picovcs.uf2 b/MCUME_pico/bin/PICOMPUTERMAX/mcume_picovcs.uf2 new file mode 100644 index 0000000..2bc2b3b Binary files /dev/null and b/MCUME_pico/bin/PICOMPUTERMAX/mcume_picovcs.uf2 differ diff --git a/MCUME_pico/config/iopins.h b/MCUME_pico/config/iopins.h index 1898fdc..d25067e 100644 --- a/MCUME_pico/config/iopins.h +++ b/MCUME_pico/config/iopins.h @@ -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 diff --git a/MCUME_pico/config/platform_config.h b/MCUME_pico/config/platform_config.h index 989a0f2..672fc09 100644 --- a/MCUME_pico/config/platform_config.h +++ b/MCUME_pico/config/platform_config.h @@ -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 diff --git a/MCUME_pico/pico5200/emuapi.cpp b/MCUME_pico/pico5200/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/pico5200/emuapi.cpp +++ b/MCUME_pico/pico5200/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/pico64/emuapi.cpp b/MCUME_pico/pico64/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/pico64/emuapi.cpp +++ b/MCUME_pico/pico64/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/pico800/emuapi.cpp b/MCUME_pico/pico800/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/pico800/emuapi.cpp +++ b/MCUME_pico/pico800/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/pico81/emuapi.cpp b/MCUME_pico/pico81/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/pico81/emuapi.cpp +++ b/MCUME_pico/pico81/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/pico81/emuapi.h b/MCUME_pico/pico81/emuapi.h index d4ba868..6c45e5c 100644 --- a/MCUME_pico/pico81/emuapi.h +++ b/MCUME_pico/pico81/emuapi.h @@ -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 }; diff --git a/MCUME_pico/pico81/pico81.cpp b/MCUME_pico/pico81/pico81.cpp index e971618..643dfd3 100644 --- a/MCUME_pico/pico81/pico81.cpp +++ b/MCUME_pico/pico81/pico81.cpp @@ -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); diff --git a/MCUME_pico/pico81/zx81.c b/MCUME_pico/pico81/zx81.c index 7f8d92c..0d2d7a6 100644 --- a/MCUME_pico/pico81/zx81.c +++ b/MCUME_pico/pico81/zx81.c @@ -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; } } diff --git a/MCUME_pico/picocolem/emuapi.cpp b/MCUME_pico/picocolem/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/picocolem/emuapi.cpp +++ b/MCUME_pico/picocolem/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/piconofrendo/emuapi.cpp b/MCUME_pico/piconofrendo/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/piconofrendo/emuapi.cpp +++ b/MCUME_pico/piconofrendo/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/picoo2em/emuapi.cpp b/MCUME_pico/picoo2em/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/picoo2em/emuapi.cpp +++ b/MCUME_pico/picoo2em/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/picosnd/emuapi.cpp b/MCUME_pico/picosnd/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/picosnd/emuapi.cpp +++ b/MCUME_pico/picosnd/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/picospeccy/emuapi.cpp b/MCUME_pico/picospeccy/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/picospeccy/emuapi.cpp +++ b/MCUME_pico/picospeccy/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/picovcs/emuapi.cpp b/MCUME_pico/picovcs/emuapi.cpp index a9122c4..fa57abe 100644 --- a/MCUME_pico/picovcs/emuapi.cpp +++ b/MCUME_pico/picovcs/emuapi.cpp @@ -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); } diff --git a/MCUME_pico/tft_t/tft_t_dma.cpp b/MCUME_pico/tft_t/tft_t_dma.cpp index 90b033c..94198b5 100644 --- a/MCUME_pico/tft_t/tft_t_dma.cpp +++ b/MCUME_pico/tft_t/tft_t_dma.cpp @@ -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 }; diff --git a/MCUME_pico/tft_t/tft_t_dma.h b/MCUME_pico/tft_t/tft_t_dma.h index 9a69d3e..b7fcd9f 100644 --- a/MCUME_pico/tft_t/tft_t_dma.h +++ b/MCUME_pico/tft_t/tft_t_dma.h @@ -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);