eBook reader

The place to share and discuss your Ultibo projects.
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

eBook reader

Postby Gavinmc42 » Sat Feb 09, 2019 11:43 am

Been reading about OpenVG uses and ebook reader came up.
Not sure why I missed this before, but it should be a relatively simple application just to read text.
Mind you, there is not many OpenVG examples around.
Plenty for libraries that use OpenGL to emulate OpenVG :o

The next level is to read PDF's.
Does anyone know if Lazarus/FPC can do this?
Fpvectorial seems like the best place to start but rendering would be different.
Don't know much about PDF file format, time to learn.
https://blog.idrsolutions.com/2010/04/u ... es-stored/
Learning already :D

The much bigger step, next year? is then reading HTML pages, a mini browser.

But in the mean time ...
Some sort of menu is needed, file selection etc.
But an eReader could be extended into a MP3 player etc
Been a while since I themed my Rockbox , oh look a LCARS theme
http://themes.rockbox.org/index.php?allthemes

I have been looking at OS's for the last year or so and about the only one that does not look like Windows/Linux clones is DexOS.
This recently made it to the top of my list due to The Orville.
I started to notice the colour themes and computer graphics.
Not the flat designs like the StarTrek LCARS, which are now everywhere.
Old 3D themes are around but The Orville blended textures look interesting.

File manager, text display,music, video player and calculator. the start of an OS.
Hmm what OS do eReaders use?
The New Hope?
https://hackaday.com/2018/07/25/hope-xi ... e-readers/
https://www.clearinkdisplays.com/
Finally outdoor displays.
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: eBook reader

Postby Gavinmc42 » Mon Feb 25, 2019 11:42 am

I was going to use a Orville theme for this project but after looking at lots of screen shots they don't make much sense apart from looking pretty.

This eBook reader is going to be a full PDA project but Steam punk themed.
Got lots of tweaks to do and some font stuff to figure out, ie I and J positioning.
Wasted so much time looking for help and tuts on OpenVG.

This is just a few hours work, I'm a slow coder, with lots more to learn ;)
Fix Keyboard and make numerical version as the start of a steampunk calculator min app.
Easy to make a fitaly keyboard?

Going through old posts from 2016/2017, do I use Oberon as the PDA OS?
So many of those 2016 wishes and dreams are now possible, time to make a list?

New vintage style PC keyboard sell for $hundreds :o
I need a new keyboard, these $10 silicon rubber ones are really bad but coffee proof :lol:
Time to covert the old boat anchor IBM AT Keyboard to USB?

Code: Select all

unit uishapes;

{$mode objfpc}{$H+}

interface

uses
  Classes,
  SysUtils,
  OpenVG,       {Include the OpenVG unit so we can use the various types and structures}
  VGShapes,     {Include the VGShapes unit to give us access to all the functions}
  VC4;


procedure Keybutton(X,Y,R,FO:VGfloat; Index:LongWord );
procedure pdakeyboard() ;

implementation


const
{The names of all the available shapes}
Shapenames:array[0..11] of String = (
 'Enter',
 'Esc',
 'Tab',
 'Shift',
 'Alt',
 'Ctrl',
 'CapsLock',
 'Delete',
 'Insert',
 'Home',
 'End',
 'PSC');

 Letters:array[0..45] of String = (
 '1',
 '2',
 '3',
 '4',
 '5',
 '6',
 '7',
 '8',
 '9',
 '0',
 'Q',
 'W',
 'E',
 'R',
 'T',
 'Y',
 'U',
 'I',
 'O',
 'P',
 'A',
 'S',
 'D',
 'F',
 'G',
 'H',
 'J',
 'K',
 'L',
 ';',
 'Z',
 'X',
 'C',
 'V',
 'B',
 'N',
 'M',
 ',',
 '.',
 '/',
 '"',
 '=',
 '*',
 '-',
 '+',
 '$'

 );

var
 Width:Integer;  {A few variables used by our shapes example}
 Height:Integer;

 Top:VGfloat;

 KeypadScale:VGfloat;

 KeypadX:VGfloat;
 KeypadY:VGfloat;
 KeypadW:VGfloat;
 KeypadH:VGfloat;
 KeypadR:VGfloat;
 KeypadRim:VGfloat;

 Keyradius:VGfloat;
 SpacingW:VGfloat;
 SpacingH:VGfloat;

 KPadX:VGfloat;
 KPadY:VGfloat;

 KX:VGfloat;
 KY:VGfloat;
 KFO:VGfloat;

 SC:PVGfloat;


 Fontsize:Integer;

 Keylabel:TVGShapesColor;
 Keybk:TVGShapesColor;

 index:LongWord;


 procedure VGCoordPoint(X,Y,Size:VGfloat;const Color:TVGShapesColor);
 begin
 {}
 {A utility function used by the main program code to place a colored point in the picture}
 VGShapesFill(128,0,0,0.3);
 VGShapesCircle(X,Y,Size);
 VGShapesSetFill(Color);
 end;


 procedure Keybutton(X,Y,R, FO:VGfloat; Index:LongWord );
 begin
  VGShapesStrokeWidth(R / 10);
  VGShapesStroke(181,166,66,1);
  VGShapesFill(0,0,0,1);
  VGShapesCircle(X,Y,R);
  VGShapesFill(181,166,66,1);
  VGShapesText(X - FO ,Y -FO ,Letters[Index],VGShapesSansTypeface,Fontsize);
 end;

 procedure pdakeyboard() ;
 begin
   {Initialize OpenVG and the VGShapes unit}

   VGShapesInit(Width,Height);

   {Calculate some default values based on the size of the screen, remember that
    OpenVG coordinates put 0,0 at the bottom left NOT the top left like most other
    things}
   keypadScale :=  0.4;
   KPadX := 0.3;
   KPadY := 0.5 ;

   KeypadX:=Width * KPadX;
   KeypadY:=Height * KPadY;
   KeypadW:=Width * keypadScale;
   KeypadH:=KeypadW /2 ;
   KeypadR:=KeypadW / 20;
   KeypadRim:=KeypadW / 60;

   Keyradius:= KeypadW / 14;


   SpacingW:=KeypadW / 12;
   SpacingH:=KeypadH / 5;

   Fontsize:=Trunc(KeypadW * 0.03);
   KFO:=KeypadW * 0.015;
   //Keylabel := (181,166,66,1);

   {Start a picture the full width and height of the screen}
   VGShapesStart(Width,Height);


  {Steam punk keyboard}
    VGShapesStrokeWidth(KeypadRim);
    VGShapesStroke(181,166,66,1);
    VGShapesFill(20,20,40,1);
    VGShapesRoundrect(KeypadX,KeypadY,KeypadW,KeypadH,KeypadR,KeypadR);

    for Index := 0 to 9 do
      begin
        KX := SpacingW + KeypadX + Index * SpacingW  ;
        KY := KeypadY + 4 * SpacingH;
        Keybutton(KX, KY, Keyradius,KFO,Index);
      end;

    for Index := 0 to 9 do
      begin
        KX := (3 * SpacingW /2 )+ KeypadX + Index * SpacingW  ;
        KY := KeypadY + 3 * SpacingH;
        Keybutton(KX, KY, Keyradius,KFO,Index + 10);
      end;

    for Index := 0 to 9 do
      begin
        KX := SpacingW + KeypadX + Index * SpacingW  ;
        KY := KeypadY + 2 * SpacingH;
        Keybutton(KX, KY, Keyradius,KFO,Index + 20);
      end;

    for Index := 0 to 9 do
      begin
        KX := (3 * SpacingW /2 ) + KeypadX + Index * SpacingW  ;
        KY := KeypadY + 1 * SpacingH;
        Keybutton(KX, KY, Keyradius,KFO,Index + 30);
      end;

  {End our picture and render it to the screen}
  VGShapesEnd;

  {Sleep for 10 seconds}
  Sleep(100000);

  {Clear our screen, cleanup OpenVG and deinitialize VGShapes}
  VGShapesFinish;

  {VGShapes calls BCMHostInit during initialization, we should also call BCMHostDeinit to cleanup}
  BCMHostDeinit;
end;

end.
Attachments
steamkeyboard.jpg
steamkeyboard.jpg (152.19 KiB) Viewed 678 times
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: eBook reader

Postby Gavinmc42 » Tue Feb 26, 2019 8:14 am

Now to turn this into a flylng calculator screen saver?
One of the things I don't have is a way to benchmark OpenVG.
Still need to test scaling, see what happens to these keyboards and calculators at various sizes.

Add a steampunk version of the clock, which will be pointless unless I have an RTC.
With a RTC an alarm clock could be made with a Zero power on circuit.
File Manager next and a simple UI to select these apps.

Lots of code to still go behind everything but making the OpenVG SteamPunk theme turned out much easier than I expected.
No idea how to do click on button event yet.
Attachments
SPcalculator1.jpg
SPcalculator1.jpg (102.65 KiB) Viewed 662 times
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: eBook reader

Postby Gavinmc42 » Wed Feb 27, 2019 12:49 pm

Loving this OpenVG stuff, just tell it a position and scale and bingo new window(calulator).
Not sure how many this can do, time to try animation?
Grabbing, resizing and moving them around is full windowing?
As yes there is a bunch of tiny 0000's on the small calculators.
OpenVG handles the sizing of them too.

How to do focus on odd shapes with no windows frames?
Frameless Windows? Call them Holes? Brasses.
The keypad and keyboard have brass framing, brass framed clock?
Time to look for some Victorian fonts, Roman Numerals?
When did people stop reading roman numeral clocks?
My Grandparents had them.
Attachments
calcs.jpg
calcs.jpg (292.49 KiB) Viewed 649 times
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: eBook reader

Postby Gavinmc42 » Sun Mar 03, 2019 8:29 am

I now know why I went for that 40% keyboard layout.
My first computer was a ZX81 that I made a switch based keyboard for.
Spent weeks Lettersetting the alt functions.
http://xahlee.info/kbd/Sinclair_ZX81_keyboard.html
So that arrangement has been stuck in my head for about 38years :D
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: eBook reader

Postby Gavinmc42 » Tue Mar 05, 2019 12:48 am

Lots of tweaks still needed for the looks, but time to move onto the text reading/display part of the project.
Book reader based on the book scroll look.
Mouse/button focus/actions can then be worked on.
Left mouse button to open icon and scale it, right mouse button to shrink back down to icon.
Use config.ini file to keep track.

Because the tiny scaled versions worked they will become the icons.
That way I don't have to worry about pixels and they can scale to any size.
Will be interesting to see if the clock can still be readable at icon size ;)

Need to dig out some Victorian era Calendar designs too.
Perhaps a Crookes tube terminal console screen.

Some benchmark method is needed to see how much VC4 grunt is being used up.
A couple of analog dial gauges to check the pressure in the boiler :D
Since SteamOS has been taken, I have been calling this PunkOS.

I am having so much fun do this virtual SteamPunk I have designing a real version with a split keyboard with middle track ball.
I have disassembled one of my old MS ergo keyboards, no wonder they failed, membrane rubbish.
After wearing out three in the 90's I never got MS ergos again.
Being going through my keyboard collection, there is a lot, I don't want to count them :lol:
Not sure why I ended up with about ten silicone roll up ones? Emergencies use?
My best memories of coding are from 80's when I had the ZX81 with diy Alps keyswitches and the Microbee's mech switches and then IBM F/M buckling springs.

Time for a serious keyboard, Colemak, Cherry browns in clear, brass plate and wood and nice quartz track ball with 3 axis sensing.
And not just a Keyboard, full embedded Pi3B+, portable wooden case with screen. 1880's laptop?
Since this is PunkOS perhaps a purple and black one with Rose or smoky Quartz track ball for the wife?
Time to stop dreaming, like I will ever have time to do this ;)

But I do have the brass and those quartz balls somewhere, probably buried under those old computer bits?
Brass and enamel keycaps? Wow 45+ years since I did any enameling, time flies.
Those should outlast any double shot ABS keycaps.
Too bad about the Cherry's, what lasts longer than them? Optical?
Attachments
PunkOS.jpg
PunkOS.jpg (385.28 KiB) Viewed 598 times
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: eBook reader

Postby Gavinmc42 » Wed Mar 27, 2019 11:23 am

Been a few distractions recently, like making a real mechanical keyswitch keyboard ;)
I also realized I did not know how a OS works, what a waste of time that mostly was.

All those basic "How to make a OS" books, tuts, googling, reading, learning etc are mostly a waste of time.
Ultibo already does all that and much, much more.

Turns out the missing pieces I needed to learn have been here already buried in pik33's Windowing Manager.
It has only taken me 2 years to understand it.

Ultibo = Unikernel?
Yep I don't know what to call Ultibo any more.
It's not baremetal, it's not an OS.
A big box of OS pieces, just join them all together, bingo an OS of any type?

The OpenVG GUi is now at a stage that I grok it.
Time to look at how pik33 uses Ultibo to connect the pieces.

All those OS books and stuff are so old almost none relates anymore.
I have been making OS's and did not even realize it.
Single user, single application but still an OS.

Only bonus was stumbling on AROS, a free version of the AmigaOS, a computer I always wanted but could not afford.
Coming soon to Raspberry Pi? As well as Free Pascal on AROS:o

And now I finally know where I saw those red and white balls of pik33's before, the Amiga logo ;)
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: eBook reader

Postby Gavinmc42 » Thu Apr 04, 2019 11:18 am

At that price I could not resist.
https://core-electronics.com.au/3-5inch ... -pi-3.html
Install worked perfectly in Raspbian.

Getting it going as my eReader screen in Ultibo?
Well that's what learning is all about.
Just guessing, but it looks like SPI based 8 bit shift registers converting to the 16/18bit parallel LCD bus.

Probably a wiser choice would have been a DPI LCD.
Or even HDMI one.
A fool and his money are soon parted?
hansotten
Posts: 55
Joined: Thu Feb 04, 2016 7:07 am

Re: eBook reader

Postby hansotten » Thu Apr 04, 2019 5:25 pm

Gavinmc42 wrote:Install worked perfectly in Raspbian.



A typical framebuffer to SPI copy driver solution. Works indeed in Raspbian, otherwise for Ultibo a waste of money or diy.
Gavinmc42
Posts: 1595
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: eBook reader

Postby Gavinmc42 » Fri Apr 05, 2019 1:42 am

Works indeed in Raspbian, otherwise for Ultibo a waste of money or diy.

Hmm, 74HC4040 and 2 x 74HC4094, so 16 bit data - 565 colour format?
Waveshare model B? So probably 20MHz SPI, fps?

Yep the LCD guys have learned their lessons, no open source versions due to cloning.
Same thing with 4D Systems.

Anyway I wanted one to test to see if OpenVG on Raspbian using AJ Starks Go libraries will show up on the LCD.
Not too sure how OpenVG works on SPI/DPI yet.
There are so many things I have yet to do with Pi's.

I did get another Microbit and Pi Zero W at the same time, so shipping was not too bad and it was overnight ;)

Waveshare now have HDMI versions down to 3.5" 480x320 IPS, they just have not made it down here yet.
Finally displays are getting off the shelf usable.
A bit clunky for a tiny eReader but ok for prototyping one for software testing.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest