The DaisyOne+ keyboard controller
=================================

Firmware for an ATmega328P that scans a computer keyboard's matrix and
sends each key over a two-wire link (KCLK and KDAT) to the Pico Daisy, with
a handshake as the Amiga's keyboard does. Built from source commit 1ed9d48.

Pick the file for your keyboard:

  kbd328-keyboard0.hex   an 8 x 8 matrix in the Atari XEGS's places
                         (keyboard 0), with BREAK, SHIFT and CTRL on lines
                         of their own
  kbd328-c64.hex         the Commodore 64's keyboard (keyboard 2)
  kbd328-laser50.hex     the VTech Laser 50's keyboard (keyboard 3), its
                         4 x 13 matrix

kbd328-pins.svg shows the chip's pins and what each keyboard wires to them,
with the link to the Pico and the ISP header.

THE PICO'S SIDE
The controller needs the Pico Daisy's firmware built for the keyboard link
(PyCone's picoKeyLink build: KDAT on GP21, KCLK on GP22). The standard
PyCone firmware reads an XEGS keyboard wired straight to the Pico's pins
instead, and does not use the controller.

THE CHIP
The controller runs on the 328P's internal 8 MHz oscillator, at 3.3 V, with
no crystal. Program it through its ISP pins (MISO, MOSI, SCK, RESET) with
any AVR programmer: a USBasp, or an Arduino running "Arduino as ISP".
Programming erases any Arduino bootloader on the chip.

With avrdude, a USBasp, and the C64 file as the example:

  avrdude -c usbasp -p m328p -U lfuse:w:0xE2:m -U hfuse:w:0xDF:m
  avrdude -c usbasp -p m328p -U flash:w:kbd328-c64.hex:i

With an Arduino as ISP, use -c stk500v1 -P <its serial port> -b 19200.

The fuses are set once:
  lfuse 0xE2   internal 8 MHz oscillator, no divide by 8
  hfuse 0xDF   start at address 0 (no bootloader)
  efuse        left as it is (brown-out at 2.7 V, 0xFD)

STATUS
Tested in emulation: the controller's firmware running on an emulated
ATmega328P (avr8js), wired to the Pico Daisy's real firmware on an emulated
RP2040 (rp2040js), every key typed and checked at both ends. A 328P has
been flashed with it, but the controller and a real Pico have not yet been
run together. Treat it as a beta.
