PaPiRus display
Chris Hall (132) 3510 posts |
At present I have included the code to write to a liquid ink display inside my GPS application SatNav. Ideally it would be a separate module, so that it could be used by any application. Functionally it is in two parts: one part builds up a sprite in memory from text and graphic input and the other part updates the display replacing what is there with the new sprite. This latter process takes about 5 seconds and so is only done on demand at infrequent intervals. It could be done in lots of individual steps by a module receiving null reason code Wimp_Poll events and uses the SPI interface (via another module) to communicate with the display. I am not sure how to write an application that exists as a module rather than in application space. This application would have the sole purpose of bulding up a sprite in its memory space and then, on demand, going through the update process with the display. I have not written any code in supervisor mode. What guidance there is describes how to write a module to add start commands and SYS calls. Are there any examples of a simple application module code? |
Rick Murray (539) 13422 posts |
Ordinarily modules don’t contain applications, they contain “services”. You call a SWI (from an application) and something happens. Here’s an idea of a module in C: https://www.heyrick.co.uk/blog/index.php?diary=20150323 You already know about my OLED module: https://www.heyrick.co.uk/blog/index.php?diary=20140426 What you might not have noticed is that it is licenced EUPL, so the source is available if you want to see how it was done: http://www.heyrick.co.uk/software/oled/
And it grinds to a halt outside of the desktop? If I was doing this, I would break the update into chunks (as you would with the app) and I’d initialise a counter and set up a CallBack. When the CallBack fires, do a little bit of work and update the counter so you know what needs to be done next and set up for another CallBack, and just keep repeating that until the display has been updated. |
Chris Hall (132) 3510 posts |
And it grinds to a halt outside of the desktop? Not that I know of. I haven’t tried it outside the desktop. Ordinarily modules don’t contain applications, But they can, I understand. Many thanks. I’ll have to convert it to BASIC assembler. How long after a return does the callback fire? There needs to be a certain delay between chunks (something like 5ms plus I think). |
Rick Murray (539) 13422 posts |
If it’s a Wimp application, it’ll cease the moment polling stops (error box, command line, etc).
Can be done. Poke around the OS code to see how Draw/Edit/Paint do it.
Unquantifiable. One of the big doses of “random” in RISC OS. It’ll return when the system is “free” and in a safe state to use. Might be practically immediately, might be “in a while”.
It might then be an idea to use a CallAfter with a short delay and get that to set up the next CallBack. This way should also allow more time for the foreground apps (instead of CallBack after CallBack firing). |