Keyboard, Video, and Mouse Drivers!
Kye
Posts: 2,200
Happy New Year, everyone!
So, let me tell you a story. Ever since I got a hold of the propeller chip I have just been fascinated at it's awesome power and ability to do so much more that a BASIC Stamp. In fact, the propeller chip is more like a miniature computer than a micro controller. That being said, I plan to invest my time on it making device drivers for all sorts of wonderful applications for parallax community -· and here are some results.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/28/2009 4:37:23 AM GMT
So, let me tell you a story. Ever since I got a hold of the propeller chip I have just been fascinated at it's awesome power and ability to do so much more that a BASIC Stamp. In fact, the propeller chip is more like a miniature computer than a micro controller. That being said, I plan to invest my time on it making device drivers for all sorts of wonderful applications for parallax community -· and here are some results.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/28/2009 4:37:23 AM GMT
Comments
The download explains all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/28/2009 4:36:20 AM GMT
The download explains all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/28/2009 4:35:53 AM GMT
The download explains all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/28/2009 4:35:19 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/28/2009 4:32:18 AM GMT
Programming these drivers is a learning experience for me. That's why I plan to rewrite almost every useful driver for a project I have in mind in ASM with Spin as a glue to meld them all together.
The drivers are really built to be made stream lined so I took all the self calculating code of Chip's drivers and then rebuilt his from the ground up (its a lot easier to trouble shoot when you have a working version to compare with).
Now, about the keyboard and mouse drivers. I have only tested them using the parallax keyboard and mouse. I do believe the mouse driver will work with any mouse but I'm not so sure about the keyboard driver. I really don't have that many PS2 keyboards lying around to test my code with honestly.
I did add in however a lot of different timeouts to fix the wait indefinitely problem I saw in Chip's driver so the mouse or keyboard can be reattached any time without locking up the driver. The drivers effectively poll the mouse or keyboard to make sure they are still attached, and if they are not the driver then resets the key states and waits for the mouse or keyboard to be reattached.
...But the video driver is the real deal here. I woke up one day saying to myself that I would make a video driver that would be capable of displaying a resolution of 640x480 on just one cog. And I managed to do that, but I had to create my own character set in order for everything to work properly.
I tried to use the built in character font, but I ran into a nasty problem. The central loop which displays video only has enough time to access the memory twice during run time and only execute two instructions before going to the next tile. The loop cannot be modified or the driver will fail. This is because during the central loop the cog has only enough time to access the video buffer which points to the characters, and then get the character's pixels. There is not enough time to get new color information. And because the character set is interleaved I would only be able to display even or odd characters per row since I would only be able to change colors every row. Not exactly acceptable.
But since the character set is in editable memory you can use any type of bit tiled graphics you want to display all sorts of different characters and such. The character set included with the driver can easily be extended to display anything on screen. Also the characters can be edited during run time for such things as cursor overlay.
Anyway, post any questions or concerns.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/28/2009 4:38:21 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/7/2009 12:39:43 AM GMT
This looks like a useful set of drivers. And your code is well structured and well commented- keep it up!
Ross.
I have suggested a Prop with Video and Keyboard to do the display via Serial, so your code may be a good solution. He can later play with 6800 emulation on the prop
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439
cruising][noparse][[/noparse]url=http://www.bluemagic.biz]cruising[noparse][[/noparse]/url][/url]
This is a [noparse][[/noparse]b]bold[noparse][[/noparse]/b] test.
They won't be unmanaged though, it won't work correctly if I make them that way.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/7/2009 12:41:01 AM GMT
I'm a complete noob about to get stuck into some OSD so the video drivers are most welcome.
Do you have plans for higher resolution?
I have been lurking since the end of last year and recall yours and other peoples earlier attempts at video output with some people outputing larger than 640x480.
My particular interest is in Head Up Displays so vector graphics -> video is somewhere down the line for me.
I'm not yet fully aware what is already available in the forums and on the Propeller Object Exchange but the ability to size, position and rotate/scale simple objects in 3D is something I want to look into.
Simple objects for me means line, disc/circle/triangle/square, box/sphere.
Post Edited (ren) : 1/5/2009 5:58:37 AM GMT
There is a virtual VGA driver for the propeller that can do vector graphics at resolutions up to 1152x864 (2 colour) or 800x600 (4 color). You can find this driver as part of the VGA versions of SpaceWar or BattleZ0wned. It supports many of the standard Parallex graphics functions (e.g. text, arcs, lines, etc). But I have to warn you - running VGA at these resolutions currently requires 5 cogs!
The best way to see this driver in operation is to run one of the vector games that use it - for a version of SpaceWar that uses this driver, see the thread http://forums.parallax.com/forums/default.aspx?f=33&m=281452
Ross
You say you want to rework/make more drivers? Great! You've got a Mouse, Keyboard, and VGA driver working... Three things for a computer interface - How about wireless connections? Leon was nice enough to give us his C code for a wireless communication chip, but it would be great to have it ported to Spin/ASM. This would be a fantastic addition to the OBEX!
Here's the link to the thread:
http://forums.parallax.com/forums/default.aspx?f=25&m=317588
Keep it up!
The point of the video driver was to really allow flexible tile graphics on screen. If you notice the file is over 2000 lines of code (I wrote every single one -·3 days... on the character map) however, you can use the tile map and maybe one other spin processor to constantly change the memory allowing for interesting bit mapped tile displays. I encourage you to add whatever characters you need to the object so you can display circles or bar graphs or whatever - the driver is fully capable of that any type of graphics.
And the best part is that it all runs on one cog. I found the high resolution video drivers interesting but somewhat wasteful and harder to work with since there was so much going on in the spin interface. I believe the propeller chip will be a much better tool if everything is done is ASM rather than spin and spin·should only used to connect files together to solve the multiprocoessor headache problem.
In other news. I'm not sure if its possible to make it run at a higher resolution. The processor was barely making it even a 640x480.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
I've finalized the drivers now!
A full summary of operation is included, with electrical connections and such!
The pins can now be changed easily and the drivers now self calculate at run time!
All the methods are fully protected!
You can now get deltas from the mouse!
The character set is now improved!!!
AND!
COMBO KEYBOARD AND MOUSE DRIVERS FOR THE PROPELLER DEMO BOARD/PROPELLER·PROTBOARD·AND HYRDA SYSTEM.
100% PLUG n' Play and Rock Solid!
Enjoy!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/28/2009 4:42:35 AM GMT
... the vga driver does not have a 2 pin version, if thats what your are talking about. The vga driver has not been tested on every monitor yet, however, it works on about half. Try adjusting the (frequencyState) number within the video driver asm data section which adjusts the pixle clock to fix monitor problems. However the number should produce the exact 25.175 MHz frequency for vga.
Now, if you were talking about the keyboard or mouse they don't have a vertical or horizontal frequency. I'm not sure what you are refering to. I have only tested the drivers with 80MHZ. There is a disclaimer about this, the drivers are flexibile in their calculations, however, to allow for different clock frequencies.
Please provide details as I would like to debug any of these problems.
Also, note that scan code set 3 is used for the keyboard.
So for the mouse and keyboard drivers, the mouse should always work (5 button are not supported). However, the keyboard may not work if it doesn't support set 3 (which all ps/2 keyboards should support since scan code set 3 is the ps/2 protocol).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/29/2009 3:02:25 PM GMT
Had to run out before I could investigate further, and just got in half an hour ago (11:00pm local time) so I will not be checking it tonight.
Can you please verify that the ps2 keyoard and mouse work without the monitor. Basically try pressing the caps lock, scroll lock, or number lock key and see if the LED truns on. If so then the keyboard driver is working. As for the mouse driver there is really now way to tell without a monitor.
As for the monitor. There is one setting in the dat data section of the asm video driver which controls the pixel clock frequency. Its called frequencyState. Try playing arround with the number and see what happens. The driver updates the monitor and itself based on that number.
However, the current frequency state number should come out to produce a pixles clock of 25.175MHZ which is the vga frequency.
Also, you can try another monitor. That may fix the problem - or try reseting your monitor back to the factory default state.
Thanks, please give updates.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Great work on this- unlike the Parallax "Mouse" object and the KBM object, yours worked perfectly with my "Compaq" branded Logitech mouse. It recognized the 2 buttons and clickable scroll wheel. Minor bug-the VGA screen flashes around 1/second. Do you have any updates to this? How serious is the limitation of only supporting "scan code set three" keyboards? Has anyone had problems with this? I'm looking for a very robust keyboard/mouse single cog driver for use with 12Blocks- this seems to be the best so far... Great job Kye!
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, RamBlade, TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
The video driver suffers from a sync glitch. I know how to fix the glitch but I do not sponsor these drivers anymore. I have also removed them from the obex.
I have a much better keyboard·and mouse driver interfaceEngine that really out shines these drivers... but its for a for profit system. I'm not to keen about releasing it for free since it will be my bread and butter.·PM me if you want to talk about it.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 8/19/2009 2:04:08 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, RamBlade, TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm