Display O Tron Hat kernel Module

Hi all,
I’ll just push my code on github.
I’ve created a linux kernel module for display of tron hat.
You don’t need use the lib python and control with language you want like bash etc…
The display o tron is managed by sysfs :)
The code doesn’t handle all errors (it will) and can’t be loaded by kernel tree but it will too.
I’ve corrected the “touch management” with a better implementation (the lib python bug on my 5th touch)
All the touch is considered like an unix keyboard and can control the LXDE interface (or XFCE etc…)
The project is at the beginning but work great!
I will provide precompiled module for kernel later :)

Merry christmas all ;)

1 Like

You can suggest some functionality.
One of them is to link a button to a software reset for example.
I will post the video of my C client later

Awesome work! I didn’t bring a DotHAT with me though, d’oh! Well that was in some way deliberate, since I’m forcing myself to focus on Flotilla.

Did you get to the bottom of the bug on your 5th touch? Between it baffling me and me being stupendously busy with a million-and-one things I haven’t had chance to respond to you!

Yes i’ve succesfull correct the bug. I’ll try correct your python lib to follow the same method.
First you must wait the calibration method and your python lib doesn’t.
And second the hardware doesn’t follow the spec. I don’t understand. I think that because the interrupt pin is not plug.
Same problem There a are a pin missing that would be very useful with the st7036. Essentially to read the busy state and it’s not managed by GPIO. So I have follow the timing in the spec datasheet…
I’ll recommand all people that would learn “how to write a kernel module” because it use all protocol you can use to “talk” with a PI :)

Have just update my kernel to the lasted hexxeh provide by rpi-update and compiled the dothat-module.
I have upload the precompiled_module. Enjoy!

Wow very cool work. Do you know if it works with the original display o tron ?

Not sure, i’ve downloaded the datasheet only for the display tron hat.
I don’t have an original display o tron original but it’s not very complicated to support it.
It’s complicated to implement a module without have the hardware. Because there are often difference between the datasheet spec and a true hardware

the bar graph in the dot3k is controlled by the sn3218, as opposed to the cap1166 so that wouldn’t be available without some work.

But other than that I suspect it should be fine. I have it on my list to check it out over the festive season, and perhaps I’ll take the leap to fork to toy around with the code, it’s a pretty cool project :-)

I’m currently read the python code for dot3k and it’s a easy to make work my driver.
Just some technical information.
How many Backlight LCD have it?
How many graph led have it?
I think the all leds shared the same register.
If yes its make me 10 minutes to support it.

it’s a 3-segment RGB, with 9-led bar graph, all driven by the sn3218. You can see the register addresses here:


Ok I will make a branch with the modification.
I dont known for the moment how to detect a dot3k from dothat.
May be an optional parameter to the load of module…
Technically it currently work :
sudo cat /sys/class/dothat/sn3218/lcd
B: 0x00 0x00 0x00 0x00 0x00 0x00
G: 0x00 0x00 0x00 0x00 0x00 0x00
R: 0x00 0x00 0x00 0x00 0x00 0x00

The 3 first segment is the backlight
The other components (nine after) is the graph
But it’s not sexy

Give me a kick here when it’s up and I’ll grab it and give it a whirl and let you know. :)

Not today my wife does not appreciate too that I now code when there are full of festive preparations ahahah ^^

Can you richard test on the currently driver and see what work or not?
If you want to light on the graph
you can make echo “4 FF0000” > /sys/class/dothat/sn3218/lcd
The first or three must be light (can you ask me wich )

Is this a good place for comments / bugs for the kernel module?

The ‘shift_display’ command is fairly permanent - i.e. the shift remains in place even for a new cursor position or text written to the display. It evens survives a ‘clear’ command. Is there any way of resetting the display to a power on state? Perhaps as part of the ‘clear’ command or a new ‘reset’ or ‘initialise’ command?

I tried to reset the display by rmmod/insmod - but that got the display even more confused (it’s now printing right-to-left!). So some form of reset command is probably needed.

Finally, if I do write a C library for interfacing with the module, where would be a good place to put it?

No the best place to bugs/ improve/ is github.
Open a ticket and describe you want :)
The shift display is permanent it’s true but this is the electronic functionnemtn of the chip.
You can check the value of of the shift and reverse.
But yes a clear_shift must be better. i’ll do.
The rmmod (except if there a little timing bug) do a reset but i’ll see if i can make more.
To make a lib C i suggested to fork and commit you lib. I’ll accept to the master branch ;)

OK. I’ll do things on github

The shift display has mapped because it’s a functionnality of the chip but the refresh rate of the LCD is good.
I’ll recommand to make the shift in userland.
Same thing for the moment the 3 lines is see as a big on line because it’s like that in memory.
It will be cool to separate all lines and make a “clipping” of each line.

Yer sure, I’ll give it a go today. :)

I’ve begin to see how to implement for dot3k.
sn3128 is compatible and can handle the led bar , backlight .
The text LCD part is compatible.
The touch part is not present. It use here a “joystick” library and its an GPIO joystick so i must have the device to implement :/

p8mty> just review and merged your lib.
I’ll implement a reset for the shift register.
My actual kernel module have a 10 days uptime with no bugs ;)