|
Post by alexfish on Feb 23, 2024 1:40:32 GMT 1
Hi All Start of pi gpio & pico pgpio have set up a pico with a screen code wise this pico has a fake desktop with user input on the touchscreen in short it does not need to be connected to a computer to run it also has a sdcard :: Yes have added Widgets aka tool kit : hence gui wise it is EVENT driven so from the de click the icon Terminal have also posted :: Hence in short, not sure if the terminal idea would work pi@raspberrypi:~ $ cat /dev/ttyACM1 Terminal
pico:~
pico:~exit
Now the user can use with or without + can send data to the pico and store on the sdcard, or send commands posting soon thought would add:: puzzled by that exit to quit from while(true) the spi pins use interrupt : internal to the while(1) use scan for interrupt IE while (1) { TP_Scan(0); } BR Alex Picky Attachments:
|
|
|
Post by alexfish on Feb 23, 2024 3:10:57 GMT 1
and so to Yes: internally to the sdk make a lib Then link to the lib sitting here the build with make all of the stack -j4 from the terminal pi@raspberrypi:~/pico4/Pico-ResTouch-LCD-2.8-Horizontal-Fix/build $ make -j4 [ 2%] Performing build step for 'ELF2UF2Build' [ 3%] Built target bs2_default [ 3%] Built target font [ 3%] Performing build step for 'PioasmBuild' [ 4%] Built target bs2_default_padded_checksummed_asm [100%] Built target elf2uf2 [100%] Built target pioasm [ 18%] Built target config [ 18%] No install step for 'ELF2UF2Build' [ 18%] No install step for 'PioasmBuild' [ 18%] Completed 'ELF2UF2Build' [ 32%] Built target sdcard [ 32%] Completed 'PioasmBuild' [ 46%] Built target fatfs [ 48%] Built target ELF2UF2Build [ 50%] Built target PioasmBuild Scanning dependencies of target lcd [ 50%] Building C object lib/lcd/CMakeFiles/lcd.dir/LCD_Touch.c.obj [ 50%] Linking CXX static library liblcd.a [ 65%] Built target lcd [ 79%] Built target examples [ 80%] Linking CXX executable main.elf [100%] Built target main pi@raspberrypi:~/pico4/Pico-ResTouch-LCD-2.8-Horizontal-Fix/build $ so yes this is my 4th attempt to get this working ' over 6 weeks but now = success in with those trips found that can access STRUCT bits with one command in case of a touchscreen in the liblcd what is the mouse : also for the widget tool kit anyway this type of macro works yes that's what the mouse cords are I just shook my head when I finally realized what these two bit are and what do do with the bits after the callback :: tip move the mouse away from widgets that have a callback #define MOUSEX sTP_Draw.Xpoint #define MOUSEY sTP_Draw.Ypoint the graphics stack now has the hug canvas api in the rest of widgets are in progress so for say EDIT widget can get or set #define EDIT EDIT.text UPDATED:: finally worked out images, so point and click games = game on canvas wise = PICTURE UPDATED : FrameBuffer Added + Image Scrolling in Horizontal OR Vertical BR Alex
|
|
|
Post by alexfish on Feb 24, 2024 12:57:31 GMT 1
Heads up on bmp images from the as regards PICO with a screen = use GIMP export 24bit saved as image.bmp in regards the 2.8 inch displays 320x240 ratio wise this is a odd ball ratio in relation to the bmp hence will find 320x240 picture is short in the vertical by 27pix , allowing for the ratio then appears more space is below the image possible not bad if require dashboard below then bit above looks more wide screen bad deal, will have to reduce the image height in relation to the canvas, sitting hear no other method works IE flip the pic in the vertical then resize the image down from the top of the canvas :: Phew ,but it works have seen many posts about image does not show: now looking to see if any the can be done in the api. UPDATED: have worked out where to look in the libs : a fix for this horizontal may be possible ,there are 8bits in one are of bat 3bits in another + 2bits in final area so multiply those bits = some task, since there is no guarantee in its present mode IE why vertical mode and its orientation of the image is not flipped All looks good , for horizontal = time will tell Hence now looking at the bits required for gpio functions 2nd UPDATE:: digging deeper for the draw function:: It is in the FATfs here found that one can place the image at x,y position Demo code as an integrated build = x=0, y=0 + indicates full screen + clears the BG Looking at this the possible = multi image The Bits 2.8 inch screen header first uint32_t Storage_OpenReadFile(uint8_t Xpoz, uint16_t Ypoz, const char* BmpName) bit for the screen /* Synchronize f_read right in front of the image data */ f_open(&file1, (TCHAR const*)BmpName, FA_READ); f_read(&file1, aBuffer, index, &BytesRead); if(LCD_2_8 == id){ for (i = 0; i < height; i ++) { f_read(&file1, aBuffer, 360, (UINT *)&BytesRead); f_read(&file1, aBuffer + 360, 360, (UINT *)&BytesRead); for (j = 0; j < width; j ++) { k = j * 3; pic[i*240+j] = (uint16_t)(((aBuffer[k + 2] >> 3) << 11 ) | ((aBuffer[k + 1] >> 2) << 5) | (aBuffer[k] >> 3)); } } /* LCD_SetCursor if dont write here ,it will display innormal*/ LCD_SetCursor(0, 0); DEV_Digital_Write(LCD_DC_PIN, 1); DEV_Digital_Write(LCD_CS_PIN, 0); spi_set_baudrate(SPI_PORT,30*1000*1000); for(index=0;index<76800;index++){ SPI4W_Write_Byte((pic[index] >> 8) & 0xFF); SPI4W_Write_Byte(pic[index] & 0xFF); } DEV_Digital_Write(LCD_CS_PIN, 1); And The uint8_t Xpoz, uint16_t Ypoz, is not used :: Puzzled , so am I Quick test using xpos ypos To Me that code is BUGGY:: thinking hacking these bits Calling up my calculator + Found out can the picture can be wrapper in the vertical when in horizontal mode BR Alex Picky canvas size 320x240, picture scaled, then move picture down from the top Attachments:
|
|
|
Post by alexfish on Mar 2, 2024 21:38:41 GMT 1
Found it
original
if(LCD_2_8 == id){ for (i = 0; i < height; i ++) { f_read(&file1, aBuffer, 360, (UINT *)&BytesRead); f_read(&file1, aBuffer + 360, 360, (UINT *)&BytesRead); for (j = 0; j < width; j ++) { k = j * 3; pic[i*240+j] = (uint16_t)(((aBuffer[k + 2] >> 3) << 11 ) | ((aBuffer[k + 1] >> 2) << 5) | (aBuffer[k] >> 3)); } }
Fixed
if(LCD_2_8 == id){ for (i = 0; i < width; i ++) { f_read(&file1, aBuffer, 360, (UINT *)&BytesRead); f_read(&file1, aBuffer + 360, 360, (UINT *)&BytesRead); for (j = 0; j < width; j ++) { k = j * 3; pic[i*240+j] = (uint16_t)(((aBuffer[k + 2] >> 3) << 11 ) | ((aBuffer[k + 1] >> 2) << 5) | (aBuffer[k] >> 3)); } }
UPDATE: have checked the 1st build of the "Pico-ResTouch-LCD-2.8-Horizontal-Fix" from git hub
The original code is correct
Findings
1 . only code seen by image wise , sitting here , all done with gimp and no imports of images ".png" further work required and all = done in gimp . 24bit and in px/pixel, define the project first
2 . image must be 320x240
3. the image must be flipped in the vertical
4. at present Cursor Xpos must be 0 , Ypos can be scrolled much like a ring buffer
5. at my end , further work required on this Xpos + this pixel data spanning the 24 bit color ie(3bytes)
6. the images produced can not be seen by normal default viewers, use ImageMagick
UPDATE: image scroll Horizontal : Done
BR Alex
|
|