├── .gitignore ├── firmware ├── .gitignore ├── src │ ├── commands.h │ ├── button.h │ ├── slider.h │ ├── mpr121.h │ ├── cli.h │ ├── board_defs.h │ ├── save.h │ ├── lzfx.h │ ├── rgb.h │ ├── hebtn.h │ ├── config.h │ ├── CMakeLists.txt │ ├── gp2y0e.h │ ├── button.c │ ├── config.c │ ├── ws2812.pio │ ├── slider.c │ ├── tusb_config.h │ ├── lzfx.c │ ├── save.c │ ├── cli.c │ └── rgb.c ├── CMakeLists.txt └── pico_sdk_import.cmake ├── doc ├── lgp.jpg ├── pcb.jpg ├── main.jpg ├── choc_v1.jpg ├── good_lgp.png ├── 3m_tape_0.jpg ├── 3m_tape_1.jpg ├── 3m_tape_2.jpg ├── cherrypick.png ├── fix_hinge.jpg ├── mpr121_cut.png ├── some_tape.jpg ├── dome_button.jpg └── rotating_hinge.jpg ├── PCB ├── pico │ ├── 3dmodels │ │ ├── gp2y0e03.3mf │ │ ├── SKSTAAE010.STEP │ │ ├── WS2812-0807.STEP │ │ ├── keypad_lgp.scad │ │ ├── mpr121_breakout_v13.blend │ │ ├── Magnetic Pogo Connector 5 Pin (F).STEP │ │ ├── Magnetic Pogo Connector 5 Pin (M) - 副本.STEP │ │ ├── Magnetic Pogo Connector 5 Pin (Type 1).STEP │ │ ├── Magnetic Pogo Connector 5 Pin (Type 2).STEP │ │ ├── Magnetic Pogo Connector 5 Pin (Type 3).STEP │ │ ├── Magnetic Pogo Connector 5 Pin (Type 4).STEP │ │ ├── keypad_lgp.csg │ │ └── gp2y0e03.scad │ ├── RP_Silicon_KiCad │ │ ├── KiCadLibraries │ │ │ ├── MCU_RaspberryPi_and_Boards.dcm │ │ │ ├── MCU_RaspberryPi_and_Boards.pretty │ │ │ │ └── Crystal_SMD_HC49-US.kicad_mod │ │ │ └── MCU_RaspberryPi_and_Boards.lib │ │ ├── Images │ │ │ ├── SymbolLibrariesScreenShot.jpg │ │ │ └── FootprintLibrariesScreenShot.jpg │ │ ├── .gitignore │ │ ├── Install.md │ │ ├── README.md │ │ └── LICENSE │ ├── sym-lib-table │ ├── fp-lib-table │ ├── diva_main.pretty │ │ ├── DivaKey.kicad_mod │ │ ├── DivaKeyBiasLeft.kicad_mod │ │ ├── DivaKeyBiasRight.kicad_mod │ │ ├── MountingHole_3.2mm_M3.kicad_mod │ │ ├── Solder_3P.kicad_mod │ │ ├── Solder_4P.kicad_mod │ │ ├── Solder_5P.kicad_mod │ │ ├── PN532.kicad_mod │ │ ├── SKSTAAE010.kicad_mod │ │ ├── GP2Y0E03_REAL.kicad_mod │ │ ├── B3F4000.kicad_mod │ │ ├── WS2812B-2835.kicad_mod │ │ ├── GP2Y0E03.kicad_mod │ │ ├── EVQP1K05M.kicad_mod │ │ ├── WS2812B-1615.kicad_mod │ │ ├── Pogo_5P_Female.kicad_mod │ │ ├── MPR121_BOARD.kicad_mod │ │ ├── SOT-23-5_Jumper.kicad_mod │ │ ├── WS2812B-4020.kicad_mod │ │ ├── PJ393-8P.kicad_mod │ │ └── SW_Kailh_Choc_V1V2_1.00u_LED.kicad_mod │ └── diva_main.kicad_prl └── plus │ ├── 3dmodels │ ├── gp2y0e03.3mf │ ├── SKSTAAE010.STEP │ ├── WS2812-0807.STEP │ ├── keypad_lgp.scad │ ├── mpr121_breakout_v13.blend │ ├── Magnetic Pogo Connector 5 Pin (F).STEP │ ├── Magnetic Pogo Connector 5 Pin (M) - 副本.STEP │ ├── Magnetic Pogo Connector 5 Pin (Type 1).STEP │ ├── Magnetic Pogo Connector 5 Pin (Type 2).STEP │ ├── Magnetic Pogo Connector 5 Pin (Type 3).STEP │ ├── Magnetic Pogo Connector 5 Pin (Type 4).STEP │ ├── keypad_lgp.csg │ └── gp2y0e03.scad │ ├── RP_Silicon_KiCad │ ├── KiCadLibraries │ │ ├── MCU_RaspberryPi_and_Boards.dcm │ │ ├── MCU_RaspberryPi_and_Boards.pretty │ │ │ └── Crystal_SMD_HC49-US.kicad_mod │ │ └── MCU_RaspberryPi_and_Boards.lib │ ├── Images │ │ ├── SymbolLibrariesScreenShot.jpg │ │ └── FootprintLibrariesScreenShot.jpg │ ├── .gitignore │ ├── Install.md │ ├── README.md │ └── LICENSE │ ├── sym-lib-table │ ├── fp-lib-table │ ├── diva_plus.pretty │ ├── MountingHole_3.2mm_M3.kicad_mod │ ├── Solder_3P.kicad_mod │ ├── DivaKey.kicad_mod │ ├── DivaKeyBiasLeft.kicad_mod │ ├── DivaKeyBiasRight.kicad_mod │ ├── Solder_4P.kicad_mod │ ├── Solder_5P.kicad_mod │ ├── PN532.kicad_mod │ ├── SKSTAAE010.kicad_mod │ ├── GP2Y0E03_REAL.kicad_mod │ ├── B3F4000.kicad_mod │ ├── WS2812B-2835.kicad_mod │ ├── GP2Y0E03.kicad_mod │ ├── EVQP1K05M.kicad_mod │ ├── WS2812B-1615.kicad_mod │ ├── WS2812B-2835_EMBED.kicad_mod │ ├── Pogo_5P_Female.kicad_mod │ ├── MPR121_BOARD.kicad_mod │ ├── SOT-23-5_Jumper.kicad_mod │ ├── WS2812B-4020.kicad_mod │ ├── SOT-23-FAT.kicad_mod │ ├── PJ393-8P.kicad_mod │ └── SW_Kailh_Choc_V1V2_1.00u_LED.kicad_mod │ └── diva_plus.kicad_prl ├── Production ├── CAD │ ├── diva_pico_base.stl │ ├── diva_pico_panel.3mf │ ├── diva_pico_support.stl │ └── diva_pico_button_combo.3mf ├── Firmware │ └── diva_pico.uf2 └── PCB │ └── diva_main_v1.1.zip ├── .vscode └── settings.json └── README_CN.md /.gitignore: -------------------------------------------------------------------------------- 1 | diva_main-backups 2 | Production/PCB/diva_main/* 3 | -------------------------------------------------------------------------------- /firmware/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | pico-examples 3 | pico-sdk 4 | .vscode -------------------------------------------------------------------------------- /doc/lgp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/lgp.jpg -------------------------------------------------------------------------------- /doc/pcb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/pcb.jpg -------------------------------------------------------------------------------- /doc/main.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/main.jpg -------------------------------------------------------------------------------- /doc/choc_v1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/choc_v1.jpg -------------------------------------------------------------------------------- /doc/good_lgp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/good_lgp.png -------------------------------------------------------------------------------- /doc/3m_tape_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/3m_tape_0.jpg -------------------------------------------------------------------------------- /doc/3m_tape_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/3m_tape_1.jpg -------------------------------------------------------------------------------- /doc/3m_tape_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/3m_tape_2.jpg -------------------------------------------------------------------------------- /doc/cherrypick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/cherrypick.png -------------------------------------------------------------------------------- /doc/fix_hinge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/fix_hinge.jpg -------------------------------------------------------------------------------- /doc/mpr121_cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/mpr121_cut.png -------------------------------------------------------------------------------- /doc/some_tape.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/some_tape.jpg -------------------------------------------------------------------------------- /doc/dome_button.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/dome_button.jpg -------------------------------------------------------------------------------- /doc/rotating_hinge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/doc/rotating_hinge.jpg -------------------------------------------------------------------------------- /PCB/pico/3dmodels/gp2y0e03.3mf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/gp2y0e03.3mf -------------------------------------------------------------------------------- /PCB/plus/3dmodels/gp2y0e03.3mf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/gp2y0e03.3mf -------------------------------------------------------------------------------- /PCB/pico/3dmodels/SKSTAAE010.STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/SKSTAAE010.STEP -------------------------------------------------------------------------------- /PCB/plus/3dmodels/SKSTAAE010.STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/SKSTAAE010.STEP -------------------------------------------------------------------------------- /Production/CAD/diva_pico_base.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/Production/CAD/diva_pico_base.stl -------------------------------------------------------------------------------- /Production/Firmware/diva_pico.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/Production/Firmware/diva_pico.uf2 -------------------------------------------------------------------------------- /Production/PCB/diva_main_v1.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/Production/PCB/diva_main_v1.1.zip -------------------------------------------------------------------------------- /PCB/pico/3dmodels/WS2812-0807.STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/WS2812-0807.STEP -------------------------------------------------------------------------------- /PCB/plus/3dmodels/WS2812-0807.STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/WS2812-0807.STEP -------------------------------------------------------------------------------- /Production/CAD/diva_pico_panel.3mf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/Production/CAD/diva_pico_panel.3mf -------------------------------------------------------------------------------- /Production/CAD/diva_pico_support.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/Production/CAD/diva_pico_support.stl -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/KiCadLibraries/MCU_RaspberryPi_and_Boards.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/KiCadLibraries/MCU_RaspberryPi_and_Boards.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /Production/CAD/diva_pico_button_combo.3mf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/Production/CAD/diva_pico_button_combo.3mf -------------------------------------------------------------------------------- /PCB/pico/3dmodels/keypad_lgp.scad: -------------------------------------------------------------------------------- 1 | color("silver",0.5) translate([-17,-130]) resize([256,60,1]) linear_extrude(h=100) import("keypad_kicad.svg"); -------------------------------------------------------------------------------- /PCB/pico/3dmodels/mpr121_breakout_v13.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/mpr121_breakout_v13.blend -------------------------------------------------------------------------------- /PCB/plus/3dmodels/keypad_lgp.scad: -------------------------------------------------------------------------------- 1 | color("silver",0.5) translate([-17,-130]) resize([256,60,1]) linear_extrude(h=100) import("keypad_kicad.svg"); -------------------------------------------------------------------------------- /PCB/plus/3dmodels/mpr121_breakout_v13.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/mpr121_breakout_v13.blend -------------------------------------------------------------------------------- /PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (F).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (F).STEP -------------------------------------------------------------------------------- /PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (F).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (F).STEP -------------------------------------------------------------------------------- /PCB/pico/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (version 7) 3 | (lib (name "diva_main")(type "KiCad")(uri "${KIPRJMOD}/diva_main.kicad_sym")(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /PCB/plus/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (version 7) 3 | (lib (name "diva_plus")(type "KiCad")(uri "${KIPRJMOD}/diva_plus.kicad_sym")(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (M) - 副本.STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (M) - 副本.STEP -------------------------------------------------------------------------------- /PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (Type 1).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (Type 1).STEP -------------------------------------------------------------------------------- /PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (Type 2).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (Type 2).STEP -------------------------------------------------------------------------------- /PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (Type 3).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (Type 3).STEP -------------------------------------------------------------------------------- /PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (Type 4).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/3dmodels/Magnetic Pogo Connector 5 Pin (Type 4).STEP -------------------------------------------------------------------------------- /PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (M) - 副本.STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (M) - 副本.STEP -------------------------------------------------------------------------------- /PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (Type 1).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (Type 1).STEP -------------------------------------------------------------------------------- /PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (Type 2).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (Type 2).STEP -------------------------------------------------------------------------------- /PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (Type 3).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (Type 3).STEP -------------------------------------------------------------------------------- /PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (Type 4).STEP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/3dmodels/Magnetic Pogo Connector 5 Pin (Type 4).STEP -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/Images/SymbolLibrariesScreenShot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/RP_Silicon_KiCad/Images/SymbolLibrariesScreenShot.jpg -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/Images/SymbolLibrariesScreenShot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/RP_Silicon_KiCad/Images/SymbolLibrariesScreenShot.jpg -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/Images/FootprintLibrariesScreenShot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/pico/RP_Silicon_KiCad/Images/FootprintLibrariesScreenShot.jpg -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/Images/FootprintLibrariesScreenShot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whowechina/diva_pico/HEAD/PCB/plus/RP_Silicon_KiCad/Images/FootprintLibrariesScreenShot.jpg -------------------------------------------------------------------------------- /firmware/src/commands.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Diva Controller Command Line Commands 3 | * WHowe 4 | */ 5 | 6 | #ifndef COMMANDS_H 7 | #define COMMANDS_H 8 | 9 | void commands_init(); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /firmware/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | 3 | # Pull in SDK (must set be before project) 4 | include(pico_sdk_import.cmake) 5 | 6 | project(diva_pico C CXX ASM) 7 | set(CMAKE_C_STANDARD 11) 8 | 9 | pico_sdk_init() 10 | 11 | add_subdirectory(src) 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "mpr121.h": "c", 4 | "board_defs.h": "c", 5 | "pn532.h": "c", 6 | "cli.h": "c", 7 | "vl53l0x.h": "c", 8 | "rgb.h": "c", 9 | "config.h": "c", 10 | "slider.h": "c" 11 | } 12 | } -------------------------------------------------------------------------------- /firmware/src/button.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Controller Buttons 3 | * WHowe 4 | */ 5 | 6 | #ifndef BUTTONS_H 7 | #define BUTTONS_H 8 | 9 | #include 10 | #include 11 | #include "hardware/flash.h" 12 | 13 | void button_init(); 14 | uint8_t button_num(); 15 | void button_update(); 16 | uint16_t button_read(); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /PCB/pico/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (version 7) 3 | (lib (name "diva_main")(type "KiCad")(uri "${KIPRJMOD}/diva_main.pretty")(options "")(descr "")) 4 | (lib (name "MCU_RaspberryPi_and_Boards")(type "KiCad")(uri "${KIPRJMOD}/RP_Silicon_KiCad/KiCadLibraries/MCU_RaspberryPi_and_Boards.pretty")(options "")(descr "")) 5 | (lib (name "Switch_Keyboard_Kailh")(type "KiCad")(uri "${KIPRJMOD}/Switch_Keyboard_Kailh.pretty")(options "")(descr "")) 6 | ) 7 | -------------------------------------------------------------------------------- /PCB/plus/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (version 7) 3 | (lib (name "diva_plus")(type "KiCad")(uri "${KIPRJMOD}/diva_plus.pretty")(options "")(descr "")) 4 | (lib (name "MCU_RaspberryPi_and_Boards")(type "KiCad")(uri "${KIPRJMOD}/RP_Silicon_KiCad/KiCadLibraries/MCU_RaspberryPi_and_Boards.pretty")(options "")(descr "")) 5 | (lib (name "Switch_Keyboard_Kailh")(type "KiCad")(uri "${KIPRJMOD}/Switch_Keyboard_Kailh.pretty")(options "")(descr "")) 6 | ) 7 | -------------------------------------------------------------------------------- /PCB/pico/3dmodels/keypad_lgp.csg: -------------------------------------------------------------------------------- 1 | color([0.752941, 0.752941, 0.752941, 0.5]) { 2 | multmatrix([[1, 0, 0, -17], [0, 1, 0, -130], [0, 0, 1, 0], [0, 0, 0, 1]]) { 3 | resize(newsize = [256,60,1], auto = [0,0,0], convexity = 0) { 4 | linear_extrude(height = 100, $fn = 0, $fa = 12, $fs = 2) { 5 | import(file = "keypad_kicad.svg", origin = [0, 0], center = false, dpi = 72, scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1691928709); 6 | } 7 | } 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /PCB/plus/3dmodels/keypad_lgp.csg: -------------------------------------------------------------------------------- 1 | color([0.752941, 0.752941, 0.752941, 0.5]) { 2 | multmatrix([[1, 0, 0, -17], [0, 1, 0, -130], [0, 0, 1, 0], [0, 0, 0, 1]]) { 3 | resize(newsize = [256,60,1], auto = [0,0,0], convexity = 0) { 4 | linear_extrude(height = 100, $fn = 0, $fa = 12, $fs = 2) { 5 | import(file = "keypad_kicad.svg", origin = [0, 0], center = false, dpi = 72, scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1691928709); 6 | } 7 | } 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /firmware/src/slider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Diva Pico Silder Keys 3 | * WHowe 4 | */ 5 | 6 | #ifndef Silder_H 7 | #define Silder_H 8 | 9 | #include 10 | #include 11 | 12 | void slider_init(); 13 | void slider_update(); 14 | uint16_t slider_zone_num(); 15 | bool slider_touched(unsigned zone); 16 | uint32_t slider_touch_bits(); 17 | 18 | const uint16_t *slider_raw(); 19 | void slider_update_config(); 20 | unsigned slider_count(unsigned zone); 21 | void slider_reset_stat(); 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/.gitignore: -------------------------------------------------------------------------------- 1 | # For PCBs designed using KiCad: http://www.kicad-pcb.org/ 2 | # Format documentation: http://kicad-pcb.org/help/file-formats/ 3 | 4 | # Temporary files 5 | *.000 6 | *.bak 7 | *.bck 8 | *.kicad_pcb-bak 9 | *.sch-bak 10 | *~ 11 | _autosave-* 12 | *.tmp 13 | *-save.pro 14 | *-save.kicad_pcb 15 | fp-info-cache 16 | 17 | # Netlist files (exported from Eeschema) 18 | *.net 19 | 20 | # Autorouter files (exported from Pcbnew) 21 | *.dsn 22 | *.ses 23 | 24 | # Exported BOM files 25 | *.xml 26 | *.csv 27 | .DS_Store 28 | -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/.gitignore: -------------------------------------------------------------------------------- 1 | # For PCBs designed using KiCad: http://www.kicad-pcb.org/ 2 | # Format documentation: http://kicad-pcb.org/help/file-formats/ 3 | 4 | # Temporary files 5 | *.000 6 | *.bak 7 | *.bck 8 | *.kicad_pcb-bak 9 | *.sch-bak 10 | *~ 11 | _autosave-* 12 | *.tmp 13 | *-save.pro 14 | *-save.kicad_pcb 15 | fp-info-cache 16 | 17 | # Netlist files (exported from Eeschema) 18 | *.net 19 | 20 | # Autorouter files (exported from Pcbnew) 21 | *.dsn 22 | *.ses 23 | 24 | # Exported BOM files 25 | *.xml 26 | *.csv 27 | .DS_Store 28 | -------------------------------------------------------------------------------- /firmware/src/mpr121.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MP121 Captive Touch Sensor 3 | * WHowe 4 | * 5 | */ 6 | 7 | #ifndef MP121_H 8 | #define MP121_H 9 | 10 | bool mpr121_init(uint8_t addr); 11 | uint16_t mpr121_touched(uint8_t addr); 12 | bool mpr121_raw(uint8_t addr, uint16_t *raw, int num); 13 | void mpr121_filter(uint8_t addr, uint8_t ffi, uint8_t sfi, uint8_t esi); 14 | void mpr121_sense(uint8_t addr, int8_t sense, int8_t *sense_keys, int num); 15 | void mpr121_debounce(uint8_t addr, uint8_t touch, uint8_t release); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /firmware/src/cli.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Pico Con Command Line Framework 3 | * WHowe 4 | */ 5 | 6 | #ifndef CLI_H 7 | #define CLI_H 8 | 9 | 10 | typedef void (*cmd_handler_t)(int argc, char *argv[]); 11 | 12 | void cli_init(const char *prompt, const char *logo); 13 | void cli_register(const char *cmd, cmd_handler_t handler, const char *help); 14 | void cli_run(); 15 | void cli_fps_count(int core); 16 | 17 | int cli_extract_non_neg_int(const char *param, int len); 18 | int cli_match_prefix(const char *str[], int num, const char *prefix); 19 | 20 | extern const char *built_time; 21 | #endif 22 | -------------------------------------------------------------------------------- /firmware/src/board_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Diva Controller Board Definitions 3 | * WHowe 4 | */ 5 | 6 | #if defined BOARD_DIVA_PICO 7 | 8 | #define I2C_PORT i2c1 9 | #define I2C_SDA 14 10 | #define I2C_SCL 15 11 | #define I2C_FREQ 433*1000 12 | 13 | #define RGB_PIN 2 14 | #define RGB_ORDER GRB // or RGB 15 | 16 | #define RGB_BUTTON_MAP { 3, 2, 1, 0, 4 } 17 | #define BUTTON_DEF { 12, 11, 10, 9, 13, 1, 0} // Main * 4, Start, Aux * 2 18 | 19 | /* A0, A1, A2, ... */ 20 | #define HALL_KEY_MUX_ADDRS { 19, 20 } 21 | #define HALL_KEY_MUX_MAP { 3, 2, 1, 0 } 22 | #define HALL_KEY_MUX_EN 18 23 | #define HALL_KEY_ADC_CHN 0 24 | 25 | #else 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/DivaKey.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "DivaKey" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0 -14.3 unlocked) (layer "F.SilkS") hide 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp 4d1b571a-6738-4483-a586-88528a43ea85) 7 | ) 8 | (fp_text value "DivaKey" (at 0 14.4 unlocked) (layer "F.Fab") hide 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp a78c44d6-409f-4574-88da-bbfbb5d29d39) 11 | ) 12 | (pad "1" smd roundrect (at 0 0) (size 13.8 36) (layers "F.Cu") (roundrect_rratio 0.01923076923) (tstamp c91a4918-7c7b-44c4-a8fe-15b574de971a)) 13 | ) 14 | -------------------------------------------------------------------------------- /firmware/src/save.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Controller Flash Save and Load 3 | * WHowe 4 | */ 5 | 6 | #ifndef SAVE_H 7 | #define SAVE_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "pico/multicore.h" 14 | 15 | uint32_t board_id_32(); 16 | uint64_t board_id_64(); 17 | 18 | /* It's safer to lock other I/O ops during saving, so we need a locker */ 19 | typedef void (*io_locker_func)(bool pause); 20 | void save_init(uint32_t magic, mutex_t *lock); 21 | 22 | void save_loop(); 23 | 24 | void *save_alloc(size_t size, void *def, void (*after_load)()); 25 | void save_request(bool immediately); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/DivaKeyBiasLeft.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "DivaKeyBiasLeft" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0 -14.3 unlocked) (layer "F.SilkS") hide 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp 4d1b571a-6738-4483-a586-88528a43ea85) 7 | ) 8 | (fp_text value "DivaKeyBiasLeft" (at 0 14.4 unlocked) (layer "F.Fab") hide 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp a78c44d6-409f-4574-88da-bbfbb5d29d39) 11 | ) 12 | (pad "1" smd roundrect (at 0 0) (size 13.6 36) (drill (offset -0.1 0)) (layers "F.Cu") (roundrect_rratio 0.01923076923) (tstamp c91a4918-7c7b-44c4-a8fe-15b574de971a)) 13 | ) 14 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/DivaKeyBiasRight.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "DivaKeyBiasRight" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0 -14.3 unlocked) (layer "F.SilkS") hide 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp 4d1b571a-6738-4483-a586-88528a43ea85) 7 | ) 8 | (fp_text value "DivaKeyBiasRight" (at 0 14.4 unlocked) (layer "F.Fab") hide 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp a78c44d6-409f-4574-88da-bbfbb5d29d39) 11 | ) 12 | (pad "1" smd roundrect (at 0 0) (size 13.6 36) (drill (offset 0.1 0)) (layers "F.Cu") (roundrect_rratio 0.01923076923) (tstamp c91a4918-7c7b-44c4-a8fe-15b574de971a)) 13 | ) 14 | -------------------------------------------------------------------------------- /firmware/src/lzfx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lzfx decompressor 3 | * WHowe 4 | * This is actually taken from CrazyRedMachine's repo 5 | * 6 | */ 7 | 8 | #define LZFX_ESIZE -1 /* Output buffer too small */ 9 | #define LZFX_ECORRUPT -2 /* Invalid data for decompression */ 10 | #define LZFX_EARGS -3 /* Arguments invalid (NULL) */ 11 | #define LZFX_HLOG 16 12 | #define LZFX_HSIZE (1 << (LZFX_HLOG)) 13 | 14 | #define fx_expect_false(expr) (expr) 15 | #define fx_expect_true(expr) (expr) 16 | 17 | int lzfx_decompress(const void* ibuf, unsigned int ilen, 18 | void* obuf, unsigned int *olen); -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/Install.md: -------------------------------------------------------------------------------- 1 | # Install KiCad libraries 2 | 3 | ## Manage Symbol Libraries 4 | 5 | Accessed from the Preferences menu, add a new line with the +, give it a name and use the folder icon to point to the directory/folder where you have KiCadLibraries. 6 | 7 | 8 | ![Manage Symbol Libraries screen shot](Images/SymbolLibrariesScreenShot.jpg "Manage Symbol Libraries screen shot") 9 | 10 | 11 | ## Manage Footprint Libraries 12 | 13 | Ditto! Accessed from the Preferences menu, add a new line with the +, give it a name and use the folder icon to point to the directory/folder where you have KiCadLibraries. 14 | 15 | ![Manage Footprint Libraries screen shot](Images/FootprintLibrariesScreenShot.jpg "Manage Footprint Libraries screen shot") -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/Install.md: -------------------------------------------------------------------------------- 1 | # Install KiCad libraries 2 | 3 | ## Manage Symbol Libraries 4 | 5 | Accessed from the Preferences menu, add a new line with the +, give it a name and use the folder icon to point to the directory/folder where you have KiCadLibraries. 6 | 7 | 8 | ![Manage Symbol Libraries screen shot](Images/SymbolLibrariesScreenShot.jpg "Manage Symbol Libraries screen shot") 9 | 10 | 11 | ## Manage Footprint Libraries 12 | 13 | Ditto! Accessed from the Preferences menu, add a new line with the +, give it a name and use the folder icon to point to the directory/folder where you have KiCadLibraries. 14 | 15 | ![Manage Footprint Libraries screen shot](Images/FootprintLibrariesScreenShot.jpg "Manage Footprint Libraries screen shot") -------------------------------------------------------------------------------- /firmware/src/rgb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RGB LED (WS2812) Strip control 3 | * WHowe 4 | */ 5 | 6 | #ifndef RGB_H 7 | #define RGB_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "config.h" 14 | 15 | void rgb_init(); 16 | void rgb_update(); 17 | 18 | uint32_t rgb32(uint32_t r, uint32_t g, uint32_t b, bool gamma_fix); 19 | uint32_t rgb32_from_hsv(uint8_t h, uint8_t s, uint8_t v); 20 | 21 | void rgb_button_color(unsigned index, uint32_t color); 22 | void rgb_slider_color(unsigned index, uint32_t color); 23 | 24 | void rgb_set_hid_slider(unsigned index, unsigned num, const uint8_t *grb, bool flip); 25 | void rgb_set_hid_button(const uint8_t *scale); 26 | 27 | void rgb_set_half_mode(bool half); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /firmware/src/hebtn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hall Effect Button Reader 3 | * WHowe 4 | */ 5 | 6 | #ifndef HEBTN_H 7 | #define HEBTN_H 8 | 9 | /* void * is for uint16_t arrays with potentially unaligned address */ 10 | void hebtn_init(void *cali_up, void *cali_down, uint8_t *trig_on, uint8_t *trig_off); 11 | void hebtn_update(); 12 | 13 | void hebtn_debug(bool on); 14 | 15 | uint8_t hebtn_keynum(); 16 | 17 | bool hebtn_any_present(); 18 | bool hebtn_present(uint8_t chn); 19 | 20 | bool hebtn_actuated(uint8_t chn); 21 | 22 | uint32_t hebtn_presence_map(); 23 | uint32_t hebtn_read(); 24 | 25 | uint16_t hebtn_range(uint8_t chn); 26 | uint16_t hebtn_travel(uint8_t chn); 27 | 28 | uint8_t hebtn_travel_byte(uint8_t chn); 29 | uint8_t hebtn_trigger_byte(uint8_t chn); 30 | 31 | uint16_t hebtn_raw(uint8_t chn); 32 | 33 | void hebtn_calibrate(); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /PCB/pico/3dmodels/gp2y0e03.scad: -------------------------------------------------------------------------------- 1 | $fn=64; 2 | translate([-5.5,-8.5]) color("darkgreen") cube([11,17,1.2]); 3 | 4 | color("#202020") difference() { 5 | translate([-5,-8.4]) cube([10,4,3]); 6 | translate([-4,-9.3]) cube([8,4,2.4]); 7 | } 8 | 9 | color("#303040") difference() { 10 | translate([-5,-1]) cube([10,5.8,5]); 11 | translate([2.5,1.9,3]) cylinder(d=3.8,h=10); 12 | translate([-2.5,1.9,3]) cylinder(d=3.8,h=10); 13 | } 14 | color("#602020") { 15 | translate([2.5,1.9,3.2]) sphere(d=3.4); 16 | translate([-2.5,1.9,3.2]) sphere(d=3.4); 17 | } 18 | 19 | for (i = [-4:1:4]) { 20 | color("yellow") translate([i,6.5,1]) cube([0.5,1,0.6]); 21 | } 22 | 23 | for (i = [-4:1:4]) { 24 | color("silver") translate([i-0.2,-1.8,0.8]) cube([0.5,1,0.6]); 25 | color("silver") translate([i-0.2,4.6,0.8]) cube([0.5,1,0.6]); 26 | } 27 | 28 | for (i = [-4:1.3:4]) { 29 | color("silver") translate([i-0.3,-5,1]) cube([0.6,2,0.6]); 30 | color("silver") translate([i-0.6,-7,2]) cube([0.2,2,0.6]); 31 | } 32 | -------------------------------------------------------------------------------- /PCB/plus/3dmodels/gp2y0e03.scad: -------------------------------------------------------------------------------- 1 | $fn=64; 2 | translate([-5.5,-8.5]) color("darkgreen") cube([11,17,1.2]); 3 | 4 | color("#202020") difference() { 5 | translate([-5,-8.4]) cube([10,4,3]); 6 | translate([-4,-9.3]) cube([8,4,2.4]); 7 | } 8 | 9 | color("#303040") difference() { 10 | translate([-5,-1]) cube([10,5.8,5]); 11 | translate([2.5,1.9,3]) cylinder(d=3.8,h=10); 12 | translate([-2.5,1.9,3]) cylinder(d=3.8,h=10); 13 | } 14 | color("#602020") { 15 | translate([2.5,1.9,3.2]) sphere(d=3.4); 16 | translate([-2.5,1.9,3.2]) sphere(d=3.4); 17 | } 18 | 19 | for (i = [-4:1:4]) { 20 | color("yellow") translate([i,6.5,1]) cube([0.5,1,0.6]); 21 | } 22 | 23 | for (i = [-4:1:4]) { 24 | color("silver") translate([i-0.2,-1.8,0.8]) cube([0.5,1,0.6]); 25 | color("silver") translate([i-0.2,4.6,0.8]) cube([0.5,1,0.6]); 26 | } 27 | 28 | for (i = [-4:1.3:4]) { 29 | color("silver") translate([i-0.3,-5,1]) cube([0.6,2,0.6]); 30 | color("silver") translate([i-0.6,-7,2]) cube([0.2,2,0.6]); 31 | } 32 | -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/README.md: -------------------------------------------------------------------------------- 1 | # RP\_Silicon\_KiCad 2 | KiCad resources to help create designs using the Raspberry Pi MCUs 3 | 4 | This first upload is extracted unaltered from: 5 | 6 | * [https://datasheets.raspberrypi.org/pico/RPi-Pico-R3-PUBLIC-20200119.zip](https://datasheets.raspberrypi.org/pico/RPi-Pico-R3-PUBLIC-20200119.zip) 7 | * [https://datasheets.raspberrypi.org/pico/RPi-Pico-R3-PUBLIC-20200119.zip](https://datasheets.raspberrypi.org/pico/RPi-Pico-R3-PUBLIC-20200119.zip) 8 | 9 | This provides the Pico and the RP2040 library & footprint files respectively. 10 | 11 | Keep these files out of the KiCad directories so they don't get overwritten by any updates. I have the KiCadLibraries in my Documents folder so that macOS will iCloud sync automagically for me. You can do similar on other OS's. 12 | 13 | Set the location of this folder in both the Manage Symbol Libraries and the Manage Footprint Libraries menu options from the Preferences menu. 14 | 15 | If you are not sure about this, see [Install.md](Install.md) 16 | 17 | These libraries may be included in the main set of KiCad libraries at a later point, at which time I'll look to see if there is a need to maintain this repro. -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/README.md: -------------------------------------------------------------------------------- 1 | # RP\_Silicon\_KiCad 2 | KiCad resources to help create designs using the Raspberry Pi MCUs 3 | 4 | This first upload is extracted unaltered from: 5 | 6 | * [https://datasheets.raspberrypi.org/pico/RPi-Pico-R3-PUBLIC-20200119.zip](https://datasheets.raspberrypi.org/pico/RPi-Pico-R3-PUBLIC-20200119.zip) 7 | * [https://datasheets.raspberrypi.org/pico/RPi-Pico-R3-PUBLIC-20200119.zip](https://datasheets.raspberrypi.org/pico/RPi-Pico-R3-PUBLIC-20200119.zip) 8 | 9 | This provides the Pico and the RP2040 library & footprint files respectively. 10 | 11 | Keep these files out of the KiCad directories so they don't get overwritten by any updates. I have the KiCadLibraries in my Documents folder so that macOS will iCloud sync automagically for me. You can do similar on other OS's. 12 | 13 | Set the location of this folder in both the Manage Symbol Libraries and the Manage Footprint Libraries menu options from the Preferences menu. 14 | 15 | If you are not sure about this, see [Install.md](Install.md) 16 | 17 | These libraries may be included in the main set of KiCad libraries at a later point, at which time I'll look to see if there is a need to maintain this repro. -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/MountingHole_3.2mm_M3.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "MountingHole_3.2mm_M3" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 56D1B4CB) 4 | (descr "Mounting Hole 3.2mm, no annular, M3") 5 | (tags "mounting hole 3.2mm no annular m3") 6 | (attr exclude_from_pos_files exclude_from_bom) 7 | (fp_text reference "REF**" (at 0 -4.2) (layer "F.SilkS") hide 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp 6282d667-79cd-44e7-80c8-be7016e34908) 10 | ) 11 | (fp_text value "MountingHole_3.2mm_M3" (at 0 4.2) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 7fc00494-d222-4f8b-ab7e-6fd134aae9d9) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp cec06082-aa10-4157-938f-cbb341771137) 18 | ) 19 | (fp_circle (center 0 0) (end 3.2 0) (layer "Cmts.User") (width 0.15) (fill none) (tstamp 60df0708-7c5b-4e5e-b531-725677a5ca79)) 20 | (fp_circle (center 0 0) (end 3.45 0) (layer "F.CrtYd") (width 0.05) (fill none) (tstamp 097b1924-f230-4c4b-8bf8-356ddf136b8a)) 21 | (pad "" np_thru_hole circle (at 0 0) (size 3.2 3.2) (drill 3.2) (layers *.Cu *.Mask) (tstamp 5048cb31-339e-45a9-bfa6-49b664cf5776)) 22 | ) 23 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/MountingHole_3.2mm_M3.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "MountingHole_3.2mm_M3" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 56D1B4CB) 4 | (descr "Mounting Hole 3.2mm, no annular, M3") 5 | (tags "mounting hole 3.2mm no annular m3") 6 | (attr exclude_from_pos_files exclude_from_bom) 7 | (fp_text reference "REF**" (at 0 -4.2) (layer "F.SilkS") hide 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp 6282d667-79cd-44e7-80c8-be7016e34908) 10 | ) 11 | (fp_text value "MountingHole_3.2mm_M3" (at 0 4.2) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 7fc00494-d222-4f8b-ab7e-6fd134aae9d9) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp cec06082-aa10-4157-938f-cbb341771137) 18 | ) 19 | (fp_circle (center 0 0) (end 3.2 0) (layer "Cmts.User") (width 0.15) (fill none) (tstamp 60df0708-7c5b-4e5e-b531-725677a5ca79)) 20 | (fp_circle (center 0 0) (end 3.45 0) (layer "F.CrtYd") (width 0.05) (fill none) (tstamp 097b1924-f230-4c4b-8bf8-356ddf136b8a)) 21 | (pad "" np_thru_hole circle (at 0 0) (size 3.2 3.2) (drill 3.2) (layers *.Cu *.Mask) (tstamp 5048cb31-339e-45a9-bfa6-49b664cf5776)) 22 | ) 23 | -------------------------------------------------------------------------------- /firmware/src/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Controller Config 3 | * WHowe 4 | */ 5 | 6 | #ifndef CONFIG_H 7 | #define CONFIG_H 8 | 9 | #include 10 | #include 11 | 12 | typedef struct __attribute__((packed)) { 13 | struct { 14 | struct { 15 | uint8_t slider; 16 | uint8_t button; 17 | } level; 18 | uint8_t reserved[2]; 19 | } light; 20 | struct { 21 | uint8_t filter; 22 | int8_t global; 23 | uint8_t debounce_touch; 24 | uint8_t debounce_release; 25 | int8_t keys[32]; 26 | } sense; 27 | struct { 28 | uint8_t joy_map : 4; 29 | uint8_t empty_bits : 4; 30 | uint8_t reserved[3]; 31 | } hid; 32 | struct { 33 | uint16_t cali_up[4]; 34 | uint16_t cali_down[4]; 35 | uint8_t trig_on[4]; 36 | uint8_t trig_off[4]; 37 | } hall; 38 | } diva_cfg_t; 39 | 40 | typedef struct { 41 | bool diva_plus; 42 | struct { 43 | bool sensor; 44 | } debug; 45 | } diva_runtime_t; 46 | 47 | extern diva_cfg_t *diva_cfg; 48 | extern diva_runtime_t diva_runtime; 49 | 50 | void config_init(); 51 | void config_changed(); // Notify the config has changed 52 | void config_factory_reset(); // Reset the config to factory default 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/Solder_3P.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "Solder_3P" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 59FED5CC) 4 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 5 | (tags "Through hole pin header THT 1x05 2.54mm single row") 6 | (attr through_hole) 7 | (fp_text reference "REF**" (at 0 -2.7) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp d518c7db-9a4d-4905-902c-7b6d95f659cb) 10 | ) 11 | (fp_text value "Solder_3P" (at 0 8) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 614f538e-5f2b-401d-b0ab-3346d3ff44e4) 14 | ) 15 | (fp_text user "${REFERENCE}" (at -3.9 3.9 90) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 9586cda1-48da-45c7-86f7-751657e7c25a) 18 | ) 19 | (fp_rect (start -2.8 -1.5) (end 2.8 6.5) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 1be9f04b-c1d6-454e-ae88-97259404f025)) 20 | (pad "1" smd roundrect (at 0 0) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 174ecd2f-6484-485c-a83d-71d6a1dc733a)) 21 | (pad "2" smd oval (at 0 2.54) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 997a59d1-7e2b-4400-b74b-3cb21ad33038)) 22 | (pad "3" smd oval (at 0 5.08) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 7aa5c04b-5bd3-4c72-bbaf-9ec87c5447e0)) 23 | ) 24 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/Solder_3P.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "Solder_3P" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 59FED5CC) 4 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 5 | (tags "Through hole pin header THT 1x05 2.54mm single row") 6 | (attr through_hole) 7 | (fp_text reference "REF**" (at 0 -2.7) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp d518c7db-9a4d-4905-902c-7b6d95f659cb) 10 | ) 11 | (fp_text value "Solder_3P" (at 0 8) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 614f538e-5f2b-401d-b0ab-3346d3ff44e4) 14 | ) 15 | (fp_text user "${REFERENCE}" (at -3.9 3.9 90) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 9586cda1-48da-45c7-86f7-751657e7c25a) 18 | ) 19 | (fp_rect (start -2.8 -1.5) (end 2.8 6.5) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 1be9f04b-c1d6-454e-ae88-97259404f025)) 20 | (pad "1" smd roundrect (at 0 0) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 174ecd2f-6484-485c-a83d-71d6a1dc733a)) 21 | (pad "2" smd oval (at 0 2.54) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 997a59d1-7e2b-4400-b74b-3cb21ad33038)) 22 | (pad "3" smd oval (at 0 5.08) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 7aa5c04b-5bd3-4c72-bbaf-9ec87c5447e0)) 23 | ) 24 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/DivaKey.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "DivaKey" 2 | (version 20241229) 3 | (generator "pcbnew") 4 | (generator_version "9.0") 5 | (layer "F.Cu") 6 | (property "Reference" "REF**" 7 | (at 0 -14.3 0) 8 | (unlocked yes) 9 | (layer "F.SilkS") 10 | (hide yes) 11 | (uuid "4d1b571a-6738-4483-a586-88528a43ea85") 12 | (effects 13 | (font 14 | (size 1 1) 15 | (thickness 0.15) 16 | ) 17 | ) 18 | ) 19 | (property "Value" "DivaKey" 20 | (at 0 14.4 0) 21 | (unlocked yes) 22 | (layer "F.Fab") 23 | (hide yes) 24 | (uuid "a78c44d6-409f-4574-88da-bbfbb5d29d39") 25 | (effects 26 | (font 27 | (size 1 1) 28 | (thickness 0.15) 29 | ) 30 | ) 31 | ) 32 | (property "Datasheet" "" 33 | (at 0 0 0) 34 | (layer "F.Fab") 35 | (hide yes) 36 | (uuid "2527f815-0a65-401e-8f64-cd8a37696de3") 37 | (effects 38 | (font 39 | (size 1.27 1.27) 40 | (thickness 0.15) 41 | ) 42 | ) 43 | ) 44 | (property "Description" "" 45 | (at 0 0 0) 46 | (layer "F.Fab") 47 | (hide yes) 48 | (uuid "343f9b93-e765-45cd-bb4d-dc8a64f0fee9") 49 | (effects 50 | (font 51 | (size 1.27 1.27) 52 | (thickness 0.15) 53 | ) 54 | ) 55 | ) 56 | (attr smd) 57 | (pad "1" smd roundrect 58 | (at 0 0) 59 | (size 9.4 40) 60 | (layers "F.Cu") 61 | (roundrect_rratio 0.01923076923) 62 | (uuid "c91a4918-7c7b-44c4-a8fe-15b574de971a") 63 | ) 64 | (embedded_fonts no) 65 | ) 66 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/DivaKeyBiasLeft.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "DivaKeyBiasLeft" 2 | (version 20241229) 3 | (generator "pcbnew") 4 | (generator_version "9.0") 5 | (layer "F.Cu") 6 | (property "Reference" "REF**" 7 | (at 0 -14.3 0) 8 | (unlocked yes) 9 | (layer "F.SilkS") 10 | (hide yes) 11 | (uuid "4d1b571a-6738-4483-a586-88528a43ea85") 12 | (effects 13 | (font 14 | (size 1 1) 15 | (thickness 0.15) 16 | ) 17 | ) 18 | ) 19 | (property "Value" "DivaKeyBiasLeft" 20 | (at 0 14.4 0) 21 | (unlocked yes) 22 | (layer "F.Fab") 23 | (hide yes) 24 | (uuid "a78c44d6-409f-4574-88da-bbfbb5d29d39") 25 | (effects 26 | (font 27 | (size 1 1) 28 | (thickness 0.15) 29 | ) 30 | ) 31 | ) 32 | (property "Datasheet" "" 33 | (at 0 0 0) 34 | (layer "F.Fab") 35 | (hide yes) 36 | (uuid "d88c3df5-3079-4531-a414-0fc0d387f55e") 37 | (effects 38 | (font 39 | (size 1.27 1.27) 40 | (thickness 0.15) 41 | ) 42 | ) 43 | ) 44 | (property "Description" "" 45 | (at 0 0 0) 46 | (layer "F.Fab") 47 | (hide yes) 48 | (uuid "3b2ab0cb-1f5b-4946-8390-d44b76b81027") 49 | (effects 50 | (font 51 | (size 1.27 1.27) 52 | (thickness 0.15) 53 | ) 54 | ) 55 | ) 56 | (attr smd) 57 | (pad "1" smd roundrect 58 | (at 0 0) 59 | (size 9.2 40) 60 | (drill 61 | (offset -0.1 0) 62 | ) 63 | (layers "F.Cu") 64 | (roundrect_rratio 0.01923076923) 65 | (uuid "c91a4918-7c7b-44c4-a8fe-15b574de971a") 66 | ) 67 | (embedded_fonts no) 68 | ) 69 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/DivaKeyBiasRight.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "DivaKeyBiasRight" 2 | (version 20241229) 3 | (generator "pcbnew") 4 | (generator_version "9.0") 5 | (layer "F.Cu") 6 | (property "Reference" "REF**" 7 | (at 0 -14.3 0) 8 | (unlocked yes) 9 | (layer "F.SilkS") 10 | (hide yes) 11 | (uuid "4d1b571a-6738-4483-a586-88528a43ea85") 12 | (effects 13 | (font 14 | (size 1 1) 15 | (thickness 0.15) 16 | ) 17 | ) 18 | ) 19 | (property "Value" "DivaKeyBiasRight" 20 | (at 0 14.4 0) 21 | (unlocked yes) 22 | (layer "F.Fab") 23 | (hide yes) 24 | (uuid "a78c44d6-409f-4574-88da-bbfbb5d29d39") 25 | (effects 26 | (font 27 | (size 1 1) 28 | (thickness 0.15) 29 | ) 30 | ) 31 | ) 32 | (property "Datasheet" "" 33 | (at 0 0 0) 34 | (layer "F.Fab") 35 | (hide yes) 36 | (uuid "cd92e813-caa4-4e43-9918-7a662bd19d1d") 37 | (effects 38 | (font 39 | (size 1.27 1.27) 40 | (thickness 0.15) 41 | ) 42 | ) 43 | ) 44 | (property "Description" "" 45 | (at 0 0 0) 46 | (layer "F.Fab") 47 | (hide yes) 48 | (uuid "bd0498fc-5471-4f46-bbb5-9c0188fea93d") 49 | (effects 50 | (font 51 | (size 1.27 1.27) 52 | (thickness 0.15) 53 | ) 54 | ) 55 | ) 56 | (attr smd) 57 | (pad "1" smd roundrect 58 | (at 0 0) 59 | (size 9.2 40) 60 | (drill 61 | (offset 0.1 0) 62 | ) 63 | (layers "F.Cu") 64 | (roundrect_rratio 0.01923076923) 65 | (uuid "c91a4918-7c7b-44c4-a8fe-15b574de971a") 66 | ) 67 | (embedded_fonts no) 68 | ) 69 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/Solder_4P.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "Solder_4P" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 59FED5CC) 4 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 5 | (tags "Through hole pin header THT 1x05 2.54mm single row") 6 | (attr through_hole) 7 | (fp_text reference "REF**" (at 0 -2.7) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp d518c7db-9a4d-4905-902c-7b6d95f659cb) 10 | ) 11 | (fp_text value "Solder_4P" (at 0 10.5) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 614f538e-5f2b-401d-b0ab-3346d3ff44e4) 14 | ) 15 | (fp_text user "${REFERENCE}" (at -3.6 4 90) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 9586cda1-48da-45c7-86f7-751657e7c25a) 18 | ) 19 | (fp_rect (start -2.8 -1.5) (end 2.8 9) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 1be9f04b-c1d6-454e-ae88-97259404f025)) 20 | (pad "1" smd roundrect (at 0 0) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 174ecd2f-6484-485c-a83d-71d6a1dc733a)) 21 | (pad "2" smd oval (at 0 2.54) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 997a59d1-7e2b-4400-b74b-3cb21ad33038)) 22 | (pad "3" smd oval (at 0 5.08) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 7aa5c04b-5bd3-4c72-bbaf-9ec87c5447e0)) 23 | (pad "4" smd oval (at 0 7.62) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8a6c42bd-bf44-40be-9e58-41dc76d10644)) 24 | ) 25 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/Solder_4P.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "Solder_4P" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 59FED5CC) 4 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 5 | (tags "Through hole pin header THT 1x05 2.54mm single row") 6 | (attr through_hole) 7 | (fp_text reference "REF**" (at 0 -2.7) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp d518c7db-9a4d-4905-902c-7b6d95f659cb) 10 | ) 11 | (fp_text value "Solder_4P" (at 0 10.5) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 614f538e-5f2b-401d-b0ab-3346d3ff44e4) 14 | ) 15 | (fp_text user "${REFERENCE}" (at -3.6 4 90) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 9586cda1-48da-45c7-86f7-751657e7c25a) 18 | ) 19 | (fp_rect (start -2.8 -1.5) (end 2.8 9) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 1be9f04b-c1d6-454e-ae88-97259404f025)) 20 | (pad "1" smd roundrect (at 0 0) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 174ecd2f-6484-485c-a83d-71d6a1dc733a)) 21 | (pad "2" smd oval (at 0 2.54) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 997a59d1-7e2b-4400-b74b-3cb21ad33038)) 22 | (pad "3" smd oval (at 0 5.08) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 7aa5c04b-5bd3-4c72-bbaf-9ec87c5447e0)) 23 | (pad "4" smd oval (at 0 7.62) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8a6c42bd-bf44-40be-9e58-41dc76d10644)) 24 | ) 25 | -------------------------------------------------------------------------------- /firmware/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(BTSTACK_ROOT ${PICO_SDK_PATH}/lib/btstack) 2 | set(LWIP_ROOT ${PICO_SDK_PATH}/lib/lwip) 3 | 4 | function(make_firmware board board_def) 5 | pico_sdk_init() 6 | add_executable(${board} 7 | main.c slider.c rgb.c button.c save.c config.c commands.c 8 | cli.c mpr121.c hebtn.c lzfx.c usb_descriptors.c) 9 | target_compile_definitions(${board} PUBLIC ${board_def}) 10 | pico_enable_stdio_usb(${board} 1) 11 | pico_enable_stdio_uart(${board} 0) 12 | 13 | pico_generate_pio_header(${board} ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio) 14 | 15 | target_compile_options(${board} PRIVATE -Wall -Werror -Wfatal-errors -O3) 16 | target_include_directories(${board} PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 17 | target_include_directories(${board} PRIVATE 18 | ${BTSTACK_ROOT}/src 19 | ${LWIP_ROOT}/src/include) 20 | 21 | target_link_libraries(${board} PRIVATE 22 | pico_multicore pico_stdlib hardware_pio hardware_pwm hardware_flash 23 | hardware_adc hardware_i2c hardware_watchdog 24 | tinyusb_device tinyusb_board) 25 | 26 | pico_add_extra_outputs(${board}) 27 | 28 | add_custom_command(TARGET ${board} PRE_BUILD 29 | COMMAND touch ${CMAKE_CURRENT_SOURCE_DIR}/cli.c) 30 | 31 | add_custom_command(TARGET ${board} POST_BUILD 32 | COMMAND cp ${board}.uf2 ${CMAKE_CURRENT_LIST_DIR}/..) 33 | endfunction() 34 | 35 | make_firmware(diva_pico BOARD_DIVA_PICO) 36 | 37 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/Solder_5P.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "Solder_5P" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 59FED5CC) 4 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 5 | (tags "Through hole pin header THT 1x05 2.54mm single row") 6 | (attr through_hole) 7 | (fp_text reference "REF**" (at 0 -2.7) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp d518c7db-9a4d-4905-902c-7b6d95f659cb) 10 | ) 11 | (fp_text value "Solder_5P" (at 0 12.7) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 614f538e-5f2b-401d-b0ab-3346d3ff44e4) 14 | ) 15 | (fp_text user "${REFERENCE}" (at -3.6 4 90) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 9586cda1-48da-45c7-86f7-751657e7c25a) 18 | ) 19 | (fp_rect (start -2.8 -1.5) (end 2.8 11.6) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 1be9f04b-c1d6-454e-ae88-97259404f025)) 20 | (pad "1" smd roundrect (at 0 0) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 174ecd2f-6484-485c-a83d-71d6a1dc733a)) 21 | (pad "2" smd oval (at 0 2.54) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 997a59d1-7e2b-4400-b74b-3cb21ad33038)) 22 | (pad "3" smd oval (at 0 5.08) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 7aa5c04b-5bd3-4c72-bbaf-9ec87c5447e0)) 23 | (pad "4" smd oval (at 0 7.62) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8a6c42bd-bf44-40be-9e58-41dc76d10644)) 24 | (pad "5" smd oval (at 0 10.16) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 6315936b-157d-4b90-acb4-be14538119db)) 25 | ) 26 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/Solder_5P.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "Solder_5P" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 59FED5CC) 4 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 5 | (tags "Through hole pin header THT 1x05 2.54mm single row") 6 | (attr through_hole) 7 | (fp_text reference "REF**" (at 0 -2.7) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp d518c7db-9a4d-4905-902c-7b6d95f659cb) 10 | ) 11 | (fp_text value "Solder_5P" (at 0 12.7) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 614f538e-5f2b-401d-b0ab-3346d3ff44e4) 14 | ) 15 | (fp_text user "${REFERENCE}" (at -3.6 4 90) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 9586cda1-48da-45c7-86f7-751657e7c25a) 18 | ) 19 | (fp_rect (start -2.8 -1.5) (end 2.8 11.6) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 1be9f04b-c1d6-454e-ae88-97259404f025)) 20 | (pad "1" smd roundrect (at 0 0) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 174ecd2f-6484-485c-a83d-71d6a1dc733a)) 21 | (pad "2" smd oval (at 0 2.54) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 997a59d1-7e2b-4400-b74b-3cb21ad33038)) 22 | (pad "3" smd oval (at 0 5.08) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 7aa5c04b-5bd3-4c72-bbaf-9ec87c5447e0)) 23 | (pad "4" smd oval (at 0 7.62) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8a6c42bd-bf44-40be-9e58-41dc76d10644)) 24 | (pad "5" smd oval (at 0 10.16) (size 4 1.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 6315936b-157d-4b90-acb4-be14538119db)) 25 | ) 26 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/PN532.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "PN532" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 0) 4 | (attr smd) 5 | (fp_text reference "REF**" (at 0 -4 unlocked) (layer "F.SilkS") 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 827ea950-012b-4519-ac59-027cdeb512b9) 8 | ) 9 | (fp_text value "PN532" (at 0 3 unlocked) (layer "F.Fab") hide 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 8346c2d9-d092-4781-b7b2-784caf31fc02) 12 | ) 13 | (fp_text user "C D V G" (at 0 3.4 unlocked) (layer "F.SilkS") 14 | (effects (font (size 1 1.16) (thickness 0.15))) 15 | (tstamp a56405fb-d8d0-479c-b0d0-ba2e43f42afe) 16 | ) 17 | (fp_text user "${REFERENCE}" (at 0 3 unlocked) (layer "F.Fab") hide 18 | (effects (font (size 1 1) (thickness 0.15))) 19 | (tstamp 5f8d66d3-cbb6-4f8d-8c3b-c374027dcda5) 20 | ) 21 | (fp_rect (start -4.4 -2.6) (end 4.4 2.6) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 847b0a6b-122d-4dfa-b44b-cf5835a558cc)) 22 | (pad "1" smd roundrect (at -3 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 49fa41bb-f1f4-4964-9db1-f426aa853525)) 23 | (pad "2" smd roundrect (at -1 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 93c4b2e4-1795-480d-b0f2-f15997ebb4af)) 24 | (pad "3" smd roundrect (at 1 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 08401f91-8865-426c-8742-5af2658376da)) 25 | (pad "4" smd roundrect (at 3 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 9ddceccf-664d-428b-9381-7930c39a82c8)) 26 | ) 27 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/PN532.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "PN532" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 0) 4 | (attr smd) 5 | (fp_text reference "REF**" (at 0 -4 unlocked) (layer "F.SilkS") 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 827ea950-012b-4519-ac59-027cdeb512b9) 8 | ) 9 | (fp_text value "PN532" (at 0 3 unlocked) (layer "F.Fab") hide 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 8346c2d9-d092-4781-b7b2-784caf31fc02) 12 | ) 13 | (fp_text user "C D V G" (at 0 3.4 unlocked) (layer "F.SilkS") 14 | (effects (font (size 1 1.16) (thickness 0.15))) 15 | (tstamp a56405fb-d8d0-479c-b0d0-ba2e43f42afe) 16 | ) 17 | (fp_text user "${REFERENCE}" (at 0 3 unlocked) (layer "F.Fab") hide 18 | (effects (font (size 1 1) (thickness 0.15))) 19 | (tstamp 5f8d66d3-cbb6-4f8d-8c3b-c374027dcda5) 20 | ) 21 | (fp_rect (start -4.4 -2.6) (end 4.4 2.6) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 847b0a6b-122d-4dfa-b44b-cf5835a558cc)) 22 | (pad "1" smd roundrect (at -3 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 49fa41bb-f1f4-4964-9db1-f426aa853525)) 23 | (pad "2" smd roundrect (at -1 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 93c4b2e4-1795-480d-b0f2-f15997ebb4af)) 24 | (pad "3" smd roundrect (at 1 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 08401f91-8865-426c-8742-5af2658376da)) 25 | (pad "4" smd roundrect (at 3 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 9ddceccf-664d-428b-9381-7930c39a82c8)) 26 | ) 27 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.kicad_prl: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "active_layer": 31, 4 | "active_layer_preset": "All Layers", 5 | "auto_track_width": true, 6 | "hidden_netclasses": [], 7 | "hidden_nets": [ 8 | "GND" 9 | ], 10 | "high_contrast_mode": 0, 11 | "net_color_mode": 1, 12 | "opacity": { 13 | "images": 0.6, 14 | "pads": 1.0, 15 | "tracks": 1.0, 16 | "vias": 1.0, 17 | "zones": 0.6 18 | }, 19 | "ratsnest_display_mode": 0, 20 | "selection_filter": { 21 | "dimensions": false, 22 | "footprints": true, 23 | "graphics": false, 24 | "keepouts": false, 25 | "lockedItems": true, 26 | "otherItems": false, 27 | "pads": false, 28 | "text": false, 29 | "tracks": false, 30 | "vias": false, 31 | "zones": false 32 | }, 33 | "visible_items": [ 34 | 0, 35 | 1, 36 | 2, 37 | 3, 38 | 4, 39 | 5, 40 | 8, 41 | 9, 42 | 10, 43 | 11, 44 | 12, 45 | 13, 46 | 14, 47 | 15, 48 | 16, 49 | 17, 50 | 18, 51 | 19, 52 | 20, 53 | 21, 54 | 22, 55 | 23, 56 | 24, 57 | 25, 58 | 26, 59 | 27, 60 | 28, 61 | 29, 62 | 30, 63 | 32, 64 | 33, 65 | 34, 66 | 35, 67 | 36 68 | ], 69 | "visible_layers": "fffffff_ffffffff", 70 | "zone_display_mode": 0 71 | }, 72 | "git": { 73 | "repo_password": "", 74 | "repo_type": "", 75 | "repo_username": "", 76 | "ssh_key": "" 77 | }, 78 | "meta": { 79 | "filename": "diva_main.kicad_prl", 80 | "version": 3 81 | }, 82 | "project": { 83 | "files": [] 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/SKSTAAE010.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "SKSTAAE010" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (descr "Surface Mount Tactile Switch for High-Density Mounting, 3.1mm height, https://omronfs.omron.com/en_US/ecb/products/pdf/en-b3fs.pdf") 4 | (tags "Tactile Switch") 5 | (attr smd) 6 | (fp_text reference "REF**" (at 0 -5.1) (layer "F.SilkS") 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp c0ef9ad1-8ec9-4fac-a801-e5fec4da4173) 9 | ) 10 | (fp_text value "SKSTAAE010" (at 0 6) (layer "F.Fab") 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp 05f4b111-c459-46c2-ad43-9465df405043) 13 | ) 14 | (fp_rect (start -4 -4.3) (end 4 -1.7) 15 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp d94580e8-45b7-4382-8163-bb626f181074)) 16 | (fp_rect (start -4 1.7) (end 4 4.3) 17 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp 4276a579-5b4e-450b-859e-a673668cc19e)) 18 | (fp_rect (start -2.9 -1.7) (end 2.9 1.7) 19 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp c52878a2-275f-4c89-8300-a1f1df5c8587)) 20 | (fp_circle (center 0 0) (end 1.1 0) 21 | (stroke (width 0.1) (type solid)) (fill none) (layer "F.SilkS") (tstamp 3be4b7ec-d0cb-4063-b59f-7b5f6ff2462b)) 22 | (pad "1" smd rect (at -4.2 0 180) (size 1.8 2.4) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 14472ec8-a899-438e-92c9-89d5346b9cec)) 23 | (pad "2" smd rect (at 4.2 0 180) (size 1.8 2.4) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 04296621-bc7c-4353-b138-30bc1551e4f5)) 24 | (model "D:/Code/aic_pico/PCB/Lib/3dmodels/SKSTAAE010.stp" 25 | (offset (xyz 0 0 0)) 26 | (scale (xyz 1 1 1)) 27 | (rotate (xyz -90 0 0)) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/SKSTAAE010.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "SKSTAAE010" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (descr "Surface Mount Tactile Switch for High-Density Mounting, 3.1mm height, https://omronfs.omron.com/en_US/ecb/products/pdf/en-b3fs.pdf") 4 | (tags "Tactile Switch") 5 | (attr smd) 6 | (fp_text reference "REF**" (at 0 -5.1) (layer "F.SilkS") 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp c0ef9ad1-8ec9-4fac-a801-e5fec4da4173) 9 | ) 10 | (fp_text value "SKSTAAE010" (at 0 6) (layer "F.Fab") 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp 05f4b111-c459-46c2-ad43-9465df405043) 13 | ) 14 | (fp_rect (start -4 -4.3) (end 4 -1.7) 15 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp d94580e8-45b7-4382-8163-bb626f181074)) 16 | (fp_rect (start -4 1.7) (end 4 4.3) 17 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp 4276a579-5b4e-450b-859e-a673668cc19e)) 18 | (fp_rect (start -2.9 -1.7) (end 2.9 1.7) 19 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp c52878a2-275f-4c89-8300-a1f1df5c8587)) 20 | (fp_circle (center 0 0) (end 1.1 0) 21 | (stroke (width 0.1) (type solid)) (fill none) (layer "F.SilkS") (tstamp 3be4b7ec-d0cb-4063-b59f-7b5f6ff2462b)) 22 | (pad "1" smd rect (at -4.2 0 180) (size 1.8 2.4) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 14472ec8-a899-438e-92c9-89d5346b9cec)) 23 | (pad "2" smd rect (at 4.2 0 180) (size 1.8 2.4) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 04296621-bc7c-4353-b138-30bc1551e4f5)) 24 | (model "D:/Code/aic_pico/PCB/Lib/3dmodels/SKSTAAE010.stp" 25 | (offset (xyz 0 0 0)) 26 | (scale (xyz 1 1 1)) 27 | (rotate (xyz -90 0 0)) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /firmware/src/gp2y0e.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GP2Y0E Distance measurement sensor 3 | * WHowe 4 | */ 5 | 6 | #ifndef GP2Y0E_H 7 | #define GP2Y0E_H 8 | 9 | #include 10 | #include "hardware/i2c.h" 11 | 12 | #define GP2Y0E_DEF_ADDR 0x40 13 | 14 | static inline void gp2y0e_write(i2c_inst_t *port, uint8_t addr, uint8_t val) 15 | { 16 | uint8_t cmd[] = {addr, val}; 17 | i2c_write_blocking_until(port, GP2Y0E_DEF_ADDR, cmd, 2, false, time_us_64() + 1000); 18 | } 19 | 20 | static inline void gp2y03_init(i2c_inst_t *port) 21 | { 22 | gp2y0e_write(port, 0xa8, 0); // Accumulation 0:1, 1:5, 2:30, 3:10 23 | gp2y0e_write(port, 0x3f, 0x30); // Filter 0x00:7, 0x10:5, 0x20:9, 0x30:1 24 | gp2y0e_write(port, 0x13, 5); // Pulse [3..7]:[40, 80, 160, 240, 320] us 25 | } 26 | 27 | static inline bool gp2y0e_is_present(i2c_inst_t *port) 28 | { 29 | uint8_t cmd[] = {0x5e}; 30 | return i2c_write_blocking_until(port, GP2Y0E_DEF_ADDR, cmd, 1, true, 31 | time_us_64() + 1000) == 1; 32 | } 33 | 34 | static inline uint8_t gp2y0e_dist_mm(i2c_inst_t *port) 35 | { 36 | uint8_t cmd[] = {0x5e}; 37 | i2c_write_blocking_until(port, GP2Y0E_DEF_ADDR, cmd, 1, true, time_us_64() + 1000); 38 | uint8_t data; 39 | i2c_read_blocking_until(port, GP2Y0E_DEF_ADDR, &data, 1, false, time_us_64() + 1000); 40 | 41 | return data * 10 / 4; 42 | } 43 | 44 | static inline uint16_t gp2y0e_dist16_mm(i2c_inst_t *port) 45 | { 46 | uint8_t cmd[] = {0x5e}; 47 | i2c_write_blocking_until(port, GP2Y0E_DEF_ADDR, cmd, 1, true, time_us_64() + 1000); 48 | uint8_t data[2]; 49 | i2c_read_blocking_until(port, GP2Y0E_DEF_ADDR, data, 2, false, time_us_64() + 1000); 50 | 51 | return ((data[0] << 4) | data[1]) * 10 / 64; 52 | } 53 | 54 | #endif -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/GP2Y0E03_REAL.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "GP2Y0E03_REAL" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 0) 4 | (attr smd) 5 | (fp_text reference "REF**" (at 0 -4 unlocked) (layer "F.SilkS") 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 827ea950-012b-4519-ac59-027cdeb512b9) 8 | ) 9 | (fp_text value "GP2Y0E03_REAL" (at 0 3 unlocked) (layer "F.Fab") hide 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 8346c2d9-d092-4781-b7b2-784caf31fc02) 12 | ) 13 | (fp_line (start -3 10.5) (end -3 14) (layer "F.SilkS") (width 0.12) (tstamp 1a9cbd79-fa00-4dc8-b673-2cd36dc2535d)) 14 | (fp_line (start 3 10.5) (end 3 14) (layer "F.SilkS") (width 0.12) (tstamp 8de0d106-a9fe-4052-8d57-3ff001621b31)) 15 | (fp_line (start -5.7 0) (end 5.7 0) (layer "F.SilkS") (width 0.12) (tstamp 9114e558-704b-48e8-8b00-69f3c5295115)) 16 | (fp_line (start 1.5 10.5) (end 1.5 14) (layer "F.SilkS") (width 0.12) (tstamp a5c7ea59-98f2-4ddd-ad9f-76135a5f6c23)) 17 | (fp_line (start -1.5 10.5) (end -1.5 14) (layer "F.SilkS") (width 0.12) (tstamp c17b2166-4e2e-4026-adee-e464a669401c)) 18 | (fp_line (start 0 10.5) (end 0 14) (layer "F.SilkS") (width 0.12) (tstamp e49fc30d-ff05-4787-a482-6d8a69b19784)) 19 | (fp_line (start 0 -2) (end 0 2) (layer "F.SilkS") (width 0.12) (tstamp ebb6f359-1646-4812-a402-774065d58651)) 20 | (fp_rect (start -4.5 10.5) (end 4.5 14) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 373b3318-08bc-42ef-a089-278c6f6bd095)) 21 | (fp_rect (start -5.5 -6.5) (end 5.5 10.5) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 847b0a6b-122d-4dfa-b44b-cf5835a558cc)) 22 | (model "${KIPRJMOD}/3dmodels/gp2y0e03.wrl" 23 | (offset (xyz 0 -2 0)) 24 | (scale (xyz 0.3937 0.3937 0.3937)) 25 | (rotate (xyz 0 0 0)) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/GP2Y0E03_REAL.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "GP2Y0E03_REAL" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 0) 4 | (attr smd) 5 | (fp_text reference "REF**" (at 0 -4 unlocked) (layer "F.SilkS") 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 827ea950-012b-4519-ac59-027cdeb512b9) 8 | ) 9 | (fp_text value "GP2Y0E03_REAL" (at 0 3 unlocked) (layer "F.Fab") hide 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 8346c2d9-d092-4781-b7b2-784caf31fc02) 12 | ) 13 | (fp_line (start -3 10.5) (end -3 14) (layer "F.SilkS") (width 0.12) (tstamp 1a9cbd79-fa00-4dc8-b673-2cd36dc2535d)) 14 | (fp_line (start 3 10.5) (end 3 14) (layer "F.SilkS") (width 0.12) (tstamp 8de0d106-a9fe-4052-8d57-3ff001621b31)) 15 | (fp_line (start -5.7 0) (end 5.7 0) (layer "F.SilkS") (width 0.12) (tstamp 9114e558-704b-48e8-8b00-69f3c5295115)) 16 | (fp_line (start 1.5 10.5) (end 1.5 14) (layer "F.SilkS") (width 0.12) (tstamp a5c7ea59-98f2-4ddd-ad9f-76135a5f6c23)) 17 | (fp_line (start -1.5 10.5) (end -1.5 14) (layer "F.SilkS") (width 0.12) (tstamp c17b2166-4e2e-4026-adee-e464a669401c)) 18 | (fp_line (start 0 10.5) (end 0 14) (layer "F.SilkS") (width 0.12) (tstamp e49fc30d-ff05-4787-a482-6d8a69b19784)) 19 | (fp_line (start 0 -2) (end 0 2) (layer "F.SilkS") (width 0.12) (tstamp ebb6f359-1646-4812-a402-774065d58651)) 20 | (fp_rect (start -4.5 10.5) (end 4.5 14) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 373b3318-08bc-42ef-a089-278c6f6bd095)) 21 | (fp_rect (start -5.5 -6.5) (end 5.5 10.5) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 847b0a6b-122d-4dfa-b44b-cf5835a558cc)) 22 | (model "${KIPRJMOD}/3dmodels/gp2y0e03.wrl" 23 | (offset (xyz 0 -2 0)) 24 | (scale (xyz 0.3937 0.3937 0.3937)) 25 | (rotate (xyz 0 0 0)) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /firmware/src/button.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Controller Buttons 3 | * WHowe 4 | * 5 | */ 6 | 7 | #include "button.h" 8 | 9 | #include 10 | #include 11 | 12 | #include "hardware/gpio.h" 13 | #include "hardware/timer.h" 14 | #include "hardware/pwm.h" 15 | 16 | #include "config.h" 17 | #include "board_defs.h" 18 | 19 | static const uint8_t button_gpio[] = BUTTON_DEF; 20 | 21 | #define BUTTON_NUM (sizeof(button_gpio)) 22 | 23 | static bool sw_val[BUTTON_NUM]; /* true if pressed */ 24 | static uint64_t sw_freeze_time[BUTTON_NUM]; 25 | 26 | void button_init() 27 | { 28 | for (int i = 0; i < BUTTON_NUM; i++) 29 | { 30 | sw_val[i] = false; 31 | sw_freeze_time[i] = 0; 32 | int8_t gpio = button_gpio[i]; 33 | gpio_init(gpio); 34 | gpio_set_function(gpio, GPIO_FUNC_SIO); 35 | gpio_set_dir(gpio, GPIO_IN); 36 | gpio_pull_up(gpio); 37 | } 38 | } 39 | 40 | uint8_t button_num() 41 | { 42 | return BUTTON_NUM; 43 | } 44 | 45 | static uint16_t button_reading; 46 | 47 | /* If a switch flips, it freezes for a while */ 48 | #define DEBOUNCE_FREEZE_TIME_US 15000 49 | void button_update() 50 | { 51 | uint64_t now = time_us_64(); 52 | uint16_t buttons = 0; 53 | 54 | for (int i = BUTTON_NUM - 1; i >= 0; i--) { 55 | bool sw_pressed = !gpio_get(button_gpio[i]); 56 | 57 | if (now >= sw_freeze_time[i]) { 58 | if (sw_pressed != sw_val[i]) { 59 | sw_val[i] = sw_pressed; 60 | sw_freeze_time[i] = now + DEBOUNCE_FREEZE_TIME_US; 61 | } 62 | } 63 | 64 | buttons <<= 1; 65 | if (sw_val[i]) { 66 | buttons |= 1; 67 | } 68 | } 69 | 70 | button_reading = buttons; 71 | } 72 | 73 | uint16_t button_read() 74 | { 75 | return button_reading; 76 | } 77 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/B3F4000.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "B3F4000" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (descr "Surface Mount Tactile Switch for High-Density Mounting, 3.1mm height, https://omronfs.omron.com/en_US/ecb/products/pdf/en-b3fs.pdf") 4 | (tags "Tactile Switch") 5 | (attr through_hole) 6 | (fp_text reference "REF**" (at 0 -7) (layer "F.SilkS") 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp c0ef9ad1-8ec9-4fac-a801-e5fec4da4173) 9 | ) 10 | (fp_text value "B3F4000" (at 0 3) (layer "F.Fab") 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp 05f4b111-c459-46c2-ad43-9465df405043) 13 | ) 14 | (fp_rect (start -5 -5.5) (end 5 5.5) 15 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp c52878a2-275f-4c89-8300-a1f1df5c8587)) 16 | (fp_circle (center 0 0) (end 1.1 0) 17 | (stroke (width 0.1) (type solid)) (fill none) (layer "F.SilkS") (tstamp 3be4b7ec-d0cb-4063-b59f-7b5f6ff2462b)) 18 | (pad "" np_thru_hole oval (at 0 -4.5 90) (size 1.8 1.8) (drill 1.8) (layers "*.Mask") (tstamp f9640f97-8be6-4d0e-86ae-1b7016853b0c)) 19 | (pad "" np_thru_hole oval (at 0 4.5 90) (size 1.8 1.8) (drill 1.8) (layers "*.Mask") (tstamp e6e4f72b-ecf1-4339-aefb-e014770754c5)) 20 | (pad "1" thru_hole oval (at -6.3 -2.5 90) (size 2 2) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 99a05852-fad6-40a9-b7e3-dcfc608394c8)) 21 | (pad "1" thru_hole oval (at 6.3 -2.5 90) (size 2 2) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp f1c07954-2d24-4ee3-bcd4-2480a4b48650)) 22 | (pad "2" thru_hole oval (at -6.3 2.5 90) (size 2 2) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 1bf97188-6ae6-4891-9e9b-ab414ac713da)) 23 | (pad "2" thru_hole oval (at 6.3 2.5 90) (size 2 2) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 89b9f248-61fa-4e54-8074-534c586a4bea)) 24 | (model "${KIPRJMOD}/3dmodels/b3f-4000.stp" 25 | (offset (xyz 0 0 0)) 26 | (scale (xyz 1 1 1)) 27 | (rotate (xyz -90 0 0)) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/B3F4000.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "B3F4000" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (descr "Surface Mount Tactile Switch for High-Density Mounting, 3.1mm height, https://omronfs.omron.com/en_US/ecb/products/pdf/en-b3fs.pdf") 4 | (tags "Tactile Switch") 5 | (attr through_hole) 6 | (fp_text reference "REF**" (at 0 -7) (layer "F.SilkS") 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp c0ef9ad1-8ec9-4fac-a801-e5fec4da4173) 9 | ) 10 | (fp_text value "B3F4000" (at 0 3) (layer "F.Fab") 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp 05f4b111-c459-46c2-ad43-9465df405043) 13 | ) 14 | (fp_rect (start -5 -5.5) (end 5 5.5) 15 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp c52878a2-275f-4c89-8300-a1f1df5c8587)) 16 | (fp_circle (center 0 0) (end 1.1 0) 17 | (stroke (width 0.1) (type solid)) (fill none) (layer "F.SilkS") (tstamp 3be4b7ec-d0cb-4063-b59f-7b5f6ff2462b)) 18 | (pad "" np_thru_hole oval (at 0 -4.5 90) (size 1.8 1.8) (drill 1.8) (layers "*.Mask") (tstamp f9640f97-8be6-4d0e-86ae-1b7016853b0c)) 19 | (pad "" np_thru_hole oval (at 0 4.5 90) (size 1.8 1.8) (drill 1.8) (layers "*.Mask") (tstamp e6e4f72b-ecf1-4339-aefb-e014770754c5)) 20 | (pad "1" thru_hole oval (at -6.3 -2.5 90) (size 2 2) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 99a05852-fad6-40a9-b7e3-dcfc608394c8)) 21 | (pad "1" thru_hole oval (at 6.3 -2.5 90) (size 2 2) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp f1c07954-2d24-4ee3-bcd4-2480a4b48650)) 22 | (pad "2" thru_hole oval (at -6.3 2.5 90) (size 2 2) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 1bf97188-6ae6-4891-9e9b-ab414ac713da)) 23 | (pad "2" thru_hole oval (at 6.3 2.5 90) (size 2 2) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 89b9f248-61fa-4e54-8074-534c586a4bea)) 24 | (model "${KIPRJMOD}/3dmodels/b3f-4000.stp" 25 | (offset (xyz 0 0 0)) 26 | (scale (xyz 1 1 1)) 27 | (rotate (xyz -90 0 0)) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/WS2812B-2835.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "WS2812B-2835" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0 -3.45 unlocked) (layer "F.SilkS") 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp e2c229b7-0f91-403e-a4c6-2aa96df9a482) 7 | ) 8 | (fp_text value "WS2812B-2835" (at 0 3.45) (layer "F.Fab") hide 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp 0cdcf19b-5977-49ef-be54-419dc006f694) 11 | ) 12 | (fp_line (start -3 -1.75) (end -3 1.8) 13 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 1d58f96b-ee44-49cf-8d5f-9a0008516ff6)) 14 | (fp_line (start -3 -1.75) (end 3.05 -1.75) 15 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp f1cf154e-b063-4f77-8995-ca5034951982)) 16 | (fp_line (start -3 1.8) (end 2.45 1.8) 17 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 9eb6ad99-ac87-4d4d-880d-ab0453e10ef0)) 18 | (fp_line (start 2.45 1.8) (end 3.05 1.2) 19 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 4c210859-6421-4022-8a17-2a8e5e4f929d)) 20 | (fp_line (start 3.05 -1.75) (end 3.05 1.2) 21 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 5a02adb6-cc9d-4758-9c52-145d0ed5a678)) 22 | (pad "G" smd rect (at 1.6 0.9) (size 1.8 1) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8ed4f35c-f2de-440f-8e33-c489bf529100)) 23 | (pad "I" smd rect (at 1.6 -0.9) (size 1.8 1) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2bf938dd-562d-4a98-90c3-767c87723d07)) 24 | (pad "O" smd rect (at -1.6 0.9) (size 1.8 1) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp e152eda4-1abc-44ee-a5c2-c1e2c7168915)) 25 | (pad "V" smd rect (at -1.6 -0.9) (size 1.8 1) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 717c99df-1956-4765-afce-e90c2d34a2a4)) 26 | (model "${KIPRJMOD}/3dmodels/SMD WS2812B-3535.step" 27 | (offset (xyz 0 0 2)) 28 | (scale (xyz 0.85 1 1)) 29 | (rotate (xyz -90 0 -90)) 30 | ) 31 | ) 32 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/WS2812B-2835.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "WS2812B-2835" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0 -3.45 unlocked) (layer "F.SilkS") 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp e2c229b7-0f91-403e-a4c6-2aa96df9a482) 7 | ) 8 | (fp_text value "WS2812B-2835" (at 0 3.45) (layer "F.Fab") hide 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp 0cdcf19b-5977-49ef-be54-419dc006f694) 11 | ) 12 | (fp_line (start -3 -1.75) (end -3 1.8) 13 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 1d58f96b-ee44-49cf-8d5f-9a0008516ff6)) 14 | (fp_line (start -3 -1.75) (end 3.05 -1.75) 15 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp f1cf154e-b063-4f77-8995-ca5034951982)) 16 | (fp_line (start -3 1.8) (end 2.45 1.8) 17 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 9eb6ad99-ac87-4d4d-880d-ab0453e10ef0)) 18 | (fp_line (start 2.45 1.8) (end 3.05 1.2) 19 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 4c210859-6421-4022-8a17-2a8e5e4f929d)) 20 | (fp_line (start 3.05 -1.75) (end 3.05 1.2) 21 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 5a02adb6-cc9d-4758-9c52-145d0ed5a678)) 22 | (pad "G" smd rect (at 1.6 0.9) (size 1.8 1) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8ed4f35c-f2de-440f-8e33-c489bf529100)) 23 | (pad "I" smd rect (at 1.6 -0.9) (size 1.8 1) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2bf938dd-562d-4a98-90c3-767c87723d07)) 24 | (pad "O" smd rect (at -1.6 0.9) (size 1.8 1) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp e152eda4-1abc-44ee-a5c2-c1e2c7168915)) 25 | (pad "V" smd rect (at -1.6 -0.9) (size 1.8 1) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 717c99df-1956-4765-afce-e90c2d34a2a4)) 26 | (model "${KIPRJMOD}/3dmodels/SMD WS2812B-3535.step" 27 | (offset (xyz 0 0 2)) 28 | (scale (xyz 0.85 1 1)) 29 | (rotate (xyz -90 0 -90)) 30 | ) 31 | ) 32 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/GP2Y0E03.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "GP2Y0E03" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 0) 4 | (attr smd) 5 | (fp_text reference "REF**" (at 0 -4 unlocked) (layer "F.SilkS") 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 827ea950-012b-4519-ac59-027cdeb512b9) 8 | ) 9 | (fp_text value "GP2Y0E03" (at 0 3 unlocked) (layer "F.Fab") hide 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 8346c2d9-d092-4781-b7b2-784caf31fc02) 12 | ) 13 | (fp_text user "V G V E C D" (at 0 3.4 unlocked) (layer "F.SilkS") 14 | (effects (font (size 1 1.16) (thickness 0.15))) 15 | (tstamp a56405fb-d8d0-479c-b0d0-ba2e43f42afe) 16 | ) 17 | (fp_text user "${REFERENCE}" (at 0 3 unlocked) (layer "F.Fab") hide 18 | (effects (font (size 1 1) (thickness 0.15))) 19 | (tstamp 5f8d66d3-cbb6-4f8d-8c3b-c374027dcda5) 20 | ) 21 | (fp_rect (start -6.4 -2.6) (end 6.4 2.6) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 847b0a6b-122d-4dfa-b44b-cf5835a558cc)) 22 | (pad "1" smd roundrect (at -5 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 49fa41bb-f1f4-4964-9db1-f426aa853525)) 23 | (pad "2" smd roundrect (at -3 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 93c4b2e4-1795-480d-b0f2-f15997ebb4af)) 24 | (pad "3" smd roundrect (at -1 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 08401f91-8865-426c-8742-5af2658376da)) 25 | (pad "4" smd roundrect (at 1 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 9ddceccf-664d-428b-9381-7930c39a82c8)) 26 | (pad "5" smd roundrect (at 3 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 35763b7e-f7e0-4335-b5f1-dc1522f8900a)) 27 | (pad "6" smd roundrect (at 5 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 7180e2fa-9d46-4456-b8c5-2e6ed26a3f6c)) 28 | ) 29 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/GP2Y0E03.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "GP2Y0E03" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 0) 4 | (attr smd) 5 | (fp_text reference "REF**" (at 0 -4 unlocked) (layer "F.SilkS") 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 827ea950-012b-4519-ac59-027cdeb512b9) 8 | ) 9 | (fp_text value "GP2Y0E03" (at 0 3 unlocked) (layer "F.Fab") hide 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 8346c2d9-d092-4781-b7b2-784caf31fc02) 12 | ) 13 | (fp_text user "V G V E C D" (at 0 3.4 unlocked) (layer "F.SilkS") 14 | (effects (font (size 1 1.16) (thickness 0.15))) 15 | (tstamp a56405fb-d8d0-479c-b0d0-ba2e43f42afe) 16 | ) 17 | (fp_text user "${REFERENCE}" (at 0 3 unlocked) (layer "F.Fab") hide 18 | (effects (font (size 1 1) (thickness 0.15))) 19 | (tstamp 5f8d66d3-cbb6-4f8d-8c3b-c374027dcda5) 20 | ) 21 | (fp_rect (start -6.4 -2.6) (end 6.4 2.6) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 847b0a6b-122d-4dfa-b44b-cf5835a558cc)) 22 | (pad "1" smd roundrect (at -5 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 49fa41bb-f1f4-4964-9db1-f426aa853525)) 23 | (pad "2" smd roundrect (at -3 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 93c4b2e4-1795-480d-b0f2-f15997ebb4af)) 24 | (pad "3" smd roundrect (at -1 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 08401f91-8865-426c-8742-5af2658376da)) 25 | (pad "4" smd roundrect (at 1 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 9ddceccf-664d-428b-9381-7930c39a82c8)) 26 | (pad "5" smd roundrect (at 3 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 35763b7e-f7e0-4335-b5f1-dc1522f8900a)) 27 | (pad "6" smd roundrect (at 5 0) (size 1.2 4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.1666666667) (tstamp 7180e2fa-9d46-4456-b8c5-2e6ed26a3f6c)) 28 | ) 29 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/EVQP1K05M.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "EVQP1K05M" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 611D7BB9) 4 | (descr "Surface Mount Tactile Switch for High-Density Mounting, 3.1mm height, https://omronfs.omron.com/en_US/ecb/products/pdf/en-b3fs.pdf") 5 | (tags "Tactile Switch") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0.2 -5.8) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp c0ef9ad1-8ec9-4fac-a801-e5fec4da4173) 10 | ) 11 | (fp_text value "EVQP1K05M" (at 0 4.8) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 05f4b111-c459-46c2-ad43-9465df405043) 14 | ) 15 | (fp_rect (start -1.524 -3.3) (end 1.5 3.3) (layer "F.SilkS") (width 0.12) (fill none) (tstamp c52878a2-275f-4c89-8300-a1f1df5c8587)) 16 | (fp_circle (center 0 0) (end 1.1 0) (layer "F.SilkS") (width 0.1) (fill none) (tstamp 3be4b7ec-d0cb-4063-b59f-7b5f6ff2462b)) 17 | (pad "1" smd rect (at -3 -2.286 180) (size 2 1.524) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 0e72d5c8-ea2f-4468-a14c-e0b25cb2f5b6)) 18 | (pad "1" smd rect (at -3 0 180) (size 2 1.8) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 14472ec8-a899-438e-92c9-89d5346b9cec)) 19 | (pad "1" smd rect (at 3 -2.286 180) (size 2 1.524) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2e3a015e-4ac7-4f74-b14e-a945ac3e66e7)) 20 | (pad "2" smd rect (at 3 0 180) (size 2 1.8) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 04296621-bc7c-4353-b138-30bc1551e4f5)) 21 | (pad "2" smd rect (at 3 2.286 180) (size 2 1.524) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 93164cab-ca66-4ed3-baa0-e67889d633ed)) 22 | (pad "2" smd rect (at -3 2.286 180) (size 2 1.524) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 994f45a1-0ba0-460f-b1ac-1e659353d16b)) 23 | (model "${KIPRJMOD}/3dmodels/EVQ-P1D05M.stp" 24 | (offset (xyz 0 0 0.02)) 25 | (scale (xyz 1 1 1)) 26 | (rotate (xyz 0 0 90)) 27 | ) 28 | (model "${KIPRJMOD}/3dmodels/SKPMAM.STEP" 29 | (offset (xyz 0 0 0)) 30 | (scale (xyz 1 1 1)) 31 | (rotate (xyz 0 0 0)) 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/EVQP1K05M.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "EVQP1K05M" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 611D7BB9) 4 | (descr "Surface Mount Tactile Switch for High-Density Mounting, 3.1mm height, https://omronfs.omron.com/en_US/ecb/products/pdf/en-b3fs.pdf") 5 | (tags "Tactile Switch") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0.2 -5.8) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp c0ef9ad1-8ec9-4fac-a801-e5fec4da4173) 10 | ) 11 | (fp_text value "EVQP1K05M" (at 0 4.8) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 05f4b111-c459-46c2-ad43-9465df405043) 14 | ) 15 | (fp_rect (start -1.524 -3.3) (end 1.5 3.3) (layer "F.SilkS") (width 0.12) (fill none) (tstamp c52878a2-275f-4c89-8300-a1f1df5c8587)) 16 | (fp_circle (center 0 0) (end 1.1 0) (layer "F.SilkS") (width 0.1) (fill none) (tstamp 3be4b7ec-d0cb-4063-b59f-7b5f6ff2462b)) 17 | (pad "1" smd rect (at -3 -2.286 180) (size 2 1.524) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 0e72d5c8-ea2f-4468-a14c-e0b25cb2f5b6)) 18 | (pad "1" smd rect (at -3 0 180) (size 2 1.8) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 14472ec8-a899-438e-92c9-89d5346b9cec)) 19 | (pad "1" smd rect (at 3 -2.286 180) (size 2 1.524) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2e3a015e-4ac7-4f74-b14e-a945ac3e66e7)) 20 | (pad "2" smd rect (at 3 0 180) (size 2 1.8) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 04296621-bc7c-4353-b138-30bc1551e4f5)) 21 | (pad "2" smd rect (at 3 2.286 180) (size 2 1.524) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 93164cab-ca66-4ed3-baa0-e67889d633ed)) 22 | (pad "2" smd rect (at -3 2.286 180) (size 2 1.524) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 994f45a1-0ba0-460f-b1ac-1e659353d16b)) 23 | (model "${KIPRJMOD}/3dmodels/EVQ-P1D05M.stp" 24 | (offset (xyz 0 0 0.02)) 25 | (scale (xyz 1 1 1)) 26 | (rotate (xyz 0 0 90)) 27 | ) 28 | (model "${KIPRJMOD}/3dmodels/SKPMAM.STEP" 29 | (offset (xyz 0 0 0)) 30 | (scale (xyz 1 1 1)) 31 | (rotate (xyz 0 0 0)) 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/LICENSE: -------------------------------------------------------------------------------- 1 | The original Raspberry Pi Foundation / Trading license: 2 | 3 | These design files are made available openly, with no limitations. 4 | 5 | Permission to use, copy, modify, and/or distribute this design for 6 | any purpose with or without fee is hereby granted. 7 | 8 | THE DESIGN IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS DESIGN INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE 11 | FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY 12 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 13 | IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 14 | OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS DESIGN. 15 | 16 | 17 | Which looks rather like the UnLicense: 18 | 19 | This is free and unencumbered software released into the public domain. 20 | 21 | Anyone is free to copy, modify, publish, use, compile, sell, or 22 | distribute this software, either in source code form or as a compiled 23 | binary, for any purpose, commercial or non-commercial, and by any 24 | means. 25 | 26 | In jurisdictions that recognize copyright laws, the author or authors 27 | of this software dedicate any and all copyright interest in the 28 | software to the public domain. We make this dedication for the benefit 29 | of the public at large and to the detriment of our heirs and 30 | successors. We intend this dedication to be an overt act of 31 | relinquishment in perpetuity of all present and future rights to this 32 | software under copyright law. 33 | 34 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 35 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 36 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 37 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 38 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 39 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 40 | OTHER DEALINGS IN THE SOFTWARE. 41 | 42 | For more information, please refer to 43 | -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/LICENSE: -------------------------------------------------------------------------------- 1 | The original Raspberry Pi Foundation / Trading license: 2 | 3 | These design files are made available openly, with no limitations. 4 | 5 | Permission to use, copy, modify, and/or distribute this design for 6 | any purpose with or without fee is hereby granted. 7 | 8 | THE DESIGN IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS DESIGN INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE 11 | FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY 12 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 13 | IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 14 | OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS DESIGN. 15 | 16 | 17 | Which looks rather like the UnLicense: 18 | 19 | This is free and unencumbered software released into the public domain. 20 | 21 | Anyone is free to copy, modify, publish, use, compile, sell, or 22 | distribute this software, either in source code form or as a compiled 23 | binary, for any purpose, commercial or non-commercial, and by any 24 | means. 25 | 26 | In jurisdictions that recognize copyright laws, the author or authors 27 | of this software dedicate any and all copyright interest in the 28 | software to the public domain. We make this dedication for the benefit 29 | of the public at large and to the detriment of our heirs and 30 | successors. We intend this dedication to be an overt act of 31 | relinquishment in perpetuity of all present and future rights to this 32 | software under copyright law. 33 | 34 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 35 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 36 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 37 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 38 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 39 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 40 | OTHER DEALINGS IN THE SOFTWARE. 41 | 42 | For more information, please refer to 43 | -------------------------------------------------------------------------------- /firmware/src/config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Controller Config and Runtime Data 3 | * WHowe 4 | * 5 | * Config is a global data structure that stores all the configuration 6 | * Runtime is something to share between files. 7 | */ 8 | 9 | #include "config.h" 10 | #include "save.h" 11 | 12 | diva_cfg_t *diva_cfg; 13 | 14 | static diva_cfg_t default_cfg = { 15 | .light = { 16 | .level = { 100, 200 }, 17 | }, 18 | .sense = { 19 | .filter = 0x10, 20 | .debounce_touch = 1, 21 | .debounce_release = 2, 22 | }, 23 | .hid = { 24 | .joy_map = 0, 25 | }, 26 | .hall = { 27 | .cali_up = { 3600, 3600, 3600, 3600}, 28 | .cali_down = { 2100, 2100, 2100, 2100}, 29 | .trig_on = { 24, 24, 24, 24 }, 30 | .trig_off = { 20, 20, 20, 20 } 31 | }, 32 | }; 33 | 34 | diva_runtime_t diva_runtime; 35 | 36 | static void config_loaded() 37 | { 38 | if ((diva_cfg->sense.filter & 0x0f) > 3 || 39 | ((diva_cfg->sense.filter >> 4) & 0x0f) > 3) { 40 | diva_cfg->sense.filter = default_cfg.sense.filter; 41 | config_changed(); 42 | } 43 | if ((diva_cfg->sense.global > 9) || (diva_cfg->sense.global < -9)) { 44 | diva_cfg->sense.global = default_cfg.sense.global; 45 | config_changed(); 46 | } 47 | for (int i = 0; i < 32; i++) { 48 | if ((diva_cfg->sense.keys[i] > 9) || (diva_cfg->sense.keys[i] < -9)) { 49 | diva_cfg->sense.keys[i] = default_cfg.sense.keys[i]; 50 | config_changed(); 51 | } 52 | } 53 | if ((diva_cfg->sense.debounce_touch > 7) | 54 | (diva_cfg->sense.debounce_release > 7)) { 55 | diva_cfg->sense.debounce_touch = default_cfg.sense.debounce_touch; 56 | diva_cfg->sense.debounce_release = default_cfg.sense.debounce_release; 57 | config_changed(); 58 | } 59 | } 60 | 61 | void config_changed() 62 | { 63 | save_request(false); 64 | } 65 | 66 | void config_factory_reset() 67 | { 68 | *diva_cfg = default_cfg; 69 | save_request(true); 70 | } 71 | 72 | void config_init() 73 | { 74 | diva_cfg = (diva_cfg_t *)save_alloc(sizeof(*diva_cfg), &default_cfg, config_loaded); 75 | } 76 | -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/KiCadLibraries/MCU_RaspberryPi_and_Boards.pretty/Crystal_SMD_HC49-US.kicad_mod: -------------------------------------------------------------------------------- 1 | (module Crystal_SMD_HC49-US (layer F.Cu) (tedit 5F0C7995) 2 | (descr "SMD Crystal HC-49-SD http://cdn-reichelt.de/documents/datenblatt/B400/xxx-HC49-SMD.pdf, 11.4x4.7mm^2 package") 3 | (tags "SMD SMT crystal") 4 | (attr smd) 5 | (fp_text reference Y1 (at 0 -3.55) (layer F.SilkS) 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | ) 8 | (fp_text value ABLS-12.000MHZ-B4-T (at 0 3.55) (layer F.Fab) 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | ) 11 | (fp_line (start -6.7 1.3) (end -6.7 2.55) (layer F.SilkS) (width 0.12)) 12 | (fp_text user %R (at 0 0) (layer F.Fab) 13 | (effects (font (size 1 1) (thickness 0.15))) 14 | ) 15 | (fp_line (start -5.7 -2.35) (end -5.7 2.35) (layer F.Fab) (width 0.1)) 16 | (fp_line (start -5.7 2.35) (end 5.7 2.35) (layer F.Fab) (width 0.1)) 17 | (fp_line (start 5.7 2.35) (end 5.7 -2.35) (layer F.Fab) (width 0.1)) 18 | (fp_line (start 5.7 -2.35) (end -5.7 -2.35) (layer F.Fab) (width 0.1)) 19 | (fp_line (start -3.015 -2.115) (end 3.015 -2.115) (layer F.Fab) (width 0.1)) 20 | (fp_line (start -3.015 2.115) (end 3.015 2.115) (layer F.Fab) (width 0.1)) 21 | (fp_line (start 5.9 -2.55) (end -6.7 -2.55) (layer F.SilkS) (width 0.12)) 22 | (fp_line (start -6.7 -2.55) (end -6.7 -1.3) (layer F.SilkS) (width 0.12)) 23 | (fp_line (start -6.7 2.55) (end 5.9 2.55) (layer F.SilkS) (width 0.12)) 24 | (fp_line (start -6.8 -2.6) (end -6.8 2.6) (layer F.CrtYd) (width 0.05)) 25 | (fp_line (start -6.8 2.6) (end 6.8 2.6) (layer F.CrtYd) (width 0.05)) 26 | (fp_line (start 6.8 2.6) (end 6.8 -2.6) (layer F.CrtYd) (width 0.05)) 27 | (fp_line (start 6.8 -2.6) (end -6.8 -2.6) (layer F.CrtYd) (width 0.05)) 28 | (fp_arc (start -3.015 0) (end -3.015 -2.115) (angle -180) (layer F.Fab) (width 0.1)) 29 | (fp_arc (start 3.015 0) (end 3.015 -2.115) (angle 180) (layer F.Fab) (width 0.1)) 30 | (pad 1 smd rect (at -4.5 0) (size 5.6 2.1) (layers F.Cu F.Paste F.Mask)) 31 | (pad 2 smd rect (at 4.5 0) (size 5.6 2.1) (layers F.Cu F.Paste F.Mask)) 32 | (model ${KISYS3DMOD}/Crystal.3dshapes/Crystal_SMD_HC49-SD.wrl 33 | (at (xyz 0 0 0)) 34 | (scale (xyz 1 1 1)) 35 | (rotate (xyz 0 0 0)) 36 | ) 37 | ) 38 | -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/KiCadLibraries/MCU_RaspberryPi_and_Boards.pretty/Crystal_SMD_HC49-US.kicad_mod: -------------------------------------------------------------------------------- 1 | (module Crystal_SMD_HC49-US (layer F.Cu) (tedit 5F0C7995) 2 | (descr "SMD Crystal HC-49-SD http://cdn-reichelt.de/documents/datenblatt/B400/xxx-HC49-SMD.pdf, 11.4x4.7mm^2 package") 3 | (tags "SMD SMT crystal") 4 | (attr smd) 5 | (fp_text reference Y1 (at 0 -3.55) (layer F.SilkS) 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | ) 8 | (fp_text value ABLS-12.000MHZ-B4-T (at 0 3.55) (layer F.Fab) 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | ) 11 | (fp_line (start -6.7 1.3) (end -6.7 2.55) (layer F.SilkS) (width 0.12)) 12 | (fp_text user %R (at 0 0) (layer F.Fab) 13 | (effects (font (size 1 1) (thickness 0.15))) 14 | ) 15 | (fp_line (start -5.7 -2.35) (end -5.7 2.35) (layer F.Fab) (width 0.1)) 16 | (fp_line (start -5.7 2.35) (end 5.7 2.35) (layer F.Fab) (width 0.1)) 17 | (fp_line (start 5.7 2.35) (end 5.7 -2.35) (layer F.Fab) (width 0.1)) 18 | (fp_line (start 5.7 -2.35) (end -5.7 -2.35) (layer F.Fab) (width 0.1)) 19 | (fp_line (start -3.015 -2.115) (end 3.015 -2.115) (layer F.Fab) (width 0.1)) 20 | (fp_line (start -3.015 2.115) (end 3.015 2.115) (layer F.Fab) (width 0.1)) 21 | (fp_line (start 5.9 -2.55) (end -6.7 -2.55) (layer F.SilkS) (width 0.12)) 22 | (fp_line (start -6.7 -2.55) (end -6.7 -1.3) (layer F.SilkS) (width 0.12)) 23 | (fp_line (start -6.7 2.55) (end 5.9 2.55) (layer F.SilkS) (width 0.12)) 24 | (fp_line (start -6.8 -2.6) (end -6.8 2.6) (layer F.CrtYd) (width 0.05)) 25 | (fp_line (start -6.8 2.6) (end 6.8 2.6) (layer F.CrtYd) (width 0.05)) 26 | (fp_line (start 6.8 2.6) (end 6.8 -2.6) (layer F.CrtYd) (width 0.05)) 27 | (fp_line (start 6.8 -2.6) (end -6.8 -2.6) (layer F.CrtYd) (width 0.05)) 28 | (fp_arc (start -3.015 0) (end -3.015 -2.115) (angle -180) (layer F.Fab) (width 0.1)) 29 | (fp_arc (start 3.015 0) (end 3.015 -2.115) (angle 180) (layer F.Fab) (width 0.1)) 30 | (pad 1 smd rect (at -4.5 0) (size 5.6 2.1) (layers F.Cu F.Paste F.Mask)) 31 | (pad 2 smd rect (at 4.5 0) (size 5.6 2.1) (layers F.Cu F.Paste F.Mask)) 32 | (model ${KISYS3DMOD}/Crystal.3dshapes/Crystal_SMD_HC49-SD.wrl 33 | (at (xyz 0 0 0)) 34 | (scale (xyz 1 1 1)) 35 | (rotate (xyz 0 0 0)) 36 | ) 37 | ) 38 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/WS2812B-1615.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "WS2812B-1615" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0 -2.25 unlocked) (layer "F.SilkS") 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp e2c229b7-0f91-403e-a4c6-2aa96df9a482) 7 | ) 8 | (fp_text value "WS2812B-1615" (at 0 2.75) (layer "F.Fab") hide 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp 0cdcf19b-5977-49ef-be54-419dc006f694) 11 | ) 12 | (fp_line (start -2.15 0) (end -1.65 -0.45) 13 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 5a8a1a2a-246d-4e76-81ed-8f300c46fdc4)) 14 | (fp_line (start -2.15 0) (end -1.65 0.4) 15 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 8d1d5d87-154e-4a1e-bfc9-5a998decfb96)) 16 | (fp_rect (start -1.62 -1.1) (end 1.62 1.1) 17 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp 23e5f3bb-0522-431f-bdbf-8f5e524ad436)) 18 | (fp_line (start -1.5 -1) (end 1.5 -1) 19 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 299596e5-a3e4-4f2f-8035-6d83c818f19e)) 20 | (fp_line (start -1.5 1) (end -1.5 -1) 21 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp de8af217-f90f-41ba-aa7d-8bc64ce06158)) 22 | (fp_line (start 1.5 -1) (end 1.5 1) 23 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp dedc7c1c-6a36-4a70-ab85-6a1ac1733d46)) 24 | (fp_line (start 1.5 1) (end -1.5 1) 25 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 7412ce15-264f-4ccf-bc8d-39f31daf0933)) 26 | (pad "G" smd rect (at -0.8 0.48) (size 1 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp e152eda4-1abc-44ee-a5c2-c1e2c7168915)) 27 | (pad "I" smd rect (at 0.8 0.48) (size 1 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8ed4f35c-f2de-440f-8e33-c489bf529100)) 28 | (pad "O" smd rect (at -0.8 -0.48) (size 1 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 717c99df-1956-4765-afce-e90c2d34a2a4)) 29 | (pad "V" smd rect (at 0.8 -0.48) (size 1 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2bf938dd-562d-4a98-90c3-767c87723d07)) 30 | (model "${KIPRJMOD}/3dmodels/WS2812-2020.STEP" 31 | (offset (xyz 0 0 0.25)) 32 | (scale (xyz 0.8 1 0.75)) 33 | (rotate (xyz -90 0 0)) 34 | ) 35 | ) 36 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/WS2812B-1615.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "WS2812B-1615" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0 -2.25 unlocked) (layer "F.SilkS") 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp e2c229b7-0f91-403e-a4c6-2aa96df9a482) 7 | ) 8 | (fp_text value "WS2812B-1615" (at 0 2.75) (layer "F.Fab") hide 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp 0cdcf19b-5977-49ef-be54-419dc006f694) 11 | ) 12 | (fp_line (start -2.15 0) (end -1.65 -0.45) 13 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 5a8a1a2a-246d-4e76-81ed-8f300c46fdc4)) 14 | (fp_line (start -2.15 0) (end -1.65 0.4) 15 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 8d1d5d87-154e-4a1e-bfc9-5a998decfb96)) 16 | (fp_rect (start -1.62 -1.1) (end 1.62 1.1) 17 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp 23e5f3bb-0522-431f-bdbf-8f5e524ad436)) 18 | (fp_line (start -1.5 -1) (end 1.5 -1) 19 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 299596e5-a3e4-4f2f-8035-6d83c818f19e)) 20 | (fp_line (start -1.5 1) (end -1.5 -1) 21 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp de8af217-f90f-41ba-aa7d-8bc64ce06158)) 22 | (fp_line (start 1.5 -1) (end 1.5 1) 23 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp dedc7c1c-6a36-4a70-ab85-6a1ac1733d46)) 24 | (fp_line (start 1.5 1) (end -1.5 1) 25 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 7412ce15-264f-4ccf-bc8d-39f31daf0933)) 26 | (pad "G" smd rect (at -0.8 0.48) (size 1 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp e152eda4-1abc-44ee-a5c2-c1e2c7168915)) 27 | (pad "I" smd rect (at 0.8 0.48) (size 1 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8ed4f35c-f2de-440f-8e33-c489bf529100)) 28 | (pad "O" smd rect (at -0.8 -0.48) (size 1 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 717c99df-1956-4765-afce-e90c2d34a2a4)) 29 | (pad "V" smd rect (at 0.8 -0.48) (size 1 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2bf938dd-562d-4a98-90c3-767c87723d07)) 30 | (model "${KIPRJMOD}/3dmodels/WS2812-2020.STEP" 31 | (offset (xyz 0 0 0.25)) 32 | (scale (xyz 0.8 1 0.75)) 33 | (rotate (xyz -90 0 0)) 34 | ) 35 | ) 36 | -------------------------------------------------------------------------------- /firmware/src/ws2812.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | 7 | .program ws2812 8 | .side_set 1 9 | 10 | .define public T1 2 11 | .define public T2 5 12 | .define public T3 3 13 | 14 | .lang_opt python sideset_init = pico.PIO.OUT_HIGH 15 | .lang_opt python out_init = pico.PIO.OUT_HIGH 16 | .lang_opt python out_shiftdir = 1 17 | 18 | .wrap_target 19 | bitloop: 20 | out x, 1 side 0 [T3 - 1] ; Side-set still takes place when instruction stalls 21 | jmp !x do_zero side 1 [T1 - 1] ; Branch on the bit we shifted out. Positive pulse 22 | do_one: 23 | jmp bitloop side 1 [T2 - 1] ; Continue driving high, for a long pulse 24 | do_zero: 25 | nop side 0 [T2 - 1] ; Or drive low, for a short pulse 26 | .wrap 27 | 28 | % c-sdk { 29 | #include "hardware/clocks.h" 30 | 31 | static inline void ws2812_program_init(PIO pio, uint sm, uint offset, uint pin, float freq, bool rgbw) { 32 | 33 | pio_gpio_init(pio, pin); 34 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 35 | 36 | pio_sm_config c = ws2812_program_get_default_config(offset); 37 | sm_config_set_sideset_pins(&c, pin); 38 | sm_config_set_out_shift(&c, false, true, rgbw ? 32 : 24); 39 | sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); 40 | 41 | int cycles_per_bit = ws2812_T1 + ws2812_T2 + ws2812_T3; 42 | float div = clock_get_hz(clk_sys) / (freq * cycles_per_bit); 43 | sm_config_set_clkdiv(&c, div); 44 | 45 | pio_sm_init(pio, sm, offset, &c); 46 | pio_sm_set_enabled(pio, sm, true); 47 | } 48 | %} 49 | 50 | .program ws2812_parallel 51 | 52 | .define public T1 2 53 | .define public T2 5 54 | .define public T3 3 55 | 56 | .wrap_target 57 | out x, 32 58 | mov pins, !null [T1-1] 59 | mov pins, x [T2-1] 60 | mov pins, null [T3-2] 61 | .wrap 62 | 63 | % c-sdk { 64 | #include "hardware/clocks.h" 65 | 66 | static inline void ws2812_parallel_program_init(PIO pio, uint sm, uint offset, uint pin_base, uint pin_count, float freq) { 67 | for(uint i=pin_base; i/external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | # GIT_SUBMODULES_RECURSE was added in 3.17 33 | if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0") 34 | FetchContent_Declare( 35 | pico_sdk 36 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 37 | GIT_TAG master 38 | GIT_SUBMODULES_RECURSE FALSE 39 | ) 40 | else () 41 | FetchContent_Declare( 42 | pico_sdk 43 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 44 | GIT_TAG master 45 | ) 46 | endif () 47 | 48 | if (NOT pico_sdk) 49 | message("Downloading Raspberry Pi Pico SDK") 50 | FetchContent_Populate(pico_sdk) 51 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 52 | endif () 53 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 54 | else () 55 | message(FATAL_ERROR 56 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 57 | ) 58 | endif () 59 | endif () 60 | 61 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 62 | if (NOT EXISTS ${PICO_SDK_PATH}) 63 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 64 | endif () 65 | 66 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 67 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 68 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 69 | endif () 70 | 71 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 72 | 73 | include(${PICO_SDK_INIT_CMAKE_FILE}) 74 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/Pogo_5P_Female.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "Pogo_5P_Female" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 59FED5CC) 4 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 5 | (tags "Through hole pin header THT 1x05 2.54mm single row") 6 | (attr through_hole) 7 | (fp_text reference "REF**" (at 1.25 -3) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp d518c7db-9a4d-4905-902c-7b6d95f659cb) 10 | ) 11 | (fp_text value "Pogo_5P_Female" (at 5.25 13.5) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 614f538e-5f2b-401d-b0ab-3346d3ff44e4) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 5.08 90) (layer "F.Fab") 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 9586cda1-48da-45c7-86f7-751657e7c25a) 18 | ) 19 | (fp_line (start 1.25 1.25) (end -1.5 1.25) (layer "F.SilkS") (width 0.12) (tstamp 14dc5257-f1d0-4a56-a939-fdf69f086986)) 20 | (fp_rect (start -3.25 -5.75) (end -2.4 15.75) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 021f130d-d9d0-499f-b443-450979b9ab3e)) 21 | (fp_rect (start -1.5 -1.25) (end 1.25 11.5) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 7953ba0e-8c16-496f-9d34-baff618c0ff3)) 22 | (fp_rect (start -2.35 -3.8) (end -1.5 14) (layer "F.SilkS") (width 0.12) (fill none) (tstamp e7a3ec29-2d66-45e0-89b3-0f3404d506bd)) 23 | (fp_line (start -1.8 -1.8) (end -1.8 11.95) (layer "F.CrtYd") (width 0.05) (tstamp 346ee0d3-e13a-49f6-8f6c-eb860777d6c4)) 24 | (fp_line (start 1.8 11.95) (end 1.8 -1.8) (layer "F.CrtYd") (width 0.05) (tstamp 93808e54-10fb-4c6c-984b-3a91c36dbafa)) 25 | (fp_line (start 1.8 -1.8) (end -1.8 -1.8) (layer "F.CrtYd") (width 0.05) (tstamp d7a0888c-6be2-4a97-ac01-de345dcd2919)) 26 | (fp_line (start -1.8 11.95) (end 1.8 11.95) (layer "F.CrtYd") (width 0.05) (tstamp ee85719d-9f71-411e-a024-43105a50c262)) 27 | (fp_line (start -1.27 11.43) (end -1.27 -0.635) (layer "F.Fab") (width 0.1) (tstamp 085f4818-84f1-415f-823e-e6076d0e732d)) 28 | (fp_line (start -1.27 -0.635) (end -0.635 -1.27) (layer "F.Fab") (width 0.1) (tstamp 602c4495-9f5f-4ae3-9800-df18526e3c50)) 29 | (fp_line (start 1.27 -1.27) (end 1.27 11.43) (layer "F.Fab") (width 0.1) (tstamp 73eb4832-b804-463c-ae2b-563755d89978)) 30 | (fp_line (start -0.635 -1.27) (end 1.27 -1.27) (layer "F.Fab") (width 0.1) (tstamp aed66e63-a453-441e-94eb-3442ef294c72)) 31 | (fp_line (start 1.27 11.43) (end -1.27 11.43) (layer "F.Fab") (width 0.1) (tstamp dde86203-069d-47dc-8693-34fe614da099)) 32 | (fp_rect (start -5.5 -5.75) (end -1.5 15.75) (layer "F.Fab") (width 0.12) (fill none) (tstamp 64a39b5e-7244-4b4e-9792-74c7213e97d6)) 33 | (pad "1" thru_hole rect (at 0 0) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp 174ecd2f-6484-485c-a83d-71d6a1dc733a)) 34 | (pad "2" thru_hole oval (at 0 2.54) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp 997a59d1-7e2b-4400-b74b-3cb21ad33038)) 35 | (pad "3" thru_hole oval (at 0 5.08) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp 7aa5c04b-5bd3-4c72-bbaf-9ec87c5447e0)) 36 | (pad "4" thru_hole oval (at 0 7.62) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp 8a6c42bd-bf44-40be-9e58-41dc76d10644)) 37 | (pad "5" thru_hole oval (at 0 10.16) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp c1741286-ba0e-4f33-8f37-5fd51504bac5)) 38 | (model "${KIPRJMOD}/3dmodels/Magnetic Pogo Connector 5 Pin (Type 3).STEP" 39 | (offset (xyz 0 -5 0.1)) 40 | (scale (xyz 1 1 1)) 41 | (rotate (xyz -90 0 -90)) 42 | ) 43 | ) 44 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/Pogo_5P_Female.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "Pogo_5P_Female" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 59FED5CC) 4 | (descr "Through hole straight pin header, 1x05, 2.54mm pitch, single row") 5 | (tags "Through hole pin header THT 1x05 2.54mm single row") 6 | (attr through_hole) 7 | (fp_text reference "REF**" (at 1.25 -3) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp d518c7db-9a4d-4905-902c-7b6d95f659cb) 10 | ) 11 | (fp_text value "Pogo_5P_Female" (at 5.25 13.5) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 614f538e-5f2b-401d-b0ab-3346d3ff44e4) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 5.08 90) (layer "F.Fab") 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 9586cda1-48da-45c7-86f7-751657e7c25a) 18 | ) 19 | (fp_line (start 1.25 1.25) (end -1.5 1.25) (layer "F.SilkS") (width 0.12) (tstamp 14dc5257-f1d0-4a56-a939-fdf69f086986)) 20 | (fp_rect (start -3.25 -5.75) (end -2.4 15.75) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 021f130d-d9d0-499f-b443-450979b9ab3e)) 21 | (fp_rect (start -1.5 -1.25) (end 1.25 11.5) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 7953ba0e-8c16-496f-9d34-baff618c0ff3)) 22 | (fp_rect (start -2.35 -3.8) (end -1.5 14) (layer "F.SilkS") (width 0.12) (fill none) (tstamp e7a3ec29-2d66-45e0-89b3-0f3404d506bd)) 23 | (fp_line (start -1.8 -1.8) (end -1.8 11.95) (layer "F.CrtYd") (width 0.05) (tstamp 346ee0d3-e13a-49f6-8f6c-eb860777d6c4)) 24 | (fp_line (start 1.8 11.95) (end 1.8 -1.8) (layer "F.CrtYd") (width 0.05) (tstamp 93808e54-10fb-4c6c-984b-3a91c36dbafa)) 25 | (fp_line (start 1.8 -1.8) (end -1.8 -1.8) (layer "F.CrtYd") (width 0.05) (tstamp d7a0888c-6be2-4a97-ac01-de345dcd2919)) 26 | (fp_line (start -1.8 11.95) (end 1.8 11.95) (layer "F.CrtYd") (width 0.05) (tstamp ee85719d-9f71-411e-a024-43105a50c262)) 27 | (fp_line (start -1.27 11.43) (end -1.27 -0.635) (layer "F.Fab") (width 0.1) (tstamp 085f4818-84f1-415f-823e-e6076d0e732d)) 28 | (fp_line (start -1.27 -0.635) (end -0.635 -1.27) (layer "F.Fab") (width 0.1) (tstamp 602c4495-9f5f-4ae3-9800-df18526e3c50)) 29 | (fp_line (start 1.27 -1.27) (end 1.27 11.43) (layer "F.Fab") (width 0.1) (tstamp 73eb4832-b804-463c-ae2b-563755d89978)) 30 | (fp_line (start -0.635 -1.27) (end 1.27 -1.27) (layer "F.Fab") (width 0.1) (tstamp aed66e63-a453-441e-94eb-3442ef294c72)) 31 | (fp_line (start 1.27 11.43) (end -1.27 11.43) (layer "F.Fab") (width 0.1) (tstamp dde86203-069d-47dc-8693-34fe614da099)) 32 | (fp_rect (start -5.5 -5.75) (end -1.5 15.75) (layer "F.Fab") (width 0.12) (fill none) (tstamp 64a39b5e-7244-4b4e-9792-74c7213e97d6)) 33 | (pad "1" thru_hole rect (at 0 0) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp 174ecd2f-6484-485c-a83d-71d6a1dc733a)) 34 | (pad "2" thru_hole oval (at 0 2.54) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp 997a59d1-7e2b-4400-b74b-3cb21ad33038)) 35 | (pad "3" thru_hole oval (at 0 5.08) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp 7aa5c04b-5bd3-4c72-bbaf-9ec87c5447e0)) 36 | (pad "4" thru_hole oval (at 0 7.62) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp 8a6c42bd-bf44-40be-9e58-41dc76d10644)) 37 | (pad "5" thru_hole oval (at 0 10.16) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) (tstamp c1741286-ba0e-4f33-8f37-5fd51504bac5)) 38 | (model "${KIPRJMOD}/3dmodels/Magnetic Pogo Connector 5 Pin (Type 3).STEP" 39 | (offset (xyz 0 -5 0.1)) 40 | (scale (xyz 1 1 1)) 41 | (rotate (xyz -90 0 -90)) 42 | ) 43 | ) 44 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/MPR121_BOARD.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "MPR121_BOARD" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (descr "UQFN, 20 Pin (https://resurgentsemi.com/wp-content/uploads/2018/09/MPR121_rev5-Resurgent.pdf?d453f8&d453f8), generated with kicad-footprint-generator ipc_noLead_generator.py") 4 | (tags "UQFN NoLead") 5 | (attr through_hole) 6 | (fp_text reference "REF**" (at 0 -12.8) (layer "F.SilkS") 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp 8b171348-ca3e-425e-9f61-f45e103b1bd2) 9 | ) 10 | (fp_text value "MPR121_BOARD" (at 0 -7.2) (layer "F.Fab") 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp 411beb9d-6946-4d57-9cc3-d25432b47f6d) 13 | ) 14 | (fp_rect (start -15.5 -19) (end 15.5 1.5) 15 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp 07a7856e-a3ee-4160-8e9f-8e80b88c2580)) 16 | (pad "1" thru_hole oval (at 3.81 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp e7239783-0eda-47b1-9bb5-dc761bac4cfc)) 17 | (pad "2" thru_hole oval (at 1.27 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp aa3c51fa-dd83-44f6-9256-1fa009900c71)) 18 | (pad "3" thru_hole oval (at -1.27 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 9dafecdf-3e7c-4d54-9cdc-99370e10389e)) 19 | (pad "4" thru_hole oval (at -3.81 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 6f80cce5-cc9f-4a52-a8df-19f90a01dd9e)) 20 | (pad "6" thru_hole oval (at -6.35 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 44a4ca48-29ab-4d90-90d6-64db1631c3e2)) 21 | (pad "8" thru_hole rect (at -13.97 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 02287b17-3150-4ea1-9903-9321e49eb3c0)) 22 | (pad "9" thru_hole oval (at -11.43 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 92d1b4f9-101c-4e45-b454-f498132a8a5b)) 23 | (pad "10" thru_hole oval (at -8.89 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 9e66df5c-9593-4802-95a8-5d7cf1c02041)) 24 | (pad "11" thru_hole oval (at -6.35 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 1713d9a2-6d31-4ac4-8143-bd9bc42fb99f)) 25 | (pad "12" thru_hole oval (at -3.81 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 86f3dd1e-b802-4696-9f7e-9d2104abbcb7)) 26 | (pad "13" thru_hole oval (at -1.27 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp afbdafd3-d9dd-40eb-8d75-c869030be647)) 27 | (pad "14" thru_hole oval (at 1.27 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 98bcbe68-d77f-4b4e-afa7-7915fcc97b4f)) 28 | (pad "15" thru_hole oval (at 3.81 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp d2e47fcd-00b3-44b4-b23d-bcec3b3bca87)) 29 | (pad "16" thru_hole oval (at 6.35 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 99c24bd2-1ad7-4431-81cb-98dcd0431128)) 30 | (pad "17" thru_hole oval (at 8.89 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp a9f15ab7-c7db-41e6-b072-f9954d8a40c9)) 31 | (pad "18" thru_hole oval (at 11.43 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp ef3aaecb-34ab-4475-a9aa-afc3a20125a1)) 32 | (pad "19" thru_hole oval (at 13.97 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 782e9d72-1d5b-4353-9178-3149f697cc20)) 33 | (pad "20" thru_hole oval (at 6.35 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 775000e9-7a80-411f-804c-c3912305821b)) 34 | (model "${KIPRJMOD}/3dmodels/ImageToStl.com_mpr121_breakout_v13.wrl" 35 | (offset (xyz -15.24 19.02 3.25)) 36 | (scale (xyz 0.3937 0.3937 0.3937)) 37 | (rotate (xyz 0 0 90)) 38 | ) 39 | ) 40 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/MPR121_BOARD.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "MPR121_BOARD" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (descr "UQFN, 20 Pin (https://resurgentsemi.com/wp-content/uploads/2018/09/MPR121_rev5-Resurgent.pdf?d453f8&d453f8), generated with kicad-footprint-generator ipc_noLead_generator.py") 4 | (tags "UQFN NoLead") 5 | (attr through_hole) 6 | (fp_text reference "REF**" (at 0 -12.8) (layer "F.SilkS") 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp 8b171348-ca3e-425e-9f61-f45e103b1bd2) 9 | ) 10 | (fp_text value "MPR121_BOARD" (at 0 -7.2) (layer "F.Fab") 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp 411beb9d-6946-4d57-9cc3-d25432b47f6d) 13 | ) 14 | (fp_rect (start -15.5 -19) (end 15.5 1.5) 15 | (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp 07a7856e-a3ee-4160-8e9f-8e80b88c2580)) 16 | (pad "1" thru_hole oval (at 3.81 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp e7239783-0eda-47b1-9bb5-dc761bac4cfc)) 17 | (pad "2" thru_hole oval (at 1.27 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp aa3c51fa-dd83-44f6-9256-1fa009900c71)) 18 | (pad "3" thru_hole oval (at -1.27 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 9dafecdf-3e7c-4d54-9cdc-99370e10389e)) 19 | (pad "4" thru_hole oval (at -3.81 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 6f80cce5-cc9f-4a52-a8df-19f90a01dd9e)) 20 | (pad "6" thru_hole oval (at -6.35 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 44a4ca48-29ab-4d90-90d6-64db1631c3e2)) 21 | (pad "8" thru_hole rect (at -13.97 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 02287b17-3150-4ea1-9903-9321e49eb3c0)) 22 | (pad "9" thru_hole oval (at -11.43 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 92d1b4f9-101c-4e45-b454-f498132a8a5b)) 23 | (pad "10" thru_hole oval (at -8.89 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 9e66df5c-9593-4802-95a8-5d7cf1c02041)) 24 | (pad "11" thru_hole oval (at -6.35 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 1713d9a2-6d31-4ac4-8143-bd9bc42fb99f)) 25 | (pad "12" thru_hole oval (at -3.81 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 86f3dd1e-b802-4696-9f7e-9d2104abbcb7)) 26 | (pad "13" thru_hole oval (at -1.27 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp afbdafd3-d9dd-40eb-8d75-c869030be647)) 27 | (pad "14" thru_hole oval (at 1.27 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 98bcbe68-d77f-4b4e-afa7-7915fcc97b4f)) 28 | (pad "15" thru_hole oval (at 3.81 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp d2e47fcd-00b3-44b4-b23d-bcec3b3bca87)) 29 | (pad "16" thru_hole oval (at 6.35 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 99c24bd2-1ad7-4431-81cb-98dcd0431128)) 30 | (pad "17" thru_hole oval (at 8.89 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp a9f15ab7-c7db-41e6-b072-f9954d8a40c9)) 31 | (pad "18" thru_hole oval (at 11.43 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp ef3aaecb-34ab-4475-a9aa-afc3a20125a1)) 32 | (pad "19" thru_hole oval (at 13.97 0 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 782e9d72-1d5b-4353-9178-3149f697cc20)) 33 | (pad "20" thru_hole oval (at 6.35 -17.78 90) (size 1.7 1.7) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 775000e9-7a80-411f-804c-c3912305821b)) 34 | (model "${KIPRJMOD}/3dmodels/ImageToStl.com_mpr121_breakout_v13.wrl" 35 | (offset (xyz -15.24 19.02 3.25)) 36 | (scale (xyz 0.3937 0.3937 0.3937)) 37 | (rotate (xyz 0 0 90)) 38 | ) 39 | ) 40 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/SOT-23-5_Jumper.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "SOT-23-5_Jumper" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 5F6F9B37) 4 | (descr "SOT, 5 Pin (https://www.jedec.org/sites/default/files/docs/Mo-178c.PDF variant AA), generated with kicad-footprint-generator ipc_gullwing_generator.py") 5 | (tags "SOT TO_SOT_SMD") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0 -2.4) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp c8ad5e0b-1a94-42e5-975b-3f97562ad1c1) 10 | ) 11 | (fp_text value "SOT-23-5_Jumper" (at 0 2.4) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 32778274-6ddb-46de-a4c4-f5da4bddb081) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab") 16 | (effects (font (size 0.4 0.4) (thickness 0.06))) 17 | (tstamp 1d98d3c8-2b2a-45c6-a8aa-18f8883075e8) 18 | ) 19 | (fp_line (start 0 1.56) (end -0.8 1.56) (layer "F.SilkS") (width 0.12) (tstamp 5c872198-f83c-4deb-bcd0-5e52f65e0e5d)) 20 | (fp_line (start 0 -1.56) (end -1.8 -1.56) (layer "F.SilkS") (width 0.12) (tstamp 5d7a707b-f275-4fad-8928-d0bfc3f8298e)) 21 | (fp_line (start 2.25 1) (end 2.25 0) (layer "F.SilkS") (width 0.2) (tstamp 5f31d443-58e6-4805-bcb0-d880f09a50df)) 22 | (fp_line (start 1 0) (end 2.25 0) (layer "F.SilkS") (width 0.2) (tstamp 90ee4e97-7c26-4f02-a453-8646842270f1)) 23 | (fp_line (start 0 -1.56) (end 0.8 -1.56) (layer "F.SilkS") (width 0.12) (tstamp a57e1f92-0841-41c3-9b13-8d0fa468bbf1)) 24 | (fp_line (start 0 1.56) (end 0.8 1.56) (layer "F.SilkS") (width 0.12) (tstamp e6f5720c-3d7c-4c2a-84d7-f7292c464a1e)) 25 | (fp_line (start 2.05 1.7) (end 2.05 -1.7) (layer "F.CrtYd") (width 0.05) (tstamp 58caaf06-a2ac-48da-8158-655193313766)) 26 | (fp_line (start 2.05 -1.7) (end -2.05 -1.7) (layer "F.CrtYd") (width 0.05) (tstamp 65cf7beb-4413-43bc-9872-e73ad0a4805d)) 27 | (fp_line (start -2.05 1.7) (end 2.05 1.7) (layer "F.CrtYd") (width 0.05) (tstamp cb6671c0-28a5-42e4-8f16-66923724624d)) 28 | (fp_line (start -2.05 -1.7) (end -2.05 1.7) (layer "F.CrtYd") (width 0.05) (tstamp d2a525c4-c467-44ab-97a1-46cf85abf391)) 29 | (fp_line (start -0.8 -1.05) (end -0.4 -1.45) (layer "F.Fab") (width 0.1) (tstamp 091110c3-21ea-4b57-9368-9e27fd1d4d42)) 30 | (fp_line (start -0.4 -1.45) (end 0.8 -1.45) (layer "F.Fab") (width 0.1) (tstamp 352178c2-98bc-4735-9f9c-ee325cb28d9e)) 31 | (fp_line (start 0.8 1.45) (end -0.8 1.45) (layer "F.Fab") (width 0.1) (tstamp 36a30153-0835-4d5d-94ab-385a0d55da06)) 32 | (fp_line (start 0.8 -1.45) (end 0.8 1.45) (layer "F.Fab") (width 0.1) (tstamp 975d3300-9f82-4018-afbb-3313b3e7a832)) 33 | (fp_line (start -0.8 1.45) (end -0.8 -1.05) (layer "F.Fab") (width 0.1) (tstamp ac98af85-c012-44e4-8755-6aff03fb0c8e)) 34 | (pad "1" smd roundrect (at -1.1375 -0.95) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 336e5379-6c3a-49a5-aac4-c9b65fe9014b)) 35 | (pad "2" smd roundrect (at -1.1375 0) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5033a491-6a07-4f29-ac14-6699975887c3)) 36 | (pad "3" smd roundrect (at -1.1375 0.95) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp be86cf09-6e08-4eba-a0a7-b3a41fae1c45)) 37 | (pad "4" smd roundrect (at 1.1375 0.95) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp aca20f50-b13f-4998-8e32-0f7f56329af7)) 38 | (pad "5" smd roundrect (at 1.1375 -0.95) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 03f47f3f-92e0-48c0-9d6c-9fa3e96911e1)) 39 | (model "${KICAD6_3DMODEL_DIR}/Package_TO_SOT_SMD.3dshapes/SOT-23-5.wrl" 40 | (offset (xyz 0 0 0)) 41 | (scale (xyz 1 1 1)) 42 | (rotate (xyz 0 0 0)) 43 | ) 44 | ) 45 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/SOT-23-5_Jumper.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "SOT-23-5_Jumper" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 5F6F9B37) 4 | (descr "SOT, 5 Pin (https://www.jedec.org/sites/default/files/docs/Mo-178c.PDF variant AA), generated with kicad-footprint-generator ipc_gullwing_generator.py") 5 | (tags "SOT TO_SOT_SMD") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0 -2.4) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp c8ad5e0b-1a94-42e5-975b-3f97562ad1c1) 10 | ) 11 | (fp_text value "SOT-23-5_Jumper" (at 0 2.4) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 32778274-6ddb-46de-a4c4-f5da4bddb081) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab") 16 | (effects (font (size 0.4 0.4) (thickness 0.06))) 17 | (tstamp 1d98d3c8-2b2a-45c6-a8aa-18f8883075e8) 18 | ) 19 | (fp_line (start 0 1.56) (end -0.8 1.56) (layer "F.SilkS") (width 0.12) (tstamp 5c872198-f83c-4deb-bcd0-5e52f65e0e5d)) 20 | (fp_line (start 0 -1.56) (end -1.8 -1.56) (layer "F.SilkS") (width 0.12) (tstamp 5d7a707b-f275-4fad-8928-d0bfc3f8298e)) 21 | (fp_line (start 2.25 1) (end 2.25 0) (layer "F.SilkS") (width 0.2) (tstamp 5f31d443-58e6-4805-bcb0-d880f09a50df)) 22 | (fp_line (start 1 0) (end 2.25 0) (layer "F.SilkS") (width 0.2) (tstamp 90ee4e97-7c26-4f02-a453-8646842270f1)) 23 | (fp_line (start 0 -1.56) (end 0.8 -1.56) (layer "F.SilkS") (width 0.12) (tstamp a57e1f92-0841-41c3-9b13-8d0fa468bbf1)) 24 | (fp_line (start 0 1.56) (end 0.8 1.56) (layer "F.SilkS") (width 0.12) (tstamp e6f5720c-3d7c-4c2a-84d7-f7292c464a1e)) 25 | (fp_line (start 2.05 1.7) (end 2.05 -1.7) (layer "F.CrtYd") (width 0.05) (tstamp 58caaf06-a2ac-48da-8158-655193313766)) 26 | (fp_line (start 2.05 -1.7) (end -2.05 -1.7) (layer "F.CrtYd") (width 0.05) (tstamp 65cf7beb-4413-43bc-9872-e73ad0a4805d)) 27 | (fp_line (start -2.05 1.7) (end 2.05 1.7) (layer "F.CrtYd") (width 0.05) (tstamp cb6671c0-28a5-42e4-8f16-66923724624d)) 28 | (fp_line (start -2.05 -1.7) (end -2.05 1.7) (layer "F.CrtYd") (width 0.05) (tstamp d2a525c4-c467-44ab-97a1-46cf85abf391)) 29 | (fp_line (start -0.8 -1.05) (end -0.4 -1.45) (layer "F.Fab") (width 0.1) (tstamp 091110c3-21ea-4b57-9368-9e27fd1d4d42)) 30 | (fp_line (start -0.4 -1.45) (end 0.8 -1.45) (layer "F.Fab") (width 0.1) (tstamp 352178c2-98bc-4735-9f9c-ee325cb28d9e)) 31 | (fp_line (start 0.8 1.45) (end -0.8 1.45) (layer "F.Fab") (width 0.1) (tstamp 36a30153-0835-4d5d-94ab-385a0d55da06)) 32 | (fp_line (start 0.8 -1.45) (end 0.8 1.45) (layer "F.Fab") (width 0.1) (tstamp 975d3300-9f82-4018-afbb-3313b3e7a832)) 33 | (fp_line (start -0.8 1.45) (end -0.8 -1.05) (layer "F.Fab") (width 0.1) (tstamp ac98af85-c012-44e4-8755-6aff03fb0c8e)) 34 | (pad "1" smd roundrect (at -1.1375 -0.95) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 336e5379-6c3a-49a5-aac4-c9b65fe9014b)) 35 | (pad "2" smd roundrect (at -1.1375 0) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5033a491-6a07-4f29-ac14-6699975887c3)) 36 | (pad "3" smd roundrect (at -1.1375 0.95) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp be86cf09-6e08-4eba-a0a7-b3a41fae1c45)) 37 | (pad "4" smd roundrect (at 1.1375 0.95) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp aca20f50-b13f-4998-8e32-0f7f56329af7)) 38 | (pad "5" smd roundrect (at 1.1375 -0.95) (size 1.325 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 03f47f3f-92e0-48c0-9d6c-9fa3e96911e1)) 39 | (model "${KICAD6_3DMODEL_DIR}/Package_TO_SOT_SMD.3dshapes/SOT-23-5.wrl" 40 | (offset (xyz 0 0 0)) 41 | (scale (xyz 1 1 1)) 42 | (rotate (xyz 0 0 0)) 43 | ) 44 | ) 45 | -------------------------------------------------------------------------------- /firmware/src/slider.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Diva Pico Silder Keys 3 | * WHowe 4 | * 5 | * MPR121 CapSense based Keys 6 | */ 7 | 8 | #include "slider.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "bsp/board.h" 15 | #include "hardware/gpio.h" 16 | #include "hardware/i2c.h" 17 | 18 | #include "board_defs.h" 19 | 20 | #include "config.h" 21 | #include "mpr121.h" 22 | 23 | #define MPR121_ADDR 0x5A 24 | 25 | static uint32_t touch_bits; 26 | static unsigned touch_count[32]; 27 | 28 | static bool sensor_ok[3]; 29 | 30 | static uint16_t zone_num = 16; 31 | 32 | void slider_init() 33 | { 34 | i2c_init(I2C_PORT, I2C_FREQ); 35 | gpio_set_function(I2C_SDA, GPIO_FUNC_I2C); 36 | gpio_set_function(I2C_SCL, GPIO_FUNC_I2C); 37 | gpio_pull_up(I2C_SDA); 38 | gpio_pull_up(I2C_SCL); 39 | 40 | for (int m = 0; m < 3; m++) { 41 | sensor_ok[m] = mpr121_init(MPR121_ADDR + m); 42 | } 43 | slider_update_config(); 44 | 45 | zone_num = sensor_ok[2] ? 32 : 16; 46 | } 47 | 48 | uint16_t slider_zone_num() 49 | { 50 | return zone_num; 51 | } 52 | 53 | void slider_update() 54 | { 55 | static uint32_t last_touch_bits; 56 | static uint16_t touch[3]; 57 | 58 | for (int m = 0; m < 3; m++) { 59 | if (!sensor_ok[m]) { 60 | continue; 61 | } 62 | touch[m] = mpr121_touched(MPR121_ADDR + m); 63 | } 64 | 65 | if (zone_num == 32) { 66 | touch_bits = (touch[0] & 0x7ff) | ((touch[1] & 0x7ff) << 11) | ((touch[2] & 0x3ff) << 22); 67 | } else { 68 | touch_bits = (touch[0] & 0xff) | ((touch[1] & 0xff) << 8); 69 | } 70 | 71 | uint32_t just_touched = touch_bits & ~last_touch_bits; 72 | last_touch_bits = touch_bits; 73 | 74 | for (int i = 0; i < zone_num; i++) { 75 | if (just_touched & (1 << i)) { 76 | touch_count[i]++; 77 | } 78 | } 79 | } 80 | 81 | const uint16_t *slider_raw() 82 | { 83 | static uint16_t raw[32]; 84 | 85 | if (zone_num == 32) { 86 | mpr121_raw(MPR121_ADDR, raw, 11); 87 | mpr121_raw(MPR121_ADDR + 1, raw + 11, 11); 88 | mpr121_raw(MPR121_ADDR + 2, raw + 22, 10); 89 | } else { 90 | mpr121_raw(MPR121_ADDR, raw, 8); 91 | mpr121_raw(MPR121_ADDR + 1, raw + 8, 8); 92 | } 93 | 94 | return raw; 95 | } 96 | 97 | bool slider_touched(unsigned zone) 98 | { 99 | if (zone >= zone_num) { 100 | return 0; 101 | } 102 | return touch_bits & (1 << zone); 103 | } 104 | 105 | uint32_t slider_touch_bits() 106 | { 107 | return touch_bits; 108 | } 109 | 110 | unsigned slider_count(unsigned zone) 111 | { 112 | if (zone >= zone_num) { 113 | return 0; 114 | } 115 | return touch_count[zone]; 116 | } 117 | 118 | void slider_reset_stat() 119 | { 120 | memset(touch_count, 0, sizeof(touch_count)); 121 | } 122 | 123 | void slider_update_config() 124 | { 125 | int zone_per_sensor = (zone_num == 32) ? 11 : 8; 126 | 127 | for (int m = 0; m < 3; m++) { 128 | if (!sensor_ok[m]) { 129 | continue; 130 | } 131 | mpr121_debounce(MPR121_ADDR + m, diva_cfg->sense.debounce_touch, 132 | diva_cfg->sense.debounce_release); 133 | mpr121_sense(MPR121_ADDR + m, diva_cfg->sense.global, 134 | diva_cfg->sense.keys + m * zone_per_sensor, 135 | zone_per_sensor); 136 | mpr121_filter(MPR121_ADDR + m, diva_cfg->sense.filter >> 6, 137 | (diva_cfg->sense.filter >> 4) & 0x03, 138 | diva_cfg->sense.filter & 0x07); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/WS2812B-4020.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "WS2812B-4020" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0.075 2.25 unlocked) (layer "F.SilkS") 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp c4ef411a-fc2f-4578-b8f7-35707fd98313) 7 | ) 8 | (fp_text value "WS2812B-4020" (at -0.125 -2) (layer "F.Fab") 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp f71f6ef5-85a2-4019-8a61-9ed148c2630e) 11 | ) 12 | (fp_line (start -1.9 -0.75) (end -1.6 -0.75) 13 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 04a7d87b-d414-409f-9786-71f87a80f93b)) 14 | (fp_line (start -1.9 0.75) (end -1.9 -0.75) 15 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 15850370-7f6a-40bb-88b7-ed1ce7634955)) 16 | (fp_line (start -1.9 0.75) (end -1.6 0.75) 17 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 08f76222-d92e-4cd8-ac24-76eb460db3c0)) 18 | (fp_line (start -1.6 -0.75) (end -1.35 -0.5) 19 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 20a6e613-2091-486b-8a60-1ef5ddfdca03)) 20 | (fp_line (start -1.35 -0.5) (end -1.9 0.05) 21 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 24f8d87e-49f2-4b68-9ab0-bd76e9c092ea)) 22 | (fp_line (start -1.35 -0.5) (end 1.35 -0.5) 23 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp f2ec24a5-4a47-41b2-90e7-7ade789345b7)) 24 | (fp_line (start 1.6 -0.75) (end 1.35 -0.5) 25 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 1cdd5aa8-7f47-47e8-b461-aab649f24b83)) 26 | (fp_line (start 1.9 -0.75) (end 1.6 -0.75) 27 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 2ce51cb6-acfd-4a83-9b8d-72e6b52fb687)) 28 | (fp_line (start 1.9 -0.75) (end 1.9 0.75) 29 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 15dde6f1-f99f-430b-94b0-d2397fe707e6)) 30 | (fp_line (start 1.9 0.75) (end 1.6 0.75) 31 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp b9f2f6be-9a58-4233-ba98-060a51b6f2c2)) 32 | (fp_circle (center 1.610848 -0.323504) (end 1.685848 -0.323504) 33 | (stroke (width 0.15) (type solid)) (fill none) (layer "F.SilkS") (tstamp 799eb67b-05fd-4eae-b78e-fa1624698ab3)) 34 | (fp_line (start -2.25 -1.25) (end -2.25 1.25) 35 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp ba7fb90a-8336-4498-93b4-c2273d2d4ba0)) 36 | (fp_line (start -2.25 1.25) (end -2.25 1.5) 37 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 9641c7a3-ac41-4578-9555-49158271e75e)) 38 | (fp_line (start -2.25 1.5) (end 2.25 1.5) 39 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 8de6e937-97eb-42d5-8a57-64d1712990b7)) 40 | (fp_line (start 2.25 -1.25) (end -2.25 -1.25) 41 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 50d5b259-04ee-494f-91f1-68f2aef65354)) 42 | (fp_line (start 2.25 1.5) (end 2.25 -1.25) 43 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 63ddbc1a-9e00-43a0-9bf8-4172b45f4c5d)) 44 | (fp_line (start -2 -0.85) (end -2 0.85) 45 | (stroke (width 0.01) (type solid)) (layer "F.Fab") (tstamp dd499963-442d-4d5d-90dc-ff908bf79f28)) 46 | (fp_line (start -2 0.85) (end 2 0.85) 47 | (stroke (width 0.01) (type solid)) (layer "F.Fab") (tstamp 87d3ff16-0d6c-431b-8d06-011365c55752)) 48 | (fp_line (start 2 -0.85) (end -2 -0.85) 49 | (stroke (width 0.01) (type solid)) (layer "F.Fab") (tstamp cd50ccd1-2447-44f8-b138-13e234490099)) 50 | (fp_line (start 2 0.85) (end 2 -0.85) 51 | (stroke (width 0.01) (type solid)) (layer "F.Fab") (tstamp 64dd97d5-957f-4e33-912f-8aa75849eaa4)) 52 | (pad "G" smd roundrect (at -1.275 0.65) (size 0.44 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 71100c4f-605f-491e-92fc-6047333603ce)) 53 | (pad "I" smd roundrect (at 1.275 0.65) (size 0.44 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 729e98d4-0174-4a58-a88c-81c56919a18f)) 54 | (pad "O" smd roundrect (at -0.425 0.65) (size 0.44 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp bf480819-6341-445e-a266-9b93b022be31)) 55 | (pad "V" smd roundrect (at 0.425 0.65) (size 0.44 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1e66c925-c559-4cf0-a647-e93345148782)) 56 | (model "${KIPRJMOD}/3dmodels/User Library-WS2812-4020.step" 57 | (offset (xyz 0 -1 0)) 58 | (scale (xyz 1 1 1)) 59 | (rotate (xyz 180 0 -180)) 60 | ) 61 | ) 62 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/WS2812B-4020.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "WS2812B-4020" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (attr smd) 4 | (fp_text reference "REF**" (at 0.075 2.25 unlocked) (layer "F.SilkS") 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | (tstamp c4ef411a-fc2f-4578-b8f7-35707fd98313) 7 | ) 8 | (fp_text value "WS2812B-4020" (at -0.125 -2) (layer "F.Fab") 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | (tstamp f71f6ef5-85a2-4019-8a61-9ed148c2630e) 11 | ) 12 | (fp_line (start -1.9 -0.75) (end -1.6 -0.75) 13 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 04a7d87b-d414-409f-9786-71f87a80f93b)) 14 | (fp_line (start -1.9 0.75) (end -1.9 -0.75) 15 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 15850370-7f6a-40bb-88b7-ed1ce7634955)) 16 | (fp_line (start -1.9 0.75) (end -1.6 0.75) 17 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 08f76222-d92e-4cd8-ac24-76eb460db3c0)) 18 | (fp_line (start -1.6 -0.75) (end -1.35 -0.5) 19 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 20a6e613-2091-486b-8a60-1ef5ddfdca03)) 20 | (fp_line (start -1.35 -0.5) (end -1.9 0.05) 21 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 24f8d87e-49f2-4b68-9ab0-bd76e9c092ea)) 22 | (fp_line (start -1.35 -0.5) (end 1.35 -0.5) 23 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp f2ec24a5-4a47-41b2-90e7-7ade789345b7)) 24 | (fp_line (start 1.6 -0.75) (end 1.35 -0.5) 25 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 1cdd5aa8-7f47-47e8-b461-aab649f24b83)) 26 | (fp_line (start 1.9 -0.75) (end 1.6 -0.75) 27 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 2ce51cb6-acfd-4a83-9b8d-72e6b52fb687)) 28 | (fp_line (start 1.9 -0.75) (end 1.9 0.75) 29 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp 15dde6f1-f99f-430b-94b0-d2397fe707e6)) 30 | (fp_line (start 1.9 0.75) (end 1.6 0.75) 31 | (stroke (width 0.15) (type solid)) (layer "F.SilkS") (tstamp b9f2f6be-9a58-4233-ba98-060a51b6f2c2)) 32 | (fp_circle (center 1.610848 -0.323504) (end 1.685848 -0.323504) 33 | (stroke (width 0.15) (type solid)) (fill none) (layer "F.SilkS") (tstamp 799eb67b-05fd-4eae-b78e-fa1624698ab3)) 34 | (fp_line (start -2.25 -1.25) (end -2.25 1.25) 35 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp ba7fb90a-8336-4498-93b4-c2273d2d4ba0)) 36 | (fp_line (start -2.25 1.25) (end -2.25 1.5) 37 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 9641c7a3-ac41-4578-9555-49158271e75e)) 38 | (fp_line (start -2.25 1.5) (end 2.25 1.5) 39 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 8de6e937-97eb-42d5-8a57-64d1712990b7)) 40 | (fp_line (start 2.25 -1.25) (end -2.25 -1.25) 41 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 50d5b259-04ee-494f-91f1-68f2aef65354)) 42 | (fp_line (start 2.25 1.5) (end 2.25 -1.25) 43 | (stroke (width 0.01) (type solid)) (layer "F.CrtYd") (tstamp 63ddbc1a-9e00-43a0-9bf8-4172b45f4c5d)) 44 | (fp_line (start -2 -0.85) (end -2 0.85) 45 | (stroke (width 0.01) (type solid)) (layer "F.Fab") (tstamp dd499963-442d-4d5d-90dc-ff908bf79f28)) 46 | (fp_line (start -2 0.85) (end 2 0.85) 47 | (stroke (width 0.01) (type solid)) (layer "F.Fab") (tstamp 87d3ff16-0d6c-431b-8d06-011365c55752)) 48 | (fp_line (start 2 -0.85) (end -2 -0.85) 49 | (stroke (width 0.01) (type solid)) (layer "F.Fab") (tstamp cd50ccd1-2447-44f8-b138-13e234490099)) 50 | (fp_line (start 2 0.85) (end 2 -0.85) 51 | (stroke (width 0.01) (type solid)) (layer "F.Fab") (tstamp 64dd97d5-957f-4e33-912f-8aa75849eaa4)) 52 | (pad "G" smd roundrect (at -1.275 0.65) (size 0.44 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 71100c4f-605f-491e-92fc-6047333603ce)) 53 | (pad "I" smd roundrect (at 1.275 0.65) (size 0.44 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 729e98d4-0174-4a58-a88c-81c56919a18f)) 54 | (pad "O" smd roundrect (at -0.425 0.65) (size 0.44 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp bf480819-6341-445e-a266-9b93b022be31)) 55 | (pad "V" smd roundrect (at 0.425 0.65) (size 0.44 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1e66c925-c559-4cf0-a647-e93345148782)) 56 | (model "${KIPRJMOD}/3dmodels/User Library-WS2812-4020.step" 57 | (offset (xyz 0 -1 0)) 58 | (scale (xyz 1 1 1)) 59 | (rotate (xyz 180 0 -180)) 60 | ) 61 | ) 62 | -------------------------------------------------------------------------------- /firmware/src/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by board.mk 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | // RHPort number used for device can be defined by board.mk, default to port 0 43 | #ifndef BOARD_DEVICE_RHPORT_NUM 44 | #define BOARD_DEVICE_RHPORT_NUM 0 45 | #endif 46 | 47 | // RHPort max operational speed can defined by board.mk 48 | // Default to Highspeed for MCU with internal HighSpeed PHY (can be port 49 | // specific), otherwise FullSpeed 50 | #ifndef BOARD_DEVICE_RHPORT_SPEED 51 | #if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || \ 52 | CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505 || \ 53 | CFG_TUSB_MCU == OPT_MCU_CXD56) 54 | #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED 55 | #else 56 | #define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED 57 | #endif 58 | #endif 59 | 60 | // Device mode with rhport and speed defined by board.mk 61 | #if BOARD_DEVICE_RHPORT_NUM == 0 62 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED) 63 | #elif BOARD_DEVICE_RHPORT_NUM == 1 64 | #define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED) 65 | #else 66 | #error "Incorrect RHPort configuration" 67 | #endif 68 | 69 | #ifndef CFG_TUSB_OS 70 | #define CFG_TUSB_OS OPT_OS_NONE 71 | #endif 72 | 73 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 74 | // #define CFG_TUSB_DEBUG 0 75 | 76 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction 77 | * on alignment. Tinyusb use follows macros to declare transferring memory so 78 | * that they can be put into those specific section. e.g 79 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 80 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 81 | */ 82 | #ifndef CFG_TUSB_MEM_SECTION 83 | #define CFG_TUSB_MEM_SECTION 84 | #endif 85 | 86 | #ifndef CFG_TUSB_MEM_ALIGN 87 | #define CFG_TUSB_MEM_ALIGN __attribute__((aligned(4))) 88 | #endif 89 | 90 | //-------------------------------------------------------------------- 91 | // DEVICE CONFIGURATION 92 | //-------------------------------------------------------------------- 93 | 94 | #ifndef CFG_TUD_ENDPOINT0_SIZE 95 | #define CFG_TUD_ENDPOINT0_SIZE 64 96 | #endif 97 | 98 | //------------- CLASS -------------// 99 | #define CFG_TUD_HID 3 100 | #define CFG_TUD_CDC 2 101 | #define CFG_TUD_MSC 0 102 | #define CFG_TUD_MIDI 0 103 | #define CFG_TUD_VENDOR 0 104 | 105 | #define CFG_TUD_VENDOR 0 106 | 107 | // HID buffer size Should be sufficient to hold ID (if any) + Data 108 | #define CFG_TUD_HID_EP_BUFSIZE 64 109 | 110 | // CDC FIFO size of TX and RX 111 | #define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 128) 112 | #define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 128) 113 | 114 | // CDC Endpoint transfer buffer size, more is faster 115 | #define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 128) 116 | 117 | #ifdef __cplusplus 118 | } 119 | #endif 120 | 121 | #endif /* _TUSB_CONFIG_H_ */ 122 | -------------------------------------------------------------------------------- /firmware/src/lzfx.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Lzfx decompressor 3 | * WHowe 4 | * This is actually taken from CrazyRedMachine's repo 5 | * 6 | */ 7 | 8 | 9 | #include 10 | #include "lzfx.h" 11 | 12 | typedef unsigned char u8; 13 | typedef const u8 *LZSTATE[LZFX_HSIZE]; 14 | 15 | 16 | /* Guess len. No parameters may be NULL; this is not checked. */ 17 | static int lzfx_getsize(const void *ibuf, unsigned int ilen, unsigned int *olen) 18 | { 19 | 20 | u8 const *ip = (const u8 *)ibuf; 21 | u8 const *const in_end = ip + ilen; 22 | int tot_len = 0; 23 | 24 | while (ip < in_end) 25 | { 26 | 27 | unsigned int ctrl = *ip++; 28 | 29 | if (ctrl < (1 << 5)) 30 | { 31 | 32 | ctrl++; 33 | 34 | if (ip + ctrl > in_end) 35 | return LZFX_ECORRUPT; 36 | 37 | tot_len += ctrl; 38 | ip += ctrl; 39 | } 40 | else 41 | { 42 | 43 | unsigned int len = (ctrl >> 5); 44 | 45 | if (len == 7) 46 | { /* i.e. format #2 */ 47 | len += *ip++; 48 | } 49 | 50 | len += 2; /* len is now #octets */ 51 | 52 | if (ip >= in_end) 53 | return LZFX_ECORRUPT; 54 | 55 | ip++; /* skip the ref byte */ 56 | 57 | tot_len += len; 58 | } 59 | } 60 | 61 | *olen = tot_len; 62 | 63 | return 0; 64 | } 65 | 66 | /* Decompressor */ 67 | int lzfx_decompress(const void *ibuf, unsigned int ilen, 68 | void *obuf, unsigned int *olen) 69 | { 70 | 71 | u8 const *ip = (const u8 *)ibuf; 72 | u8 const *const in_end = ip + ilen; 73 | u8 *op = (u8 *)obuf; 74 | u8 const *const out_end = (olen == NULL ? NULL : op + *olen); 75 | 76 | unsigned int remain_len = 0; 77 | int rc; 78 | 79 | if (olen == NULL) 80 | return LZFX_EARGS; 81 | if (ibuf == NULL) 82 | { 83 | if (ilen != 0) 84 | return LZFX_EARGS; 85 | *olen = 0; 86 | return 0; 87 | } 88 | if (obuf == NULL) 89 | { 90 | if (olen != 0) 91 | return LZFX_EARGS; 92 | return lzfx_getsize(ibuf, ilen, olen); 93 | } 94 | 95 | do 96 | { 97 | unsigned int ctrl = *ip++; 98 | 99 | /* Format 000LLLLL: a literal byte string follows, of length L+1 */ 100 | if (ctrl < (1 << 5)) 101 | { 102 | 103 | ctrl++; 104 | 105 | if (fx_expect_false(op + ctrl > out_end)) 106 | { 107 | --ip; /* Rewind to control byte */ 108 | goto guess; 109 | } 110 | if (fx_expect_false(ip + ctrl > in_end)) 111 | return LZFX_ECORRUPT; 112 | 113 | do 114 | *op++ = *ip++; 115 | while (--ctrl); 116 | 117 | /* Format #1 [LLLooooo oooooooo]: backref of length L+1+2 118 | ^^^^^ ^^^^^^^^ 119 | A B 120 | #2 [111ooooo LLLLLLLL oooooooo] backref of length L+7+2 121 | ^^^^^ ^^^^^^^^ 122 | A B 123 | In both cases the location of the backref is computed from the 124 | remaining part of the data as follows: 125 | 126 | location = op - A*256 - B - 1 127 | */ 128 | } 129 | else 130 | { 131 | 132 | unsigned int len = (ctrl >> 5); 133 | u8 *ref = op - ((ctrl & 0x1f) << 8) - 1; 134 | 135 | if (len == 7) 136 | len += *ip++; /* i.e. format #2 */ 137 | 138 | len += 2; /* len is now #octets */ 139 | 140 | if (fx_expect_false(op + len > out_end)) 141 | { 142 | ip -= (len >= 9) ? 2 : 1; /* Rewind to control byte */ 143 | goto guess; 144 | } 145 | if (fx_expect_false(ip >= in_end)) 146 | return LZFX_ECORRUPT; 147 | 148 | ref -= *ip++; 149 | 150 | if (fx_expect_false(ref < (u8 *)obuf)) 151 | return LZFX_ECORRUPT; 152 | 153 | do 154 | *op++ = *ref++; 155 | while (--len); 156 | } 157 | 158 | } while (ip < in_end); 159 | 160 | *olen = op - (u8 *)obuf; 161 | 162 | return 0; 163 | 164 | guess: 165 | rc = lzfx_getsize(ip, ilen - (ip - (u8 *)ibuf), &remain_len); 166 | if (rc >= 0) 167 | *olen = remain_len + (op - (u8 *)obuf); 168 | return rc; 169 | } 170 | -------------------------------------------------------------------------------- /firmware/src/save.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Controller Config Save and Load 3 | * WHowe 4 | * 5 | * Config is stored in last sector of flash 6 | */ 7 | 8 | #include "save.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | #include "bsp/board.h" 17 | #include "pico/bootrom.h" 18 | #include "pico/stdio.h" 19 | 20 | #include "hardware/flash.h" 21 | #include "pico/multicore.h" 22 | #include "pico/unique_id.h" 23 | 24 | static struct { 25 | size_t size; 26 | size_t offset; 27 | void (*after_load)(); 28 | } modules[8] = {0}; 29 | static int module_num = 0; 30 | 31 | static uint32_t my_magic = 0xcafecafe; 32 | 33 | #define SAVE_TIMEOUT_US 5000000 34 | 35 | #define SAVE_SECTOR_OFFSET (PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE) 36 | 37 | typedef struct __attribute ((packed)) { 38 | uint32_t magic; 39 | uint8_t data[FLASH_PAGE_SIZE - 4]; 40 | } page_t; 41 | 42 | static page_t old_data = {0}; 43 | static page_t new_data = {0}; 44 | static page_t default_data = {0}; 45 | static int data_page = -1; 46 | 47 | static bool requesting_save = false; 48 | static uint64_t requesting_time = 0; 49 | 50 | static mutex_t *io_lock; 51 | 52 | static void save_program() 53 | { 54 | old_data = new_data; 55 | 56 | data_page = (data_page + 1) % (FLASH_SECTOR_SIZE / FLASH_PAGE_SIZE); 57 | printf("\nProgram Flash %d %8lx\n", data_page, old_data.magic); 58 | if (mutex_enter_timeout_us(io_lock, 100000)) { 59 | sleep_ms(10); /* wait for all io operations to finish */ 60 | uint32_t ints = save_and_disable_interrupts(); 61 | if (data_page == 0) { 62 | flash_range_erase(SAVE_SECTOR_OFFSET, FLASH_SECTOR_SIZE); 63 | } 64 | flash_range_program(SAVE_SECTOR_OFFSET + data_page * FLASH_PAGE_SIZE, 65 | (uint8_t *)&old_data, FLASH_PAGE_SIZE); 66 | restore_interrupts(ints); 67 | mutex_exit(io_lock); 68 | } else { 69 | printf("Program Flash Failed.\n"); 70 | } 71 | } 72 | 73 | static void load_default() 74 | { 75 | printf("Load Default\n"); 76 | new_data = default_data; 77 | new_data.magic = my_magic; 78 | } 79 | 80 | static const page_t *get_page(int id) 81 | { 82 | int addr = XIP_BASE + SAVE_SECTOR_OFFSET; 83 | return (page_t *)(addr + FLASH_PAGE_SIZE * id); 84 | } 85 | 86 | static void save_load() 87 | { 88 | for (int i = 0; i < FLASH_SECTOR_SIZE / FLASH_PAGE_SIZE; i++) { 89 | if (get_page(i)->magic != my_magic) { 90 | break; 91 | } 92 | data_page = i; 93 | } 94 | 95 | if (data_page < 0) { 96 | load_default(); 97 | save_request(false); 98 | return; 99 | } 100 | 101 | old_data = *get_page(data_page); 102 | new_data = old_data; 103 | printf("Page Loaded %d %8lx\n", data_page, new_data.magic); 104 | } 105 | 106 | static void save_loaded() 107 | { 108 | for (int i = 0; i < module_num; i++) { 109 | modules[i].after_load(); 110 | } 111 | } 112 | 113 | static union __attribute__((packed)) { 114 | pico_unique_board_id_t id; 115 | struct { 116 | uint32_t id32h; 117 | uint32_t id32l; 118 | }; 119 | uint64_t id64; 120 | } board_id; 121 | 122 | uint32_t board_id_32() 123 | { 124 | pico_get_unique_board_id(&board_id.id); 125 | return board_id.id32h ^ board_id.id32l; 126 | } 127 | 128 | uint64_t board_id_64() 129 | { 130 | pico_get_unique_board_id(&board_id.id); 131 | return board_id.id64; 132 | } 133 | 134 | void save_init(uint32_t magic, mutex_t *locker) 135 | { 136 | my_magic = magic; 137 | io_lock = locker; 138 | save_load(); 139 | save_loop(); 140 | save_loaded(); 141 | } 142 | 143 | void save_loop() 144 | { 145 | if (requesting_save && (time_us_64() - requesting_time > SAVE_TIMEOUT_US)) { 146 | requesting_save = false; 147 | /* only when data is actually changed */ 148 | if (memcmp(&old_data, &new_data, sizeof(old_data)) == 0) { 149 | return; 150 | } 151 | save_program(); 152 | } 153 | } 154 | 155 | void *save_alloc(size_t size, void *def, void (*after_load)()) 156 | { 157 | modules[module_num].size = size; 158 | size_t offset = module_num > 0 ? modules[module_num - 1].offset + size : 0; 159 | modules[module_num].offset = offset; 160 | modules[module_num].after_load = after_load; 161 | module_num++; 162 | memcpy(default_data.data + offset, def, size); // backup the default 163 | return new_data.data + offset; 164 | } 165 | 166 | void save_request(bool immediately) 167 | { 168 | if (!requesting_save) { 169 | printf("Save requested.\n"); 170 | requesting_save = true; 171 | new_data.magic = my_magic; 172 | requesting_time = time_us_64(); 173 | } 174 | if (immediately) { 175 | requesting_time = 0; 176 | save_loop(); 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /PCB/pico/RP_Silicon_KiCad/KiCadLibraries/MCU_RaspberryPi_and_Boards.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # Pico 5 | # 6 | DEF Pico U 0 40 Y Y 1 F N 7 | F0 "U" -550 1100 50 H V C CNN 8 | F1 "Pico" 0 750 50 H V C CNN 9 | F2 "RPi_Pico:RPi_Pico_SMD_TH" 0 0 50 V I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | DRAW 12 | T 0 0 850 50 0 0 0 "Raspberry Pi" Normal 0 C C 13 | S -600 1050 600 -1050 0 1 0 f 14 | X GPIO0 1 -700 950 100 R 50 50 1 1 B 15 | X GPIO7 10 -700 50 100 R 50 50 1 1 B 16 | X GPIO8 11 -700 -50 100 R 50 50 1 1 B 17 | X GPIO9 12 -700 -150 100 R 50 50 1 1 B 18 | X GND 13 -700 -250 100 R 50 50 1 1 W 19 | X GPIO10 14 -700 -350 100 R 50 50 1 1 B 20 | X GPIO11 15 -700 -450 100 R 50 50 1 1 B 21 | X GPIO12 16 -700 -550 100 R 50 50 1 1 B 22 | X GPIO13 17 -700 -650 100 R 50 50 1 1 B 23 | X GND 18 -700 -750 100 R 50 50 1 1 W 24 | X GPIO14 19 -700 -850 100 R 50 50 1 1 B 25 | X GPIO1 2 -700 850 100 R 50 50 1 1 B 26 | X GPIO15 20 -700 -950 100 R 50 50 1 1 B 27 | X GPIO16 21 700 -950 100 L 50 50 1 1 B 28 | X GPIO17 22 700 -850 100 L 50 50 1 1 B 29 | X GND 23 700 -750 100 L 50 50 1 1 W 30 | X GPIO18 24 700 -650 100 L 50 50 1 1 B 31 | X GPIO19 25 700 -550 100 L 50 50 1 1 B 32 | X GPIO20 26 700 -450 100 L 50 50 1 1 B 33 | X GPIO21 27 700 -350 100 L 50 50 1 1 B 34 | X GND 28 700 -250 100 L 50 50 1 1 W 35 | X GPIO22 29 700 -150 100 L 50 50 1 1 B 36 | X GND 3 -700 750 100 R 50 50 1 1 W 37 | X RUN 30 700 -50 100 L 50 50 1 1 I 38 | X GPIO26_ADC0 31 700 50 100 L 50 50 1 1 B 39 | X GPIO27_ADC1 32 700 150 100 L 50 50 1 1 B 40 | X AGND 33 700 250 100 L 50 50 1 1 W 41 | X GPIO28_ADC2 34 700 350 100 L 50 50 1 1 B 42 | X ADC_VREF 35 700 450 100 L 50 50 1 1 U 43 | X 3V3 36 700 550 100 L 50 50 1 1 U 44 | X 3V3_EN 37 700 650 100 L 50 50 1 1 I 45 | X GND 38 700 750 100 L 50 50 1 1 B 46 | X VSYS 39 700 850 100 L 50 50 1 1 U 47 | X GPIO2 4 -700 650 100 R 50 50 1 1 B 48 | X VBUS 40 700 950 100 L 50 50 1 1 U 49 | X SWCLK 41 -100 -1150 100 U 50 50 1 1 I 50 | X GND 42 0 -1150 100 U 50 50 1 1 W 51 | X SWDIO 43 100 -1150 100 U 50 50 1 1 B 52 | X GPIO3 5 -700 550 100 R 50 50 1 1 B 53 | X GPIO4 6 -700 450 100 R 50 50 1 1 B 54 | X GPIO5 7 -700 350 100 R 50 50 1 1 B 55 | X GND 8 -700 250 100 R 50 50 1 1 W 56 | X GPIO6 9 -700 150 100 R 50 50 1 1 B 57 | X TP1 TP1 0 1150 100 D 50 50 1 1 U 58 | X TP2 TP2 100 1150 100 D 50 50 1 1 B 59 | X TP3 TP3 -100 1150 100 D 50 50 1 1 B 60 | ENDDRAW 61 | ENDDEF 62 | # 63 | # RP2040 64 | # 65 | DEF RP2040 U 0 40 Y Y 1 F N 66 | F0 "U" -1150 1950 50 H V C CNN 67 | F1 "RP2040" 950 -1950 50 H V C CNN 68 | F2 "RP2040_minimal:RP2040-QFN-56" -750 0 50 H I C CNN 69 | F3 "" -750 0 50 H I C CNN 70 | DRAW 71 | T 0 0 200 100 0 0 0 "Raspberry Pi" Normal 0 C C 72 | T 0 0 0 100 0 0 0 RP2040 Normal 0 C C 73 | S 1150 1900 -1150 -1900 0 1 10 f 74 | X IOVDD 1 350 2000 100 D 50 50 1 1 W 75 | X IOVDD 10 250 2000 100 D 50 50 1 1 W 76 | X GPIO8 11 1250 500 100 L 50 50 1 1 B 77 | X GPIO9 12 1250 400 100 L 50 50 1 1 B 78 | X GPIO10 13 1250 300 100 L 50 50 1 1 B 79 | X GPIO11 14 1250 200 100 L 50 50 1 1 B 80 | X GPIO12 15 1250 100 100 L 50 50 1 1 B 81 | X GPIO13 16 1250 0 100 L 50 50 1 1 B 82 | X GPIO14 17 1250 -100 100 L 50 50 1 1 B 83 | X GPIO15 18 1250 -200 100 L 50 50 1 1 B 84 | X TESTEN 19 -500 -2000 100 U 50 50 1 1 P 85 | X GPIO0 2 1250 1300 100 L 50 50 1 1 B 86 | X XIN 20 -1250 -100 100 R 50 50 1 1 I 87 | X XOUT 21 -1250 -300 100 R 50 50 1 1 P 88 | X IOVDD 22 150 2000 100 D 50 50 1 1 W 89 | X DVDD 23 -700 2000 100 D 50 50 1 1 W 90 | X SWCLK 24 -1250 -1250 100 R 50 50 1 1 O 91 | X SWD 25 -1250 -1350 100 R 50 50 1 1 B 92 | X RUN 26 -1250 -800 100 R 50 50 1 1 I 93 | X GPIO16 27 1250 -300 100 L 50 50 1 1 B 94 | X GPIO17 28 1250 -400 100 L 50 50 1 1 B 95 | X GPIO18 29 1250 -500 100 L 50 50 1 1 B 96 | X GPIO1 3 1250 1200 100 L 50 50 1 1 B 97 | X GPIO19 30 1250 -600 100 L 50 50 1 1 B 98 | X GPIO20 31 1250 -700 100 L 50 50 1 1 B 99 | X GPIO21 32 1250 -800 100 L 50 50 1 1 B 100 | X IOVDD 33 50 2000 100 D 50 50 1 1 W 101 | X GPIO22 34 1250 -900 100 L 50 50 1 1 B 102 | X GPIO23 35 1250 -1000 100 L 50 50 1 1 B 103 | X GPIO24 36 1250 -1100 100 L 50 50 1 1 B 104 | X GPIO25 37 1250 -1200 100 L 50 50 1 1 B 105 | X GPIO26_ADC0 38 1250 -1400 100 L 50 50 1 1 B 106 | X GPIO27_ADC1 39 1250 -1500 100 L 50 50 1 1 B 107 | X GPIO2 4 1250 1100 100 L 50 50 1 1 B 108 | X GPIO28_ADC2 40 1250 -1600 100 L 50 50 1 1 B 109 | X GPIO29_ADC3 41 1250 -1700 100 L 50 50 1 1 B 110 | X IOVDD 42 -50 2000 100 D 50 50 1 1 W 111 | X ADC_AVDD 43 650 2000 100 D 50 50 1 1 W 112 | X VREG_IN 44 -350 2000 100 D 50 50 1 1 W 113 | X VREG_VOUT 45 -500 2000 100 D 50 50 1 1 w 114 | X USB_DM 46 1250 1600 100 L 50 50 1 1 B 115 | X USB_DP 47 1250 1700 100 L 50 50 1 1 B 116 | X USB_VDD 48 500 2000 100 D 50 50 1 1 W 117 | X IOVDD 49 -150 2000 100 D 50 50 1 1 W 118 | X GPIO3 5 1250 1000 100 L 50 50 1 1 B 119 | X DVDD 50 -800 2000 100 D 50 50 1 1 W 120 | X QSPI_SD3 51 -1250 800 100 R 50 50 1 1 B 121 | X QSPI_SCLK 52 -1250 650 100 R 50 50 1 1 O 122 | X QSPI_SD0 53 -1250 1100 100 R 50 50 1 1 B 123 | X QSPI_SD2 54 -1250 900 100 R 50 50 1 1 B 124 | X QSPI_SD1 55 -1250 1000 100 R 50 50 1 1 B 125 | X QSPI_SS 56 -1250 1250 100 R 50 50 1 1 B 126 | X GND 57 0 -2000 100 U 50 50 1 1 W 127 | X GPIO4 6 1250 900 100 L 50 50 1 1 B 128 | X GPIO5 7 1250 800 100 L 50 50 1 1 B 129 | X GPIO6 8 1250 700 100 L 50 50 1 1 B 130 | X GPIO7 9 1250 600 100 L 50 50 1 1 B 131 | ENDDRAW 132 | ENDDEF 133 | # 134 | #End Library 135 | -------------------------------------------------------------------------------- /PCB/plus/RP_Silicon_KiCad/KiCadLibraries/MCU_RaspberryPi_and_Boards.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # Pico 5 | # 6 | DEF Pico U 0 40 Y Y 1 F N 7 | F0 "U" -550 1100 50 H V C CNN 8 | F1 "Pico" 0 750 50 H V C CNN 9 | F2 "RPi_Pico:RPi_Pico_SMD_TH" 0 0 50 V I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | DRAW 12 | T 0 0 850 50 0 0 0 "Raspberry Pi" Normal 0 C C 13 | S -600 1050 600 -1050 0 1 0 f 14 | X GPIO0 1 -700 950 100 R 50 50 1 1 B 15 | X GPIO7 10 -700 50 100 R 50 50 1 1 B 16 | X GPIO8 11 -700 -50 100 R 50 50 1 1 B 17 | X GPIO9 12 -700 -150 100 R 50 50 1 1 B 18 | X GND 13 -700 -250 100 R 50 50 1 1 W 19 | X GPIO10 14 -700 -350 100 R 50 50 1 1 B 20 | X GPIO11 15 -700 -450 100 R 50 50 1 1 B 21 | X GPIO12 16 -700 -550 100 R 50 50 1 1 B 22 | X GPIO13 17 -700 -650 100 R 50 50 1 1 B 23 | X GND 18 -700 -750 100 R 50 50 1 1 W 24 | X GPIO14 19 -700 -850 100 R 50 50 1 1 B 25 | X GPIO1 2 -700 850 100 R 50 50 1 1 B 26 | X GPIO15 20 -700 -950 100 R 50 50 1 1 B 27 | X GPIO16 21 700 -950 100 L 50 50 1 1 B 28 | X GPIO17 22 700 -850 100 L 50 50 1 1 B 29 | X GND 23 700 -750 100 L 50 50 1 1 W 30 | X GPIO18 24 700 -650 100 L 50 50 1 1 B 31 | X GPIO19 25 700 -550 100 L 50 50 1 1 B 32 | X GPIO20 26 700 -450 100 L 50 50 1 1 B 33 | X GPIO21 27 700 -350 100 L 50 50 1 1 B 34 | X GND 28 700 -250 100 L 50 50 1 1 W 35 | X GPIO22 29 700 -150 100 L 50 50 1 1 B 36 | X GND 3 -700 750 100 R 50 50 1 1 W 37 | X RUN 30 700 -50 100 L 50 50 1 1 I 38 | X GPIO26_ADC0 31 700 50 100 L 50 50 1 1 B 39 | X GPIO27_ADC1 32 700 150 100 L 50 50 1 1 B 40 | X AGND 33 700 250 100 L 50 50 1 1 W 41 | X GPIO28_ADC2 34 700 350 100 L 50 50 1 1 B 42 | X ADC_VREF 35 700 450 100 L 50 50 1 1 U 43 | X 3V3 36 700 550 100 L 50 50 1 1 U 44 | X 3V3_EN 37 700 650 100 L 50 50 1 1 I 45 | X GND 38 700 750 100 L 50 50 1 1 B 46 | X VSYS 39 700 850 100 L 50 50 1 1 U 47 | X GPIO2 4 -700 650 100 R 50 50 1 1 B 48 | X VBUS 40 700 950 100 L 50 50 1 1 U 49 | X SWCLK 41 -100 -1150 100 U 50 50 1 1 I 50 | X GND 42 0 -1150 100 U 50 50 1 1 W 51 | X SWDIO 43 100 -1150 100 U 50 50 1 1 B 52 | X GPIO3 5 -700 550 100 R 50 50 1 1 B 53 | X GPIO4 6 -700 450 100 R 50 50 1 1 B 54 | X GPIO5 7 -700 350 100 R 50 50 1 1 B 55 | X GND 8 -700 250 100 R 50 50 1 1 W 56 | X GPIO6 9 -700 150 100 R 50 50 1 1 B 57 | X TP1 TP1 0 1150 100 D 50 50 1 1 U 58 | X TP2 TP2 100 1150 100 D 50 50 1 1 B 59 | X TP3 TP3 -100 1150 100 D 50 50 1 1 B 60 | ENDDRAW 61 | ENDDEF 62 | # 63 | # RP2040 64 | # 65 | DEF RP2040 U 0 40 Y Y 1 F N 66 | F0 "U" -1150 1950 50 H V C CNN 67 | F1 "RP2040" 950 -1950 50 H V C CNN 68 | F2 "RP2040_minimal:RP2040-QFN-56" -750 0 50 H I C CNN 69 | F3 "" -750 0 50 H I C CNN 70 | DRAW 71 | T 0 0 200 100 0 0 0 "Raspberry Pi" Normal 0 C C 72 | T 0 0 0 100 0 0 0 RP2040 Normal 0 C C 73 | S 1150 1900 -1150 -1900 0 1 10 f 74 | X IOVDD 1 350 2000 100 D 50 50 1 1 W 75 | X IOVDD 10 250 2000 100 D 50 50 1 1 W 76 | X GPIO8 11 1250 500 100 L 50 50 1 1 B 77 | X GPIO9 12 1250 400 100 L 50 50 1 1 B 78 | X GPIO10 13 1250 300 100 L 50 50 1 1 B 79 | X GPIO11 14 1250 200 100 L 50 50 1 1 B 80 | X GPIO12 15 1250 100 100 L 50 50 1 1 B 81 | X GPIO13 16 1250 0 100 L 50 50 1 1 B 82 | X GPIO14 17 1250 -100 100 L 50 50 1 1 B 83 | X GPIO15 18 1250 -200 100 L 50 50 1 1 B 84 | X TESTEN 19 -500 -2000 100 U 50 50 1 1 P 85 | X GPIO0 2 1250 1300 100 L 50 50 1 1 B 86 | X XIN 20 -1250 -100 100 R 50 50 1 1 I 87 | X XOUT 21 -1250 -300 100 R 50 50 1 1 P 88 | X IOVDD 22 150 2000 100 D 50 50 1 1 W 89 | X DVDD 23 -700 2000 100 D 50 50 1 1 W 90 | X SWCLK 24 -1250 -1250 100 R 50 50 1 1 O 91 | X SWD 25 -1250 -1350 100 R 50 50 1 1 B 92 | X RUN 26 -1250 -800 100 R 50 50 1 1 I 93 | X GPIO16 27 1250 -300 100 L 50 50 1 1 B 94 | X GPIO17 28 1250 -400 100 L 50 50 1 1 B 95 | X GPIO18 29 1250 -500 100 L 50 50 1 1 B 96 | X GPIO1 3 1250 1200 100 L 50 50 1 1 B 97 | X GPIO19 30 1250 -600 100 L 50 50 1 1 B 98 | X GPIO20 31 1250 -700 100 L 50 50 1 1 B 99 | X GPIO21 32 1250 -800 100 L 50 50 1 1 B 100 | X IOVDD 33 50 2000 100 D 50 50 1 1 W 101 | X GPIO22 34 1250 -900 100 L 50 50 1 1 B 102 | X GPIO23 35 1250 -1000 100 L 50 50 1 1 B 103 | X GPIO24 36 1250 -1100 100 L 50 50 1 1 B 104 | X GPIO25 37 1250 -1200 100 L 50 50 1 1 B 105 | X GPIO26_ADC0 38 1250 -1400 100 L 50 50 1 1 B 106 | X GPIO27_ADC1 39 1250 -1500 100 L 50 50 1 1 B 107 | X GPIO2 4 1250 1100 100 L 50 50 1 1 B 108 | X GPIO28_ADC2 40 1250 -1600 100 L 50 50 1 1 B 109 | X GPIO29_ADC3 41 1250 -1700 100 L 50 50 1 1 B 110 | X IOVDD 42 -50 2000 100 D 50 50 1 1 W 111 | X ADC_AVDD 43 650 2000 100 D 50 50 1 1 W 112 | X VREG_IN 44 -350 2000 100 D 50 50 1 1 W 113 | X VREG_VOUT 45 -500 2000 100 D 50 50 1 1 w 114 | X USB_DM 46 1250 1600 100 L 50 50 1 1 B 115 | X USB_DP 47 1250 1700 100 L 50 50 1 1 B 116 | X USB_VDD 48 500 2000 100 D 50 50 1 1 W 117 | X IOVDD 49 -150 2000 100 D 50 50 1 1 W 118 | X GPIO3 5 1250 1000 100 L 50 50 1 1 B 119 | X DVDD 50 -800 2000 100 D 50 50 1 1 W 120 | X QSPI_SD3 51 -1250 800 100 R 50 50 1 1 B 121 | X QSPI_SCLK 52 -1250 650 100 R 50 50 1 1 O 122 | X QSPI_SD0 53 -1250 1100 100 R 50 50 1 1 B 123 | X QSPI_SD2 54 -1250 900 100 R 50 50 1 1 B 124 | X QSPI_SD1 55 -1250 1000 100 R 50 50 1 1 B 125 | X QSPI_SS 56 -1250 1250 100 R 50 50 1 1 B 126 | X GND 57 0 -2000 100 U 50 50 1 1 W 127 | X GPIO4 6 1250 900 100 L 50 50 1 1 B 128 | X GPIO5 7 1250 800 100 L 50 50 1 1 B 129 | X GPIO6 8 1250 700 100 L 50 50 1 1 B 130 | X GPIO7 9 1250 600 100 L 50 50 1 1 B 131 | ENDDRAW 132 | ENDDEF 133 | # 134 | #End Library 135 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/SOT-23-FAT.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "SOT-23-FAT" 2 | (version 20241229) 3 | (generator "pcbnew") 4 | (generator_version "9.0") 5 | (layer "F.Cu") 6 | (descr "SOT, 3 Pin (JEDEC MO-178 inferred 3-pin variant https://www.jedec.org/document_search?search_api_views_fulltext=MO-178), generated with kicad-footprint-generator ipc_gullwing_generator.py") 7 | (tags "SOT TO_SOT_SMD") 8 | (property "Reference" "REF**" 9 | (at 0 -2.4 0) 10 | (layer "F.SilkS") 11 | (uuid "ff90ae6b-1c61-49c1-9425-98b2bb5fdd47") 12 | (effects 13 | (font 14 | (size 1 1) 15 | (thickness 0.15) 16 | ) 17 | ) 18 | ) 19 | (property "Value" "SOT-23-FAT" 20 | (at 0 2.4 0) 21 | (layer "F.Fab") 22 | (uuid "1f80dc2c-2b28-453d-8b3b-7a0d32b5059e") 23 | (effects 24 | (font 25 | (size 1 1) 26 | (thickness 0.15) 27 | ) 28 | ) 29 | ) 30 | (property "Datasheet" "" 31 | (at 0 0 0) 32 | (layer "F.Fab") 33 | (hide yes) 34 | (uuid "29cbd8a2-f299-4b71-860d-f6914de358cb") 35 | (effects 36 | (font 37 | (size 1.27 1.27) 38 | (thickness 0.15) 39 | ) 40 | ) 41 | ) 42 | (property "Description" "" 43 | (at 0 0 0) 44 | (layer "F.Fab") 45 | (hide yes) 46 | (uuid "7161ab06-e7af-424c-a629-08af4598dc87") 47 | (effects 48 | (font 49 | (size 1.27 1.27) 50 | (thickness 0.15) 51 | ) 52 | ) 53 | ) 54 | (attr smd) 55 | (fp_line 56 | (start 0 -1.56) 57 | (end -0.8 -1.56) 58 | (stroke 59 | (width 0.12) 60 | (type solid) 61 | ) 62 | (layer "F.SilkS") 63 | (uuid "546084cf-720d-4dcb-a924-c169c32495f6") 64 | ) 65 | (fp_line 66 | (start 0 -1.56) 67 | (end 0.8 -1.56) 68 | (stroke 69 | (width 0.12) 70 | (type solid) 71 | ) 72 | (layer "F.SilkS") 73 | (uuid "2e31eed2-f64c-441e-ac2e-a0d2f4560216") 74 | ) 75 | (fp_line 76 | (start 0 1.56) 77 | (end -0.8 1.56) 78 | (stroke 79 | (width 0.12) 80 | (type solid) 81 | ) 82 | (layer "F.SilkS") 83 | (uuid "59017e63-0a3f-4718-8835-b73370899ca1") 84 | ) 85 | (fp_line 86 | (start 0 1.56) 87 | (end 0.8 1.56) 88 | (stroke 89 | (width 0.12) 90 | (type solid) 91 | ) 92 | (layer "F.SilkS") 93 | (uuid "cc0ebaac-ca23-4d73-9473-bbfbc2215e4e") 94 | ) 95 | (fp_poly 96 | (pts 97 | (xy -1.3 -1.51) (xy -1.54 -1.84) (xy -1.06 -1.84) (xy -1.3 -1.51) 98 | ) 99 | (stroke 100 | (width 0.12) 101 | (type solid) 102 | ) 103 | (fill yes) 104 | (layer "F.SilkS") 105 | (uuid "b9fd89c5-2a3c-4214-b05c-cb7c3153f499") 106 | ) 107 | (fp_line 108 | (start -2.05 -1.7) 109 | (end -2.05 1.7) 110 | (stroke 111 | (width 0.05) 112 | (type solid) 113 | ) 114 | (layer "F.CrtYd") 115 | (uuid "fcbc4afa-8a37-4224-a21f-0efe4b281fcd") 116 | ) 117 | (fp_line 118 | (start -2.05 1.7) 119 | (end 2.05 1.7) 120 | (stroke 121 | (width 0.05) 122 | (type solid) 123 | ) 124 | (layer "F.CrtYd") 125 | (uuid "0a7a7434-f612-4ad3-9421-efda88ed4b5c") 126 | ) 127 | (fp_line 128 | (start 2.05 -1.7) 129 | (end -2.05 -1.7) 130 | (stroke 131 | (width 0.05) 132 | (type solid) 133 | ) 134 | (layer "F.CrtYd") 135 | (uuid "9a65cf98-71e2-47ba-94bb-0780d96158ff") 136 | ) 137 | (fp_line 138 | (start 2.05 1.7) 139 | (end 2.05 -1.7) 140 | (stroke 141 | (width 0.05) 142 | (type solid) 143 | ) 144 | (layer "F.CrtYd") 145 | (uuid "8f868323-d5bc-4f5c-af67-ba14db3ad711") 146 | ) 147 | (fp_line 148 | (start -0.8 -1.05) 149 | (end -0.4 -1.45) 150 | (stroke 151 | (width 0.1) 152 | (type solid) 153 | ) 154 | (layer "F.Fab") 155 | (uuid "e251055c-3b4d-4d20-a147-6d2871049244") 156 | ) 157 | (fp_line 158 | (start -0.8 1.45) 159 | (end -0.8 -1.05) 160 | (stroke 161 | (width 0.1) 162 | (type solid) 163 | ) 164 | (layer "F.Fab") 165 | (uuid "ce0ae5c5-e36c-4730-9b6b-aeeab4bda31b") 166 | ) 167 | (fp_line 168 | (start -0.4 -1.45) 169 | (end 0.8 -1.45) 170 | (stroke 171 | (width 0.1) 172 | (type solid) 173 | ) 174 | (layer "F.Fab") 175 | (uuid "935dd4fe-04ea-4876-ad5b-ce93cc8d0b75") 176 | ) 177 | (fp_line 178 | (start 0.8 -1.45) 179 | (end 0.8 1.45) 180 | (stroke 181 | (width 0.1) 182 | (type solid) 183 | ) 184 | (layer "F.Fab") 185 | (uuid "f808971e-ab55-46f2-a810-7c7f14518fed") 186 | ) 187 | (fp_line 188 | (start 0.8 1.45) 189 | (end -0.8 1.45) 190 | (stroke 191 | (width 0.1) 192 | (type solid) 193 | ) 194 | (layer "F.Fab") 195 | (uuid "1dfd47b0-f932-46bd-a614-9c3b2c4b2245") 196 | ) 197 | (fp_text user "${REFERENCE}" 198 | (at 0 0 0) 199 | (layer "F.Fab") 200 | (uuid "f74eb0c4-d72f-470a-b0db-c7858a8f4b3e") 201 | (effects 202 | (font 203 | (size 0.4 0.4) 204 | (thickness 0.06) 205 | ) 206 | ) 207 | ) 208 | (pad "1" smd roundrect 209 | (at -1.1375 -0.95) 210 | (size 1.4 0.7) 211 | (layers "F.Cu" "F.Mask" "F.Paste") 212 | (roundrect_rratio 0.25) 213 | (uuid "8bb1cb62-9716-4947-8bad-efbcd8b03440") 214 | ) 215 | (pad "2" smd roundrect 216 | (at -1.1375 0.95) 217 | (size 1.4 0.7) 218 | (layers "F.Cu" "F.Mask" "F.Paste") 219 | (roundrect_rratio 0.25) 220 | (uuid "cb2ccd87-49c0-49ef-8c80-e1533d9be194") 221 | ) 222 | (pad "3" smd roundrect 223 | (at 1.1375 0) 224 | (size 1.4 0.7) 225 | (layers "F.Cu" "F.Mask" "F.Paste") 226 | (roundrect_rratio 0.25) 227 | (uuid "8601c522-93f8-47d9-89a2-6e4d768ceb6f") 228 | ) 229 | (embedded_fonts no) 230 | (model "${KICAD9_3DMODEL_DIR}/Package_TO_SOT_SMD.3dshapes/SOT-23-3.wrl" 231 | (offset 232 | (xyz 0 0 0) 233 | ) 234 | (scale 235 | (xyz 1 1 1) 236 | ) 237 | (rotate 238 | (xyz 0 0 0) 239 | ) 240 | ) 241 | ) 242 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/PJ393-8P.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "PJ393-8P" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 5BC12C3B) 4 | (descr "PJ31060-I 6pin SMD 3.5mm headphones jack (http://www.china-bsun.com/Product48/1577.html)") 5 | (tags "headphones jack plug stereo 3.5mm PJ31060-I PJ31060") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0 7.5) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp bd88c52f-3a09-4734-8761-25e8a1b64b5a) 10 | ) 11 | (fp_text value "PJ393-8P" (at 0 5.5) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 7d1fc7a9-d1b6-4704-9cf7-033a05c6380f) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0.25 0) (layer "F.Fab") 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 2e47c702-f659-4c80-9167-3b20e6579eee) 18 | ) 19 | (fp_line (start -3 -3.475) (end -3 -2.25) (layer "F.SilkS") (width 0.12) (tstamp 123d8879-168f-49ec-9cdc-84b1f1e66bfd)) 20 | (fp_line (start 2.5 -7.2) (end 3 -7.2) (layer "F.SilkS") (width 0.12) (tstamp 12b179ca-7622-4c5d-b8ad-468f0d83c8b3)) 21 | (fp_line (start -2.4 -7.4) (end 2.4 -7.4) (layer "F.SilkS") (width 0.3) (tstamp 145623d8-fc37-4cc1-b81c-48789583f8e7)) 22 | (fp_line (start -3 -0.475) (end -3 0.5) (layer "F.SilkS") (width 0.12) (tstamp 326db534-d0de-491a-8715-bce9f7a515ff)) 23 | (fp_line (start -3 -5.3) (end -3 -7.2) (layer "F.SilkS") (width 0.12) (tstamp 4d26ff26-6dca-4856-83d9-0ebd5eb09365)) 24 | (fp_line (start -3 4.525) (end -3 6.25) (layer "F.SilkS") (width 0.12) (tstamp 5add285f-cd68-49bf-94f1-5e06fd1d85a1)) 25 | (fp_line (start 3 2.525) (end 3 6.25) (layer "F.SilkS") (width 0.12) (tstamp 680312b1-9434-4759-bbac-d504f293fc62)) 26 | (fp_line (start 3 -2.475) (end 3 -1.5) (layer "F.SilkS") (width 0.12) (tstamp 7268a9b0-7098-4105-895b-a3f0188e2a89)) 27 | (fp_line (start 3 -4.975) (end 3 -4.25) (layer "F.SilkS") (width 0.12) (tstamp 745e8efb-0241-41a2-9795-84fa768015ad)) 28 | (fp_line (start 3 -7.2) (end 3 -6.75) (layer "F.SilkS") (width 0.12) (tstamp 96b1b72c-0fd4-46a1-843b-0b14c86d7beb)) 29 | (fp_line (start 3 0.275) (end 3 0.725) (layer "F.SilkS") (width 0.12) (tstamp a9cefcde-7232-4437-9506-8b012c0bdb81)) 30 | (fp_line (start -2.5 -7.2) (end -2.5 -7.4) (layer "F.SilkS") (width 0.12) (tstamp d745b59e-f4e9-405d-b7ff-cb430ec5c4b8)) 31 | (fp_line (start -3 -7.2) (end -2.5 -7.2) (layer "F.SilkS") (width 0.12) (tstamp ea113871-b0d7-47d2-8339-d7607f436e2b)) 32 | (fp_line (start 2.5 -7.4) (end 2.5 -7.2) (layer "F.SilkS") (width 0.12) (tstamp f6d5fbb9-af46-4ed5-83a4-47c7362dfee4)) 33 | (fp_line (start -3 2.275) (end -3 2.725) (layer "F.SilkS") (width 0.12) (tstamp fb31327e-66d4-4062-8341-8cf0461f3a0e)) 34 | (fp_line (start -3 6.25) (end 3 6.25) (layer "F.SilkS") (width 0.12) (tstamp fdf1830b-0418-4b64-8a66-62a647768c06)) 35 | (fp_line (start -5.5 -8.75) (end 5.5 -8.75) (layer "F.CrtYd") (width 0.05) (tstamp 13fe0240-6ec0-4b42-947b-9a3b3d822d53)) 36 | (fp_line (start 5.5 6.5) (end -5.5 6.5) (layer "F.CrtYd") (width 0.05) (tstamp 6d61435a-57fa-4bfe-9e76-1034c5b2938c)) 37 | (fp_line (start -5.5 -8.75) (end -5.5 6.5) (layer "F.CrtYd") (width 0.05) (tstamp 8f969b8a-c44c-44af-b4a0-799343c27793)) 38 | (fp_line (start 5.5 6.5) (end 5.5 -8.75) (layer "F.CrtYd") (width 0.05) (tstamp f84f4606-a739-4a74-825d-a74921836949)) 39 | (fp_line (start 2.5 -7.15) (end 3 -7.15) (layer "F.Fab") (width 0.1) (tstamp 0fada1d2-8e26-4db5-8c67-a6dd7951cec7)) 40 | (fp_line (start 3 6.2) (end -3 6.2) (layer "F.Fab") (width 0.1) (tstamp 151a812f-5706-4d23-8487-185c1329e238)) 41 | (fp_line (start -2.5 -7.15) (end -3 -7.15) (layer "F.Fab") (width 0.1) (tstamp 3465e3de-9373-467f-9e33-dce8d47e032f)) 42 | (fp_line (start 3 -7.15) (end 3 6.2) (layer "F.Fab") (width 0.1) (tstamp 7c2f0a5f-e09b-4e6b-b7f7-0693529adea3)) 43 | (fp_line (start 2.5 -8.5) (end -2.5 -8.5) (layer "F.Fab") (width 0.1) (tstamp 88ef9737-4c8b-4528-bf4d-e50e27e429e3)) 44 | (fp_line (start -2.5 -8.5) (end -2.5 -7.15) (layer "F.Fab") (width 0.1) (tstamp 8af89451-e578-48d8-a1c2-fb0e2cdadd04)) 45 | (fp_line (start -3 -7.15) (end -3 6.2) (layer "F.Fab") (width 0.1) (tstamp 8ffc6c7a-90cb-4f8d-a6cd-d3571e690290)) 46 | (fp_line (start 2.5 -7.15) (end 2.5 -8.5) (layer "F.Fab") (width 0.1) (tstamp a5d5e857-44b2-4ade-9c08-17849f7b65cc)) 47 | (pad "" np_thru_hole circle (at 0 2.9) (size 1.6 1.6) (drill 1.5) (layers *.Mask) (tstamp a27de3e8-44f9-47e1-8d2b-134d2f797d18)) 48 | (pad "" np_thru_hole circle (at 0 -4.9) (size 1.6 1.6) (drill 1.5) (layers *.Mask) (tstamp fb60c999-3b79-489e-a9a0-4874590c1523)) 49 | (pad "R1" smd rect (at -3.5 1.4) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 4371094a-19f6-4840-b98e-2f3e398b8534)) 50 | (pad "R1" smd rect (at 3.5 -0.6) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 67de27c1-936a-403a-945b-a21e0b907764)) 51 | (pad "R2" smd rect (at -3.5 -1.4) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 1dff14d4-2760-4bce-b600-a0cef8d8a4a2)) 52 | (pad "R2" smd rect (at 3.5 -3.4) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 31c424e9-f3a7-48aa-ace9-2beae806613d)) 53 | (pad "S" smd rect (at -3.5 -4.4) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 63d3985d-6409-419d-a9b7-689664a4c71a)) 54 | (pad "S" smd rect (at 3.5 -5.9) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp a8b0f727-7971-43bb-863b-4ee8ef2e917a)) 55 | (pad "T" smd rect (at -3.5 3.6) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp ea036ba0-3595-4492-80b5-811a7abfc433)) 56 | (pad "T" smd rect (at 3.5 1.6) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp f5c6c4fb-df5b-4d0a-95e5-40e605d7a55b)) 57 | (model "${KIPRJMOD}/3dmodels/User Library-pj-393-8.STEP" 58 | (offset (xyz 0 7.25 0)) 59 | (scale (xyz 1 1 1)) 60 | (rotate (xyz -90 0 -180)) 61 | ) 62 | ) 63 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/PJ393-8P.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "PJ393-8P" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 5BC12C3B) 4 | (descr "PJ31060-I 6pin SMD 3.5mm headphones jack (http://www.china-bsun.com/Product48/1577.html)") 5 | (tags "headphones jack plug stereo 3.5mm PJ31060-I PJ31060") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0 7.5) (layer "F.SilkS") 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp bd88c52f-3a09-4734-8761-25e8a1b64b5a) 10 | ) 11 | (fp_text value "PJ393-8P" (at 0 5.5) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 7d1fc7a9-d1b6-4704-9cf7-033a05c6380f) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0.25 0) (layer "F.Fab") 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp 2e47c702-f659-4c80-9167-3b20e6579eee) 18 | ) 19 | (fp_line (start -3 -3.475) (end -3 -2.25) (layer "F.SilkS") (width 0.12) (tstamp 123d8879-168f-49ec-9cdc-84b1f1e66bfd)) 20 | (fp_line (start 2.5 -7.2) (end 3 -7.2) (layer "F.SilkS") (width 0.12) (tstamp 12b179ca-7622-4c5d-b8ad-468f0d83c8b3)) 21 | (fp_line (start -2.4 -7.4) (end 2.4 -7.4) (layer "F.SilkS") (width 0.3) (tstamp 145623d8-fc37-4cc1-b81c-48789583f8e7)) 22 | (fp_line (start -3 -0.475) (end -3 0.5) (layer "F.SilkS") (width 0.12) (tstamp 326db534-d0de-491a-8715-bce9f7a515ff)) 23 | (fp_line (start -3 -5.3) (end -3 -7.2) (layer "F.SilkS") (width 0.12) (tstamp 4d26ff26-6dca-4856-83d9-0ebd5eb09365)) 24 | (fp_line (start -3 4.525) (end -3 6.25) (layer "F.SilkS") (width 0.12) (tstamp 5add285f-cd68-49bf-94f1-5e06fd1d85a1)) 25 | (fp_line (start 3 2.525) (end 3 6.25) (layer "F.SilkS") (width 0.12) (tstamp 680312b1-9434-4759-bbac-d504f293fc62)) 26 | (fp_line (start 3 -2.475) (end 3 -1.5) (layer "F.SilkS") (width 0.12) (tstamp 7268a9b0-7098-4105-895b-a3f0188e2a89)) 27 | (fp_line (start 3 -4.975) (end 3 -4.25) (layer "F.SilkS") (width 0.12) (tstamp 745e8efb-0241-41a2-9795-84fa768015ad)) 28 | (fp_line (start 3 -7.2) (end 3 -6.75) (layer "F.SilkS") (width 0.12) (tstamp 96b1b72c-0fd4-46a1-843b-0b14c86d7beb)) 29 | (fp_line (start 3 0.275) (end 3 0.725) (layer "F.SilkS") (width 0.12) (tstamp a9cefcde-7232-4437-9506-8b012c0bdb81)) 30 | (fp_line (start -2.5 -7.2) (end -2.5 -7.4) (layer "F.SilkS") (width 0.12) (tstamp d745b59e-f4e9-405d-b7ff-cb430ec5c4b8)) 31 | (fp_line (start -3 -7.2) (end -2.5 -7.2) (layer "F.SilkS") (width 0.12) (tstamp ea113871-b0d7-47d2-8339-d7607f436e2b)) 32 | (fp_line (start 2.5 -7.4) (end 2.5 -7.2) (layer "F.SilkS") (width 0.12) (tstamp f6d5fbb9-af46-4ed5-83a4-47c7362dfee4)) 33 | (fp_line (start -3 2.275) (end -3 2.725) (layer "F.SilkS") (width 0.12) (tstamp fb31327e-66d4-4062-8341-8cf0461f3a0e)) 34 | (fp_line (start -3 6.25) (end 3 6.25) (layer "F.SilkS") (width 0.12) (tstamp fdf1830b-0418-4b64-8a66-62a647768c06)) 35 | (fp_line (start -5.5 -8.75) (end 5.5 -8.75) (layer "F.CrtYd") (width 0.05) (tstamp 13fe0240-6ec0-4b42-947b-9a3b3d822d53)) 36 | (fp_line (start 5.5 6.5) (end -5.5 6.5) (layer "F.CrtYd") (width 0.05) (tstamp 6d61435a-57fa-4bfe-9e76-1034c5b2938c)) 37 | (fp_line (start -5.5 -8.75) (end -5.5 6.5) (layer "F.CrtYd") (width 0.05) (tstamp 8f969b8a-c44c-44af-b4a0-799343c27793)) 38 | (fp_line (start 5.5 6.5) (end 5.5 -8.75) (layer "F.CrtYd") (width 0.05) (tstamp f84f4606-a739-4a74-825d-a74921836949)) 39 | (fp_line (start 2.5 -7.15) (end 3 -7.15) (layer "F.Fab") (width 0.1) (tstamp 0fada1d2-8e26-4db5-8c67-a6dd7951cec7)) 40 | (fp_line (start 3 6.2) (end -3 6.2) (layer "F.Fab") (width 0.1) (tstamp 151a812f-5706-4d23-8487-185c1329e238)) 41 | (fp_line (start -2.5 -7.15) (end -3 -7.15) (layer "F.Fab") (width 0.1) (tstamp 3465e3de-9373-467f-9e33-dce8d47e032f)) 42 | (fp_line (start 3 -7.15) (end 3 6.2) (layer "F.Fab") (width 0.1) (tstamp 7c2f0a5f-e09b-4e6b-b7f7-0693529adea3)) 43 | (fp_line (start 2.5 -8.5) (end -2.5 -8.5) (layer "F.Fab") (width 0.1) (tstamp 88ef9737-4c8b-4528-bf4d-e50e27e429e3)) 44 | (fp_line (start -2.5 -8.5) (end -2.5 -7.15) (layer "F.Fab") (width 0.1) (tstamp 8af89451-e578-48d8-a1c2-fb0e2cdadd04)) 45 | (fp_line (start -3 -7.15) (end -3 6.2) (layer "F.Fab") (width 0.1) (tstamp 8ffc6c7a-90cb-4f8d-a6cd-d3571e690290)) 46 | (fp_line (start 2.5 -7.15) (end 2.5 -8.5) (layer "F.Fab") (width 0.1) (tstamp a5d5e857-44b2-4ade-9c08-17849f7b65cc)) 47 | (pad "" np_thru_hole circle (at 0 2.9) (size 1.6 1.6) (drill 1.5) (layers *.Mask) (tstamp a27de3e8-44f9-47e1-8d2b-134d2f797d18)) 48 | (pad "" np_thru_hole circle (at 0 -4.9) (size 1.6 1.6) (drill 1.5) (layers *.Mask) (tstamp fb60c999-3b79-489e-a9a0-4874590c1523)) 49 | (pad "R1" smd rect (at -3.5 1.4) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 4371094a-19f6-4840-b98e-2f3e398b8534)) 50 | (pad "R1" smd rect (at 3.5 -0.6) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 67de27c1-936a-403a-945b-a21e0b907764)) 51 | (pad "R2" smd rect (at -3.5 -1.4) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 1dff14d4-2760-4bce-b600-a0cef8d8a4a2)) 52 | (pad "R2" smd rect (at 3.5 -3.4) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 31c424e9-f3a7-48aa-ace9-2beae806613d)) 53 | (pad "S" smd rect (at -3.5 -4.4) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 63d3985d-6409-419d-a9b7-689664a4c71a)) 54 | (pad "S" smd rect (at 3.5 -5.9) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp a8b0f727-7971-43bb-863b-4ee8ef2e917a)) 55 | (pad "T" smd rect (at -3.5 3.6) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp ea036ba0-3595-4492-80b5-811a7abfc433)) 56 | (pad "T" smd rect (at 3.5 1.6) (size 3.4 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp f5c6c4fb-df5b-4d0a-95e5-40e605d7a55b)) 57 | (model "${KIPRJMOD}/3dmodels/User Library-pj-393-8.STEP" 58 | (offset (xyz 0 7.25 0)) 59 | (scale (xyz 1 1 1)) 60 | (rotate (xyz -90 0 -180)) 61 | ) 62 | ) 63 | -------------------------------------------------------------------------------- /PCB/pico/diva_main.pretty/SW_Kailh_Choc_V1V2_1.00u_LED.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "SW_Kailh_Choc_V1V2_1.00u_LED" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (descr "Kailh Choc keyswitch CPG1350 V1 CPG1353 V2 with 1.00u keycap") 4 | (tags "Kailh Choc Keyswitch Switch CPG1350 V1 CPG1353 V2 Cutout 1.00u") 5 | (attr through_hole) 6 | (fp_text reference "REF**" (at 0 -9) (layer "F.SilkS") 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp 92a7ae76-c87f-4272-be9c-63dab847815c) 9 | ) 10 | (fp_text value "SW_Kailh_Choc_V1V2_1.00u_LED" (at 0 9) (layer "F.Fab") hide 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp c63c758d-3caa-498a-826f-f3350c748db3) 13 | ) 14 | (fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab") 15 | (effects (font (size 1 1) (thickness 0.15))) 16 | (tstamp 28dcc41d-78b9-4d52-9197-93785d4e789d) 17 | ) 18 | (fp_line (start -7.6 -7.6) (end -7.6 7.6) 19 | (stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 88caeeb5-30c6-4e2c-a701-550a6542bc94)) 20 | (fp_line (start -7.6 7.6) (end 7.6 7.6) 21 | (stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 7cc382ca-5953-4000-a3de-86c9f66c6b07)) 22 | (fp_line (start 7.6 -7.6) (end -7.6 -7.6) 23 | (stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 71fb836e-a245-4765-83b9-698e5beb23e0)) 24 | (fp_line (start 7.6 7.6) (end 7.6 -7.6) 25 | (stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp de73cee2-f513-4d21-a50d-04646eaf1166)) 26 | (fp_line (start -9 -8.5) (end -9 8.5) 27 | (stroke (width 0.1) (type solid)) (layer "Dwgs.User") (tstamp 1e6f237f-a75d-4129-a2ae-6152b3b30e37)) 28 | (fp_line (start -9 8.5) (end 9 8.5) 29 | (stroke (width 0.1) (type solid)) (layer "Dwgs.User") (tstamp b5be7036-d49a-4591-bc86-ea18fc250753)) 30 | (fp_line (start 9 -8.5) (end -9 -8.5) 31 | (stroke (width 0.1) (type solid)) (layer "Dwgs.User") (tstamp 6ee91bea-ed5e-4543-bd3a-e1583b15d137)) 32 | (fp_line (start 9 8.5) (end 9 -8.5) 33 | (stroke (width 0.1) (type solid)) (layer "Dwgs.User") (tstamp f7b53b52-69a2-409d-8eda-f933696c7366)) 34 | (fp_line (start -7.25 -7.25) (end -7.25 7.25) 35 | (stroke (width 0.1) (type solid)) (layer "Eco1.User") (tstamp 0face070-a881-4a67-91e5-1dbb306c1d54)) 36 | (fp_line (start -7.25 7.25) (end 7.25 7.25) 37 | (stroke (width 0.1) (type solid)) (layer "Eco1.User") (tstamp f6b5caee-d5e1-4ee7-80d2-14db90b6c28d)) 38 | (fp_line (start 7.25 -7.25) (end -7.25 -7.25) 39 | (stroke (width 0.1) (type solid)) (layer "Eco1.User") (tstamp 8b9c96c7-d567-4615-80f0-f1778b33e857)) 40 | (fp_line (start 7.25 7.25) (end 7.25 -7.25) 41 | (stroke (width 0.1) (type solid)) (layer "Eco1.User") (tstamp 649c4422-2d51-4a6e-b8c7-2d1a07f67b0c)) 42 | (fp_line (start -7.75 -7.75) (end -7.75 7.75) 43 | (stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 8cdc044c-2f9c-4eea-afab-5968ca11afbf)) 44 | (fp_line (start -7.75 7.75) (end 7.75 7.75) 45 | (stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 11013975-10cd-4555-894d-084e0b20ca0a)) 46 | (fp_line (start 7.75 -7.75) (end -7.75 -7.75) 47 | (stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 6a72187e-914f-41fb-96e8-f5ff3fe493dc)) 48 | (fp_line (start 7.75 7.75) (end 7.75 -7.75) 49 | (stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 9d984fa8-a537-45a1-89a8-824f656de669)) 50 | (fp_line (start -7.5 -7.5) (end -7.5 7.5) 51 | (stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 19f3f472-5ed6-4fea-976c-c5c1f9c3206f)) 52 | (fp_line (start -7.5 7.5) (end 7.5 7.5) 53 | (stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 93107288-4cae-4ac2-9c86-1667789154a8)) 54 | (fp_line (start 7.5 -7.5) (end -7.5 -7.5) 55 | (stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp c82933bf-f510-4ee9-b659-b58735ec75a7)) 56 | (fp_line (start 7.5 7.5) (end 7.5 -7.5) 57 | (stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 81895847-5421-4b13-9a5b-47c579fd0f85)) 58 | (fp_rect (start -1.75 3.3) (end 1.75 6.1) 59 | (stroke (width 0.1) (type solid)) (fill none) (layer "F.Fab") (tstamp 941adf22-cad0-4694-b73c-db90e38b5cf0)) 60 | (fp_circle (center 0 4.7) (end 1 4.7) 61 | (stroke (width 0.1) (type solid)) (fill none) (layer "F.Fab") (tstamp 5b98ed20-0b43-4bc8-8c91-e14ac96fdd87)) 62 | (pad "" np_thru_hole circle (at -5.5 0) (size 1.9 1.9) (drill 1.9) (layers "*.Cu" "*.Mask") (tstamp e81d0b39-047e-4efe-a94a-aaf1d0572390)) 63 | (pad "" thru_hole circle (at -5 5.15) (size 2.2 2.2) (drill 1.2) (layers "*.Cu" "B.Mask") (tstamp 71944c36-73ae-4990-9fca-8213fb6a2021)) 64 | (pad "" smd circle (at 0 -5.9) (size 1.25 1.25) (layers "F.Mask") (tstamp 177bbf04-19d7-4b24-a0a5-a0e4af5ee484)) 65 | (pad "" np_thru_hole circle (at 0 0) (size 5.05 5.05) (drill 5.05) (layers "*.Cu" "*.Mask") (tstamp a281905b-5f88-47d3-9191-fc55525bb180)) 66 | (pad "" smd circle (at 5 -3.8) (size 1.25 1.25) (layers "F.Mask") (tstamp e3da1dd9-b4b0-462e-af23-f5f5a298356e)) 67 | (pad "" np_thru_hole circle (at 5.5 0) (size 1.9 1.9) (drill 1.9) (layers "*.Cu" "*.Mask") (tstamp 71652df6-e20a-4d31-8b27-1f1e55486e6b)) 68 | (pad "1" thru_hole circle (at 0 -5.9) (size 2.2 2.2) (drill 1.2) (layers "*.Cu" "B.Mask") (tstamp 7e01a6c9-9dd0-47b4-9705-ecd823946434)) 69 | (pad "2" thru_hole circle (at 5 -3.8) (size 2.2 2.2) (drill 1.2) (layers "*.Cu" "B.Mask") (tstamp adefe771-6f66-4ecb-9e04-c354bf639d65)) 70 | (model "${KIPRJMOD}/3dmodels/SW_Kailh_Choc_V1.wrl" 71 | (offset (xyz 0 0 0)) 72 | (scale (xyz 1 1 1)) 73 | (rotate (xyz 0 0 0)) 74 | ) 75 | (model "${KIPRJMOD}/3dmodels/Kailh LP Choc PC Keycap.step" hide 76 | (offset (xyz 0 0 1.5)) 77 | (scale (xyz 1 1 1)) 78 | (rotate (xyz 0 0 0)) 79 | ) 80 | (model "${KIPRJMOD}/3dmodels/iidx_keycap_teeny.wrl" hide 81 | (offset (xyz 0 0 2)) 82 | (scale (xyz 0.36 0.4 0.4)) 83 | (rotate (xyz 0 0 90)) 84 | ) 85 | ) 86 | -------------------------------------------------------------------------------- /PCB/plus/diva_plus.pretty/SW_Kailh_Choc_V1V2_1.00u_LED.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "SW_Kailh_Choc_V1V2_1.00u_LED" (version 20221018) (generator pcbnew) 2 | (layer "F.Cu") 3 | (descr "Kailh Choc keyswitch CPG1350 V1 CPG1353 V2 with 1.00u keycap") 4 | (tags "Kailh Choc Keyswitch Switch CPG1350 V1 CPG1353 V2 Cutout 1.00u") 5 | (attr through_hole) 6 | (fp_text reference "REF**" (at 0 -9) (layer "F.SilkS") 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp 92a7ae76-c87f-4272-be9c-63dab847815c) 9 | ) 10 | (fp_text value "SW_Kailh_Choc_V1V2_1.00u_LED" (at 0 9) (layer "F.Fab") hide 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp c63c758d-3caa-498a-826f-f3350c748db3) 13 | ) 14 | (fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab") 15 | (effects (font (size 1 1) (thickness 0.15))) 16 | (tstamp 28dcc41d-78b9-4d52-9197-93785d4e789d) 17 | ) 18 | (fp_line (start -7.6 -7.6) (end -7.6 7.6) 19 | (stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 88caeeb5-30c6-4e2c-a701-550a6542bc94)) 20 | (fp_line (start -7.6 7.6) (end 7.6 7.6) 21 | (stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 7cc382ca-5953-4000-a3de-86c9f66c6b07)) 22 | (fp_line (start 7.6 -7.6) (end -7.6 -7.6) 23 | (stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 71fb836e-a245-4765-83b9-698e5beb23e0)) 24 | (fp_line (start 7.6 7.6) (end 7.6 -7.6) 25 | (stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp de73cee2-f513-4d21-a50d-04646eaf1166)) 26 | (fp_line (start -9 -8.5) (end -9 8.5) 27 | (stroke (width 0.1) (type solid)) (layer "Dwgs.User") (tstamp 1e6f237f-a75d-4129-a2ae-6152b3b30e37)) 28 | (fp_line (start -9 8.5) (end 9 8.5) 29 | (stroke (width 0.1) (type solid)) (layer "Dwgs.User") (tstamp b5be7036-d49a-4591-bc86-ea18fc250753)) 30 | (fp_line (start 9 -8.5) (end -9 -8.5) 31 | (stroke (width 0.1) (type solid)) (layer "Dwgs.User") (tstamp 6ee91bea-ed5e-4543-bd3a-e1583b15d137)) 32 | (fp_line (start 9 8.5) (end 9 -8.5) 33 | (stroke (width 0.1) (type solid)) (layer "Dwgs.User") (tstamp f7b53b52-69a2-409d-8eda-f933696c7366)) 34 | (fp_line (start -7.25 -7.25) (end -7.25 7.25) 35 | (stroke (width 0.1) (type solid)) (layer "Eco1.User") (tstamp 0face070-a881-4a67-91e5-1dbb306c1d54)) 36 | (fp_line (start -7.25 7.25) (end 7.25 7.25) 37 | (stroke (width 0.1) (type solid)) (layer "Eco1.User") (tstamp f6b5caee-d5e1-4ee7-80d2-14db90b6c28d)) 38 | (fp_line (start 7.25 -7.25) (end -7.25 -7.25) 39 | (stroke (width 0.1) (type solid)) (layer "Eco1.User") (tstamp 8b9c96c7-d567-4615-80f0-f1778b33e857)) 40 | (fp_line (start 7.25 7.25) (end 7.25 -7.25) 41 | (stroke (width 0.1) (type solid)) (layer "Eco1.User") (tstamp 649c4422-2d51-4a6e-b8c7-2d1a07f67b0c)) 42 | (fp_line (start -7.75 -7.75) (end -7.75 7.75) 43 | (stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 8cdc044c-2f9c-4eea-afab-5968ca11afbf)) 44 | (fp_line (start -7.75 7.75) (end 7.75 7.75) 45 | (stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 11013975-10cd-4555-894d-084e0b20ca0a)) 46 | (fp_line (start 7.75 -7.75) (end -7.75 -7.75) 47 | (stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 6a72187e-914f-41fb-96e8-f5ff3fe493dc)) 48 | (fp_line (start 7.75 7.75) (end 7.75 -7.75) 49 | (stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 9d984fa8-a537-45a1-89a8-824f656de669)) 50 | (fp_line (start -7.5 -7.5) (end -7.5 7.5) 51 | (stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 19f3f472-5ed6-4fea-976c-c5c1f9c3206f)) 52 | (fp_line (start -7.5 7.5) (end 7.5 7.5) 53 | (stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 93107288-4cae-4ac2-9c86-1667789154a8)) 54 | (fp_line (start 7.5 -7.5) (end -7.5 -7.5) 55 | (stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp c82933bf-f510-4ee9-b659-b58735ec75a7)) 56 | (fp_line (start 7.5 7.5) (end 7.5 -7.5) 57 | (stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 81895847-5421-4b13-9a5b-47c579fd0f85)) 58 | (fp_rect (start -1.75 3.3) (end 1.75 6.1) 59 | (stroke (width 0.1) (type solid)) (fill none) (layer "F.Fab") (tstamp 941adf22-cad0-4694-b73c-db90e38b5cf0)) 60 | (fp_circle (center 0 4.7) (end 1 4.7) 61 | (stroke (width 0.1) (type solid)) (fill none) (layer "F.Fab") (tstamp 5b98ed20-0b43-4bc8-8c91-e14ac96fdd87)) 62 | (pad "" np_thru_hole circle (at -5.5 0) (size 1.9 1.9) (drill 1.9) (layers "*.Cu" "*.Mask") (tstamp e81d0b39-047e-4efe-a94a-aaf1d0572390)) 63 | (pad "" thru_hole circle (at -5 5.15) (size 2.2 2.2) (drill 1.2) (layers "*.Cu" "B.Mask") (tstamp 71944c36-73ae-4990-9fca-8213fb6a2021)) 64 | (pad "" smd circle (at 0 -5.9) (size 1.25 1.25) (layers "F.Mask") (tstamp 177bbf04-19d7-4b24-a0a5-a0e4af5ee484)) 65 | (pad "" np_thru_hole circle (at 0 0) (size 5.05 5.05) (drill 5.05) (layers "*.Cu" "*.Mask") (tstamp a281905b-5f88-47d3-9191-fc55525bb180)) 66 | (pad "" smd circle (at 5 -3.8) (size 1.25 1.25) (layers "F.Mask") (tstamp e3da1dd9-b4b0-462e-af23-f5f5a298356e)) 67 | (pad "" np_thru_hole circle (at 5.5 0) (size 1.9 1.9) (drill 1.9) (layers "*.Cu" "*.Mask") (tstamp 71652df6-e20a-4d31-8b27-1f1e55486e6b)) 68 | (pad "1" thru_hole circle (at 0 -5.9) (size 2.2 2.2) (drill 1.2) (layers "*.Cu" "B.Mask") (tstamp 7e01a6c9-9dd0-47b4-9705-ecd823946434)) 69 | (pad "2" thru_hole circle (at 5 -3.8) (size 2.2 2.2) (drill 1.2) (layers "*.Cu" "B.Mask") (tstamp adefe771-6f66-4ecb-9e04-c354bf639d65)) 70 | (model "${KIPRJMOD}/3dmodels/SW_Kailh_Choc_V1.wrl" 71 | (offset (xyz 0 0 0)) 72 | (scale (xyz 1 1 1)) 73 | (rotate (xyz 0 0 0)) 74 | ) 75 | (model "${KIPRJMOD}/3dmodels/Kailh LP Choc PC Keycap.step" hide 76 | (offset (xyz 0 0 1.5)) 77 | (scale (xyz 1 1 1)) 78 | (rotate (xyz 0 0 0)) 79 | ) 80 | (model "${KIPRJMOD}/3dmodels/iidx_keycap_teeny.wrl" hide 81 | (offset (xyz 0 0 2)) 82 | (scale (xyz 0.36 0.4 0.4)) 83 | (rotate (xyz 0 0 90)) 84 | ) 85 | ) 86 | -------------------------------------------------------------------------------- /firmware/src/cli.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "pico/stdio.h" 8 | #include "pico/stdlib.h" 9 | #include "pico/bootrom.h" 10 | #include "cli.h" 11 | #include "save.h" 12 | 13 | #define MAX_COMMANDS 32 14 | #define MAX_PARAMETERS 10 15 | #define MAX_PARAMETER_LENGTH 20 16 | 17 | const char *cli_prompt = "cli>"; 18 | const char *cli_logo = "CLI"; 19 | 20 | static const char *commands[MAX_COMMANDS]; 21 | static const char *helps[MAX_COMMANDS]; 22 | static cmd_handler_t handlers[MAX_COMMANDS]; 23 | static int max_cmd_len = 0; 24 | 25 | static int num_commands = 0; 26 | 27 | void cli_register(const char *cmd, cmd_handler_t handler, const char *help) 28 | { 29 | if (num_commands < MAX_COMMANDS) { 30 | commands[num_commands] = cmd; 31 | handlers[num_commands] = handler; 32 | helps[num_commands] = help; 33 | num_commands++; 34 | if (strlen(cmd) > max_cmd_len) { 35 | max_cmd_len = strlen(cmd); 36 | } 37 | } 38 | } 39 | 40 | // return -1 if not matched, return -2 if ambiguous 41 | int cli_match_prefix(const char *str[], int num, const char *prefix) 42 | { 43 | int match = -1; 44 | bool found = false; 45 | 46 | for (int i = 0; (i < num) && str[i]; i++) { 47 | if (strncasecmp(str[i], prefix, strlen(prefix)) == 0) { 48 | if (found) { 49 | return -2; 50 | } 51 | found = true; 52 | match = i; 53 | } 54 | } 55 | 56 | return match; 57 | } 58 | 59 | const char *built_time = __DATE__ " " __TIME__; 60 | static void handle_help(int argc, char *argv[]) 61 | { 62 | printf("%s", cli_logo); 63 | printf("\tSN: %016llx\n", board_id_64()); 64 | printf("\tBuilt: %s\n\n", built_time); 65 | printf("Available commands:\n"); 66 | for (int i = 0; i < num_commands; i++) { 67 | printf("%*s: %s\n", max_cmd_len + 2, commands[i], helps[i]); 68 | } 69 | } 70 | 71 | static int fps[2]; 72 | void cli_fps_count(int core) 73 | { 74 | static uint32_t last[2] = {0}; 75 | static int counter[2] = {0}; 76 | 77 | counter[core]++; 78 | 79 | uint32_t now = time_us_32(); 80 | if (now - last[core] < 1000000) { 81 | return; 82 | } 83 | last[core] = now; 84 | fps[core] = counter[core]; 85 | counter[core] = 0; 86 | } 87 | 88 | static void handle_fps(int argc, char *argv[]) 89 | { 90 | printf("FPS: core 0: %d, core 1: %d\n", fps[0], fps[1]); 91 | } 92 | 93 | static void handle_update(int argc, char *argv[]) 94 | { 95 | printf("Boot into update mode.\n"); 96 | fflush(stdout); 97 | sleep_ms(100); 98 | reset_usb_boot(0, 2); 99 | } 100 | int cli_extract_non_neg_int(const char *param, int len) 101 | { 102 | if (len == 0) { 103 | len = strlen(param); 104 | } 105 | int result = 0; 106 | for (int i = 0; i < len; i++) { 107 | if (!isdigit((uint8_t)param[i])) { 108 | return -1; 109 | } 110 | result = result * 10 + param[i] - '0'; 111 | } 112 | return result; 113 | } 114 | 115 | static char cmd_buf[256]; 116 | static int cmd_len = 0; 117 | 118 | static void process_cmd() 119 | { 120 | char *argv[MAX_PARAMETERS]; 121 | int argc; 122 | 123 | char *cmd = strtok(cmd_buf, " \n"); 124 | 125 | if (strlen(cmd) == 0) { 126 | return; 127 | } 128 | 129 | argc = 0; 130 | while ((argc < MAX_PARAMETERS) && 131 | (argv[argc] = strtok(NULL, " ,\n")) != NULL) { 132 | argc++; 133 | } 134 | 135 | int match = cli_match_prefix(commands, num_commands, cmd); 136 | if (match == -2) { 137 | printf("Ambiguous command.\n"); 138 | return; 139 | } else if (match == -1) { 140 | printf("Unknown command.\n"); 141 | handle_help(0, NULL); 142 | return; 143 | } 144 | 145 | handlers[match](argc, argv); 146 | } 147 | 148 | void cli_run() 149 | { 150 | static bool was_connected = false; 151 | static uint64_t connect_time = 0; 152 | static bool welcomed = false; 153 | bool connected = stdio_usb_connected(); 154 | bool just_connected = connected && !was_connected; 155 | was_connected = connected; 156 | if (!connected) { 157 | return; 158 | } 159 | if (just_connected) { 160 | connect_time = time_us_64(); 161 | welcomed = false; 162 | return; 163 | } 164 | if (!welcomed && (time_us_64() - connect_time > 200000)) { 165 | welcomed = true; 166 | cmd_len = 0; 167 | handle_help(0, NULL); 168 | printf("\n%s", cli_prompt); 169 | } 170 | int c = getchar_timeout_us(0); 171 | if (c < 0) { 172 | return; 173 | } 174 | 175 | if (c == '\b' || c == 127) { // both backspace and delete 176 | if (cmd_len > 0) { 177 | cmd_len--; 178 | printf("\b \b"); 179 | } 180 | return; 181 | } 182 | 183 | if ((c != '\n') && (c != '\r')) { 184 | 185 | if (cmd_len < sizeof(cmd_buf) - 2) { 186 | cmd_buf[cmd_len] = c; 187 | printf("%c", c); 188 | cmd_len++; 189 | } 190 | return; 191 | } 192 | 193 | cmd_buf[cmd_len] = '\0'; 194 | cmd_len = 0; 195 | 196 | printf("\n"); 197 | 198 | process_cmd(); 199 | 200 | printf(cli_prompt); 201 | } 202 | 203 | void cli_init(const char *prompt, const char *logo) 204 | { 205 | if (prompt) { 206 | cli_prompt = prompt; 207 | } 208 | if (logo) { 209 | cli_logo = logo; 210 | } 211 | 212 | cli_register("?", handle_help, "Display this help message."); 213 | cli_register("fps", handle_fps, "Display FPS."); 214 | cli_register("update", handle_update, "Update firmware."); 215 | } 216 | -------------------------------------------------------------------------------- /firmware/src/rgb.c: -------------------------------------------------------------------------------- 1 | /* 2 | * RGB LED (WS2812) Strip control 3 | * WHowe 4 | * 5 | */ 6 | 7 | #include "rgb.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "bsp/board.h" 15 | #include "hardware/pio.h" 16 | #include "hardware/timer.h" 17 | 18 | #include "ws2812.pio.h" 19 | 20 | #include "board_defs.h" 21 | #include "config.h" 22 | 23 | #define HID_LIGHT_TIMEOUT_MS 1000 24 | 25 | static uint32_t button_buf[5]; // 4 buttons + 1 start button 26 | static uint32_t slider_buf[32]; // 32 slider (max) 27 | 28 | static uint32_t hid_button_buf[5]; 29 | static uint32_t hid_slider_buf[32]; // 32 slider (always) 30 | static uint64_t hid_timeout = 0; 31 | 32 | static int8_t button_rgb_map[] = RGB_BUTTON_MAP; 33 | 34 | static bool half_mode = false; 35 | 36 | #define _MAP_LED(x) _MAKE_MAPPER(x) 37 | #define _MAKE_MAPPER(x) MAP_LED_##x 38 | #define MAP_LED_RGB { c1 = r; c2 = g; c3 = b; } 39 | #define MAP_LED_GRB { c1 = g; c2 = r; c3 = b; } 40 | 41 | #define REMAP_BUTTON_RGB _MAP_LED(BUTTON_RGB_ORDER) 42 | #define REMAP_TT_RGB _MAP_LED(TT_RGB_ORDER) 43 | 44 | static inline uint32_t _rgb32(uint32_t c1, uint32_t c2, uint32_t c3, bool gamma_fix) 45 | { 46 | if (gamma_fix) { 47 | c1 = ((c1 + 1) * (c1 + 1) - 1) >> 8; 48 | c2 = ((c2 + 1) * (c2 + 1) - 1) >> 8; 49 | c3 = ((c3 + 1) * (c3 + 1) - 1) >> 8; 50 | } 51 | 52 | return (c1 << 16) | (c2 << 8) | (c3 << 0); 53 | } 54 | 55 | uint32_t rgb32(uint32_t r, uint32_t g, uint32_t b, bool gamma_fix) 56 | { 57 | #if BUTTON_RGB_ORDER == GRB 58 | return _rgb32(g, r, b, gamma_fix); 59 | #else 60 | return _rgb32(r, g, b, gamma_fix); 61 | #endif 62 | } 63 | 64 | uint32_t rgb32_from_hsv(uint8_t h, uint8_t s, uint8_t v) 65 | { 66 | uint32_t region, remainder, p, q, t; 67 | 68 | if (s == 0) { 69 | return v << 16 | v << 8 | v; 70 | } 71 | 72 | region = h / 43; 73 | remainder = (h % 43) * 6; 74 | 75 | p = (v * (255 - s)) >> 8; 76 | q = (v * (255 - ((s * remainder) >> 8))) >> 8; 77 | t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; 78 | 79 | switch (region) { 80 | case 0: 81 | return v << 16 | t << 8 | p; 82 | case 1: 83 | return q << 16 | v << 8 | p; 84 | case 2: 85 | return p << 16 | v << 8 | t; 86 | case 3: 87 | return p << 16 | q << 8 | v; 88 | case 4: 89 | return t << 16 | p << 8 | v; 90 | default: 91 | return v << 16 | p << 8 | q; 92 | } 93 | } 94 | 95 | static inline uint32_t mix_color(uint32_t a, uint32_t b) 96 | { 97 | uint8_t ar = (a >> 16) & 0xff; 98 | uint8_t ag = (a >> 8) & 0xff; 99 | uint8_t ab = a & 0xff; 100 | 101 | uint8_t br = (b >> 16) & 0xff; 102 | uint8_t bg = (b >> 8) & 0xff; 103 | uint8_t bb = b & 0xff; 104 | 105 | uint8_t mr = (ar + br) / 2; 106 | uint8_t mg = (ag + bg) / 2; 107 | uint8_t mb = (ab + bb) / 2; 108 | 109 | return mr << 16 | mg << 8 | mb; 110 | } 111 | 112 | static inline void pio_send_rgb(uint32_t rgb) 113 | { 114 | pio_sm_put_blocking(pio0, 0, rgb << 8u); 115 | } 116 | 117 | static void drive_led() 118 | { 119 | static uint64_t last = 0; 120 | uint64_t now = time_us_64(); 121 | if (now - last < 4000) { // no faster than 250Hz 122 | return; 123 | } 124 | last = now; 125 | 126 | bool use_hid = (hid_timeout > 0) && (now < hid_timeout); 127 | 128 | // button 129 | for (int i = 0; i < count_of(button_buf); i++) { 130 | pio_send_rgb(use_hid ? hid_button_buf[i] : button_buf[i]); 131 | } 132 | 133 | // slider, half or full 134 | for (int i = 0; i < (half_mode ? 16 : 32); i++) { 135 | if (use_hid) { 136 | if (half_mode) { 137 | uint32_t rgb = mix_color(hid_slider_buf[i * 2], hid_slider_buf[i * 2 + 1]); 138 | pio_send_rgb(rgb); 139 | } else { 140 | pio_send_rgb(hid_slider_buf[i]); 141 | } 142 | } else { 143 | pio_send_rgb(slider_buf[i]); 144 | } 145 | } 146 | } 147 | 148 | static inline uint32_t apply_level(uint32_t color, uint8_t level) 149 | { 150 | unsigned r = (color >> 16) & 0xff; 151 | unsigned g = (color >> 8) & 0xff; 152 | unsigned b = color & 0xff; 153 | 154 | r = r * level / 255; 155 | g = g * level / 255; 156 | b = b * level / 255; 157 | 158 | return r << 16 | g << 8 | b; 159 | } 160 | 161 | void rgb_button_color(unsigned index, uint32_t color) 162 | { 163 | if (index < count_of(button_rgb_map)) { 164 | button_buf[button_rgb_map[index]] = apply_level(color, diva_cfg->light.level.button); 165 | } 166 | } 167 | 168 | void rgb_slider_color(unsigned index, uint32_t color) 169 | { 170 | if (index > 32) { 171 | return; 172 | } 173 | slider_buf[index] = apply_level(color, diva_cfg->light.level.slider); 174 | } 175 | 176 | static inline void update_hid_timeout() 177 | { 178 | hid_timeout = time_us_64() + HID_LIGHT_TIMEOUT_MS * 1000; 179 | } 180 | 181 | static inline uint32_t led_rgb(const uint8_t *grb, int index) 182 | { 183 | const uint8_t *src = grb + index * 3; 184 | return rgb32(src[1], src[0], src[2], false); 185 | } 186 | 187 | void rgb_set_hid_slider(unsigned index, unsigned num, const uint8_t *grb, bool flip) 188 | { 189 | for (int i = 0; i < num; i++) { 190 | if (index + i >= 32) { 191 | return; 192 | } 193 | int target = flip ? (31 - (index + i)) : (index + i); 194 | uint32_t *dest = &hid_slider_buf[target]; 195 | *dest = apply_level(led_rgb(grb, i), diva_cfg->light.level.slider); 196 | } 197 | 198 | update_hid_timeout(); 199 | } 200 | 201 | void rgb_set_hid_button(const uint8_t *scale) 202 | { 203 | uint32_t button_colors[] = { 204 | rgb32(0, 0xff, 0, false), 205 | rgb32(0xe0, 0x10, 0xe0, false), 206 | rgb32(0, 0, 0xff, false), 207 | rgb32(0xff, 0, 0, false), 208 | }; 209 | 210 | for (int i = 0; i < 4; i++) { 211 | int button_led = button_rgb_map[i]; 212 | uint32_t color = apply_level(button_colors[i], scale[i]); 213 | hid_button_buf[button_led] = apply_level(color, diva_cfg->light.level.button); 214 | } 215 | 216 | hid_button_buf[4] = button_buf[4]; // HID doesn't have start button light 217 | 218 | update_hid_timeout(); 219 | } 220 | 221 | void rgb_init() 222 | { 223 | uint pio0_offset = pio_add_program(pio0, &ws2812_program); 224 | 225 | gpio_set_drive_strength(RGB_PIN, GPIO_DRIVE_STRENGTH_2MA); 226 | ws2812_program_init(pio0, 0, pio0_offset, RGB_PIN, 800000, false); 227 | } 228 | 229 | void rgb_set_half_mode(bool half) 230 | { 231 | half_mode = half; 232 | } 233 | 234 | void rgb_update() 235 | { 236 | drive_led(); 237 | } 238 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | # Diva Pico - Project Diva (初音未来:歌姬计划)计划风格的迷你控制器 2 | [Click here for the English version of this guide.](README.md) 3 | 4 | 5 | 6 | **特点:** 7 | * 他很小巧,但按钮手感非常好。 8 | * 可以作为任天堂 Switch 游戏机的控制器。 9 | * 16个滑条按键。 10 | * 丰富的命令行功能。 11 | * 所有源文件开放。 12 | 13 | 感谢许多尊敬的爱好者和公司将他们的工具或材料免费或开源(KiCad,OnShape,InkScape,Raspberry 相关工具, 嘉立创)。 14 | 15 | 特别感谢社区开发者的启发和帮助:比如 CrazyRedMachine (https://github.com/CrazyRedMachine). 16 | 17 | 还有: 18 | * RP_Silicon_KiCad: https://github.com/HeadBoffin/RP_Silicon_KiCad 19 | * Switch_Keyboard_Kailh: https://github.com/kiswitch/keyswitch-kicad-library 20 | 21 | ## 说明 22 | 这个项目: 23 | * 高度依赖 3D 打印,你需要一个 Bambu 3D 打印机(X1, P1 或 A1,不是迷你版)。 24 | * 需要焊接微小的元件的技能。 25 | 26 | ## 其他项目 27 | 你也可以查看我其他的酷炫项目。 28 | 29 | 30 | 31 | * Popn Pico: https://github.com/whowechina/popn_pico 32 | * IIDX Pico: https://github.com/whowechina/iidx_pico 33 | * IIDX Teeny: https://github.com/whowechina/iidx_teeny 34 | * Chu Pico: https://github.com/whowechina/chu_pico 35 | * Mai Pico: https://github.com/whowechina/mai_pico 36 | * Diva Pico: https://github.com/whowechina/diva_pico 37 | * AIC Pico: https://github.com/whowechina/aic_pico 38 | * Groove Pico: https://github.com/whowechina/groove_pico 39 | * Geki Pico: https://github.com/whowechina/geki_pico 40 | * Musec Pico: https://github.com/whowechina/musec_pico 41 | * Ju Pico: https://github.com/whowechina/ju_pico 42 | * Bishi Pico: https://github.com/whowechina/bishi_pico 43 | * Bishi Pico: https://github.com/whowechina/nos_pico 44 | 45 | ## **声明** ## 46 | 我在个人时间内制作了这个项目,没有任何经济利益或赞助。我将继续改进这个项目。我已尽我所能确保所有内容的准确性和功能性,但总有可能出现错误。如果你因使用这个开源项目而造成时间或金钱的损失,我不能负责。感谢你的理解。 47 | 48 | ## 关于许可证 49 | 它是 CC-NC 授权。所以你只能给自己和你的朋友 DIY,不能利用这个项目赚钱,比如收费的代做,出售整机等,连源作者都不敢提的抄袭或者稍微改改换个名字来打擦边球就更不可以了。注意团购和拼单订购原始元器件是合理的,非盈利的方式卖掉剩余的元器件也是可以接受的。 50 | 51 | 如果希望商用授权或者购买成品(可能较慢),请联系我(Discord,QQ 群,微信群或者在 issue 区留下你的联系方式)。 52 | 53 | ## 我的 Discord 服务器邀请 54 | https://discord.gg/M8f2PPQFEA 55 | 56 | ## 如何制作 57 | ### 常见错误 58 | 很多 DIY 爱好者在制作过程中常常犯一些错误。请格外小心避免这些错误。 59 | * **错误:在焊接之前没有进行中间测试。** 60 | 请记住,即使是专业工程师也会犯错误。当所有元件都已组装或焊接时,要找到问题的根本原因就会变得更加困难。因此,建议分阶段焊接和测试。固件设计为即使有一些元件缺失也能正确运行,这对测试很有帮助。 61 | * **错误:忘记切断 MPR121 模块上的 ADDR 引脚的默认接地。** 62 | 市面上的 MPR121 模块的 ADDR 引脚默认已经接地。但是,板子上的设计需要一个浮动的 ADDR 引脚,否则 ADDR 引脚会短路。请使用万用表验证确保你成功切断它,但也请注意不要切过头,导致切断临近线路。 63 | * **错误:在器件看上去没有工作的时候就匆忙更换它。** 64 | 比如过早的假设 Raspberry Pi Pico 或其他模块是有问题的。 65 | 请记住,器件绝大部分情况下都是好的,问题可能在焊接上。更换器件会带来额外的风险,比如损坏器件或 PCB 板。耐心和谨慎是至关重要的。首先查看原理图和 PCB 设计文件,并向社区寻求帮助。怀疑器件问题应该是你的最后选择。 66 | 67 | ### PCB 68 | * 找个 PCB 供应商(比如 JLCPCB)下单,使用最新的 `Production\PCB\diva_main_xxx.zip` 文件,选择常规 FR-4 板材,黑色,厚度为 **1.6mm**。 69 | 70 | * 1x 树莓派 Pico 或兼容的克隆板。 71 | https://www.raspberrypi.com/products/raspberry-pi-pico 72 | 在接触点附近贴上一层薄薄的透明胶带以避免短路。 73 | 74 | * 16x WS2812B-4020 侧向发光 RGB LED 用于滑条。 75 | https://www.lcsc.com/product-detail/Light-Emitting-Diodes-LED_Worldsemi-WS2812B-4020_C965557.html 76 | * 9x WS2812B-3528 RGB LED 用于按钮。 77 | * 1x 0603 10 欧姆电阻(R3),或者如果你嫌它太简单了,可以使用 SN74LV1T34DBVR(SOT-23-5)电平转换器(U8)来代替。 78 | https://www.lcsc.com/product-detail/Buffer-Driver-Transceiver_Texas-Instruments-SN74LV1T34DBVR_C100024.html 79 | * 2x MPR121 模块,市面上有很多种,选择这种类型的。 80 | https://www.sparkfun.com/products/retired/9695 81 | 在焊接 MPR121 模块到主 PCB 板之前,记得用小刀**切断 ADDR 和 GND 之间的微小连线**,注意绝对不要切过头。 82 | 83 | 84 | * 8x 0603 1uF(0.1~1uF 都可以)电容(C1 到 C8),可选,但建议焊上。 85 | * 4x Kailh choc v1 机械轴,建议使用重线性轴(深黄色最好的,按压力约为 70gf)。 86 | 87 | * 2x Alps SKSTAAE010 轻触开关。 88 | https://tech.alpsalpine.com/e/products/detail/SKSTAAE010/ 89 | 90 | * 1x Omron B3F-4005 或 B3F-4000 微动开关。 91 | https://www.mouser.com/ProductDetail/Omron-Electronics/B3F-4000?qs=B3tblJ0Nlt8c5sbFRctxww%3D%3D 92 | 93 | * 3M 5423 或 5421 UHMW PE 薄膜胶带,对于按钮手感很重要。5423 更厚一些。 94 | https://www.3m.com/3M/en_US/p/d/b40069119/ 95 | 96 | 你需要将胶带贴在按钮到开关的接触面和按钮到底座夹紧处。 97 | 98 | 99 | 100 | 101 | * 4x 2mm\*50mm(直径\*长度)钢轴用于按钮杠杆结构。 102 | 103 | ### 导光板 104 | * 找一个服务切割导光板或者磨砂亚克力板。它是一个完美的矩形,尺寸是 240mm*42mm,厚度为 1.8mm 到 2.0mm,所以你不需要 CAD 文件。 105 | 106 | * 一个好的导光板看上去是这样的。 107 | 108 | 109 | ### 3D 打印 110 | * 你可能需要一个 Bambu 3D 打印机: 111 | * 部件都是为了完美适配 256mm*256mm 的打印床。 112 | * 它的 AMS 系统非常适合多色打印。 113 | * 打印参数 114 | * PLA, PETG, ABS 都可以。 115 | * "Arctic Whisper" 颜色最适合主体。 116 | * 打印层高:0.2mm 117 | * 支撑:需要。 118 | 119 | * 主体:`Production\3D\diva_pico_base.stl`。 120 | * 支撑:`Production\3D\diva_pico_support.stl`。 121 | * 盖子:`Production\3D\diva_pico_panel.3mf`,支持多色打印。 122 | * 按钮:`Production\3D\diva_pico_button_combo.3mf`,支持多色打印。 123 | 注意,按钮组件(按钮主体,按钮座和上面的图案)都混在一个文件里,你需要在打印前挑选秩组合。 124 | 125 | 126 | 从上到下: 127 | * 盖子 128 | * 盖子底座 + 导光板 129 | * 按钮 130 | * PCB 131 | * 主体 132 | 133 | 你需要 **6x M3*10mm 普通螺丝** 来固定所有东西。 134 | 135 | 6x 硅胶防滑垫可以贴在底座的底部,以提供游玩时的稳定性。 136 | 137 | #### 按钮圆顶 138 | * 购买这种 60mm 的圆顶游戏机按钮,内径 46mm。 139 | 140 | 141 | ### 固件 142 | * 使用最新的 UF2 文件,它在 `Production\Firmware` 文件夹里。 143 | * 全新烧录的话,按住 BOOTSEL 按钮,然后连接 USB 到 PC,会出现一个名为 "RPI-RP2" 的磁盘。将 UF2 固件拖入即可。Divia Pico 的底部有一个小孔,它正对着 BOOTSEL 按钮。 144 | * 固件提供了命令行配置功能,你可以使用这个 Web Serial Terminal 来连接 Diva Pico 的 USB 串口。(提示:输入 "?" 可以获得帮助) 145 | https://googlechromelabs.github.io/serial-terminal/ 146 | * 你可以使用下面两种方法来切换预设的按键映射。 147 | * 插入 USB 时按住三角、方块或者叉叉键(只按一个键),分别会切换到适合 Nintendo Switch、Steam 和 Arcade 版本的按键映射。 148 | * 在命令行界面使用 `keymap` 命令。 149 | 150 | ## CAD 源文件 151 | 我使用 OnShape 免费订阅。它很强大,但不能将原始设计存档到本地,所以我只能在这里分享链接。STL/DXF/DWG 文件是从这个在线文档导出的。 152 | https://cad.onshape.com/documents/d9e9c1de2d4b98d5eaf21d07/w/7c216f367b558e083eb1f468/e/4536bf9859137db81313ff87?configuration=List_ilV09d08Sdz7FZ%3DButton_48&renderMode=0&uiState=65923e1383b3106c15b5c996 153 | --------------------------------------------------------------------------------