# pocket computer M4

The PCM4 (pocket computer / M4) is a handheld computing device based
around the Keyboard FeatherWing [1] and the Adafruit Feather M4 [2].
The Feather M4 has 512K of flash memory, 192K of RAM, and 2M QSPI [3]
flash.

[1] https://www.tindie.com/products/arturo182/keyboard-featherwing-qwerty-keyboard-26-lcd/
[2] https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51?view=all
[3] https://github.com/adafruit/Adafruit_QSPI

It will have a scheme-based operating system.

## Feather M4 pinouts

+ A0: reserved
+ A1: reserved
+ A2: reserved for RFM9X CS
+ A3: reserved for RFM9X RST
+ A4: reserved for airlift ESPBUSY
+ A5: reserved for airlift ESPRESET
+ D4: reserved for RFM9X IRQ
+ D5: SD card CS
+ D6: STMPE CS
+ D9: LCD CS
+ D10: LCD DC
+ D11: neopixel

## Peripherals

+ Display: 320x240 touchscreen
  + ILI9341 LCD controller
  + STMPE610 touchscreen
+ Keyboard: BB Q10 keyboard + 4x tactile buttons + 5-way switch
  + I2C address: 0x1F
+ Planned: DS3231 RTC
  + I2C address: 0x66
+ Planned: RFM95 LoRa featherwing
+ Planned: ESP32 airlift
+ Planned: ATECC608A cryptoprocessor

## Boot sequence

1. Stage 1: UF2 bootloader [4][5]
2. Stage 2: base hardware environment
   + hardware init
   + I2C/SPI interface
   + SD card
   + RTC core
   + scheme core
3. Load boot.scm from SD card.

Stretch goal:
+ Holding down the center button in the joystick should bring up a menu
  of scheme files on the SD card, allowing the user to select the boot
  code.

Note that each stage is as minimal as possible, so stage 2 should
contain just enough to load the operating system from boot.scm,
which should contain the actual operating system.

[4] https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/uf2-bootloader-details
[5] https://github.com/Microsoft/uf2
