That's a funny story.
On April 1st @wallmasterr posted a fun video on Twitter about how he made a Game Boy Camera style project on Playdate (using code I shared in this very forum)
I made a Playdate camera app and accessory called the playdate oneil after April Oneil from TMNT's yellow boiler suit and camera. #playdate #camera #tmnt #arduino #teensy #gamedev pic.twitter.com/0r5eUfuzeO
— Alastair Low ➜GDC ➜Midwest Gaming Classic (@Wallmasterr) April 1, 2023
It was a joke of course... but maybe it doesn't have to end here.
In a rather serendipitous way; at about the same time I was making a little prototype also using my old code:
Game Boy Camera, but @playdate.
— Tom Granger (@t0m_fr) March 29, 2023
Who's in? 🟨📷 pic.twitter.com/rNOBjXwPpm
It's working with super cheapo (~€5) OV7670 sensor wired to a Teensy 4.1 via its super fast CMOS Sensor Interface (what interface doesn't it have? these boards are insane). This library does all the framebuffer work. I configured the sensor to YUV instead of RGB and set U and V to zeroes. Then in the code we rearrange the bytes to pack the Y (luma), that we approximate to grayscale, and then dither that to 1-bit using this library. It's set to Atkinson right now but I haven't really tested other options. Then, using Serial USB the resulting image is sent to the Playdate as a series of 12000 bytes with the bitmap
command (as documented by @jaames whose JS implementation also helped).
It's capping at about 3 fps currently. In theory this could be much, much faster; and I haven't done any profiling but I'm guessing that serial is the narrowest botteleneck at the moment, but @dave was already going to address that apparently.
(it's QVGA; so 320x240 with black borders to fill up the 400 pixels of the Playdate. To go full screen I believe I'd need to add some PSRAM chips to the Teensy to let it process full VGA, and then scale/crop to fit the full 400x240).
So, should we try to get from there to Playdate Oneil ?
- Yes the world needs it
- Maybe try to make an actual game instead for once
0 voters
It's quite close, but there is a roadblock.
I can send a feed for "viewfinder mode" but I can't stop it to get back to the app and record a picture (which could happen either on the Teensy's SD card or in the Playdate's memory).
The Teensy sends bitmap
commands constantly and it's pretty difficult to interrupt the bitmap stream from a Playdate button (eg to snap a picture). A button press does return to the app but the press isn't registered in it. I have an embryo of a hacky solution (immediately take action in the game loop when it resumes to tell the Teensy to stop sending bitmaps) but that's a bit hit and miss, and any button press will have the same effect.
Another option would be to wire a separate button to the Teensy but it's definitely not as cool.
A third way maybe would be to try eval
instead of bitmap
. I don't know how this behaves and if it interrupts the running app as bitmap
does.
Anyway, here's the gist. Might be fun to explore further. And once the camera works, we could hook up a thermal printer, or try recording video...
To be continued ?