Dear friends, good afternoon!
I finally managed to add graphics. But I had to omit the function descriptions in the extension.
Currently, the extension includes touchscreen scanning functions, but without calibration, in their raw form. File and directory management functions allow you to rename, delete, and create directories and files.
(rename-file path new_name)
(delete-file path)
(ensure-directories-exist path)
The streaming mechanism in this version allows file copying in Lisp. (Open two streams simultaneously)
(defun copy-file (source dest)
(if (and (stringp source) (stringp dest))
(with-sd-card (wrstr dest 2)
(with-sd-card (rdstr source 0)
(let ((c 0))
(loop
(setq c (read-byte rdstr))
(if (equal c nil) (return))
(write-byte c wrstr)
))) t)
nil
))
I had difficulty detecting the end of the file. An addition to the SDread function were nessessary. Perhaps this is the cost of leaving Arduino.
int SDread () {
if (LastChar) {
char temp = LastChar;
LastChar = 0;
return temp;
}
char c ;
fres = f_read(&SDgfile, &c, 1, &uint_result);
if(fres != FR_OK) return -1 ;
if(uint_result <= 0) return -1 ;
return 0x0ff & c ;
}
The extension also contains graphical functions for loading up to 50 fonts from prepared binary files. They are loaded into external SRAM, half of which is allocated to the lisp-workspace.
(load-font index FileName)
(set-font index)
Sets the font with number “index” as current font.
Addition functions for info about current font:
(getfontheight)
(getfontwidth)
(getfontinfo)
There’s a Qt-based program on my GitHub that converts system fonts to *.h format, which I then convert into binary files.
Two functions which allows to fill arbitrary user-drawn convex poligons :
(fill-init)
(... draw figure by lines, triangles, rectangles, circles... )
(fill-poly color)
Save a rectangular region to SD and read it back to the screen
(save-rect x y w h FileName)
(load-rect x y File Name)
Several examples of different fonts
And here is my uLisp-computer with external SRAM:
But for for present moment graphics only work with displays ILI9488.
These codes are for anyone who might find them useful.
Sincerely, Anatoly.