├── RGB LED pcb ├── Wiiboy_parts.dcm ├── Wiiboy_parts.lib ├── RGB LED pcb.pro ├── RGB LED pcb-cache.lib ├── RGB LED pcb.bak ├── RGB LED pcb.sch └── RGB LED pcb.net ├── RVL-PMS BOARD FILES ├── RVL-PMS HW2-rescue.dcm ├── sym-lib-table ├── RVL-PMS HW2-rescue.lib ├── RVL-PMS HW2.pro ├── RVL-PMS HW2.pretty │ └── BQ25895.kicad_mod └── RVL-PMS HW2-cache.lib ├── RVLPMS BOM.pdf ├── RVLPMS (OLD) ├── WiiPMS KiCAD files │ ├── pic16f15324.bck │ ├── pic16f15324.dcm │ ├── Wii reg-rescue.dcm │ ├── Wii reg.pro │ ├── pic16f15324.bak │ ├── pic16f15324.lib │ ├── rescue-backup │ │ ├── Wii reg-2018-08-30-21-59-42.pro │ │ └── Wii reg-cache-2018-08-30-21-59-42.lib │ ├── sym-lib-table │ ├── Wii reg-rescue.lib │ └── Wii reg-cache.lib ├── Wii PMS BOM.xlsx ├── WiiPMS firmware v2 │ └── WiiPMS V2.X │ │ ├── build │ │ └── default │ │ │ └── production │ │ │ ├── NVM.p1.d │ │ │ ├── PPS.p1.d │ │ │ ├── time.p1.d │ │ │ ├── PWM.p1.d │ │ │ ├── ADC.p1.d │ │ │ ├── I2C.p1.d │ │ │ ├── LED_INTERFACE.p1.d │ │ │ ├── stusb4500.p1.d │ │ │ ├── BQ25895M.p1.d │ │ │ ├── i2c_driver_stusb4500.p1.d │ │ │ ├── stusb4500_nvm.p1.d │ │ │ └── main.p1.d │ │ ├── nbproject │ │ ├── private │ │ │ ├── SuppressibleMessageMemo.properties │ │ │ ├── private.xml │ │ │ └── configurations.xml │ │ ├── Makefile-variables.mk │ │ ├── Makefile-genesis.properties │ │ ├── project.xml │ │ ├── Package-default.bash │ │ ├── Makefile-impl.mk │ │ └── Makefile-local-default.mk │ │ ├── dist │ │ └── default │ │ │ └── production │ │ │ ├── WiiPMS_V2.X.production.o │ │ │ ├── WiiPMS_V2.X.production.elf │ │ │ ├── WiiPMS_V2.X.production.rlf │ │ │ ├── compiler_support.d │ │ │ ├── WiiPMS_V2.X.production.mum │ │ │ ├── memoryfile.xml │ │ │ ├── compiler_support.i │ │ │ └── compiler_support.p1 │ │ ├── stusb4500_nvm.h │ │ ├── PPS.h │ │ ├── ADC.h │ │ ├── PWM.h │ │ ├── NVM.h │ │ ├── time.c │ │ ├── PPS.c │ │ ├── stusb4500.h │ │ ├── time.h │ │ ├── LED_INTERFACE.h │ │ ├── ADC.c │ │ ├── BQ25895M.h │ │ ├── I2C.h │ │ ├── NVM.c │ │ ├── stusb4500_nvm_config.h │ │ ├── i2c_driver_stusb4500.h │ │ ├── PWM.c │ │ ├── I2C.c │ │ ├── PICCONFIG.h │ │ ├── i2c_driver_stusb4500.c │ │ ├── Makefile │ │ ├── BQ25895M.c │ │ ├── LED_INTERFACE.c │ │ ├── main.c │ │ └── stusb4500.c └── WiiPMS Gerber files │ ├── Wii reg-B.SilkS.gbr │ ├── Wii reg-Edge.Cuts.gbr │ └── Wii reg.drl ├── RVLPMS_FIRMWARE ├── build │ └── default │ │ └── production │ │ ├── PPS.p1.d │ │ ├── time.p1.d │ │ ├── PWM.p1.d │ │ ├── ADC.p1.d │ │ ├── I2C.p1.d │ │ ├── LED_INTERFACE.p1.d │ │ ├── BQ25895M.p1.d │ │ ├── stusb4500.p1.d │ │ ├── i2c_driver_stusb4500.p1.d │ │ └── main.p1.d ├── dist │ └── default │ │ └── production │ │ ├── RVLPMS_FIRMWARE.production.o │ │ ├── RVLPMS_FIRMWARE.production.elf │ │ ├── RVLPMS_FIRMWARE.production.rlf │ │ ├── compiler_support.d │ │ ├── RVLPMS_FIRMWARE.production.mum │ │ ├── memoryfile.xml │ │ ├── compiler_support.i │ │ ├── compiler_support.p1 │ │ └── RVLPMS_FIRMWARE.production.hxl ├── PPS.h ├── PWM.h ├── ADC.h ├── time.c ├── PPS.c ├── stusb4500.h ├── time.h ├── LED_INTERFACE.h ├── nbproject │ ├── private │ │ ├── private.xml │ │ └── configurations.xml │ ├── Makefile-variables.mk │ ├── Makefile-genesis.properties │ ├── project.xml │ ├── Package-default.bash │ ├── Makefile-impl.mk │ └── Makefile-local-default.mk ├── BQ25895M.h ├── ADC.c ├── I2C.h ├── i2c_driver_stusb4500.h ├── PWM.c ├── I2C.c ├── PICCONFIG.h ├── i2c_driver_stusb4500.c ├── Makefile ├── BQ25895M.c ├── LED_INTERFACE.c ├── stusb4500.c └── main.c └── RVL-PMS_GERBERS ├── RVL-PMS HW2-NPTH.drl ├── RVL-PMS HW2-B_Paste.gbr ├── RVL-PMS HW2-B_SilkS.gbr ├── RVL-PMS HW2-Edge_Cuts.gbr └── RVL-PMS HW2-PTH.drl /RGB LED pcb/Wiiboy_parts.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /RVL-PMS BOARD FILES/RVL-PMS HW2-rescue.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /RVLPMS BOM.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gmanmodz/RVL-Power-Management-System/HEAD/RVLPMS BOM.pdf -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/pic16f15324.bck: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/pic16f15324.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/Wii reg-rescue.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/Wii PMS BOM.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gmanmodz/RVL-Power-Management-System/HEAD/RVLPMS (OLD)/Wii PMS BOM.xlsx -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/PPS.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/PPS.d \ 2 | build/default/production/PPS.p1: \ 3 | PPS.c -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/time.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/time.d \ 2 | build/default/production/time.p1: \ 3 | time.c -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/PWM.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/PWM.d \ 2 | build/default/production/PWM.p1: \ 3 | PWM.c \ 4 | PPS.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/ADC.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/ADC.d \ 2 | build/default/production/ADC.p1: \ 3 | ADC.c \ 4 | PICCONFIG.h -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/NVM.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/NVM.d \ 2 | build/default/production/NVM.p1: \ 3 | NVM.c -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/PPS.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/PPS.d \ 2 | build/default/production/PPS.p1: \ 3 | PPS.c -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/time.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/time.d \ 2 | build/default/production/time.p1: \ 3 | time.c -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/I2C.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/I2C.d \ 2 | build/default/production/I2C.p1: \ 3 | I2C.c \ 4 | I2C.h \ 5 | PICCONFIG.h -------------------------------------------------------------------------------- /RVL-PMS BOARD FILES/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (lib (name RVL-PMS-HW2-rescue)(type Legacy)(uri "${KIPRJMOD}/RVL-PMS HW2-rescue.lib")(options "")(descr "")) 3 | ) 4 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/PWM.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/PWM.d \ 2 | build/default/production/PWM.p1: \ 3 | PWM.c \ 4 | PPS.h -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/private/SuppressibleMessageMemo.properties: -------------------------------------------------------------------------------- 1 | # 2 | #Sat Sep 14 14:49:37 EDT 2019 3 | pk3/CHECK_4_HIGH_VOLTAGE_VPP=true 4 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/ADC.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/ADC.d \ 2 | build/default/production/ADC.p1: \ 3 | ADC.c \ 4 | PICCONFIG.h -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/I2C.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/I2C.d \ 2 | build/default/production/I2C.p1: \ 3 | I2C.c \ 4 | I2C.h \ 5 | PICCONFIG.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/LED_INTERFACE.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/LED_INTERFACE.d \ 2 | build/default/production/LED_INTERFACE.p1: \ 3 | LED_INTERFACE.c \ 4 | BQ25895M.h \ 5 | time.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/RVLPMS_FIRMWARE.production.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gmanmodz/RVL-Power-Management-System/HEAD/RVLPMS_FIRMWARE/dist/default/production/RVLPMS_FIRMWARE.production.o -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/RVLPMS_FIRMWARE.production.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gmanmodz/RVL-Power-Management-System/HEAD/RVLPMS_FIRMWARE/dist/default/production/RVLPMS_FIRMWARE.production.elf -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/RVLPMS_FIRMWARE.production.rlf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gmanmodz/RVL-Power-Management-System/HEAD/RVLPMS_FIRMWARE/dist/default/production/RVLPMS_FIRMWARE.production.rlf -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/BQ25895M.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/BQ25895M.d \ 2 | build/default/production/BQ25895M.p1: \ 3 | BQ25895M.c \ 4 | BQ25895M.h \ 5 | I2C.h \ 6 | PICCONFIG.h \ 7 | time.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/stusb4500.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/stusb4500.d \ 2 | build/default/production/stusb4500.p1: \ 3 | stusb4500.c \ 4 | PICCONFIG.h \ 5 | i2c_driver_stusb4500.h \ 6 | stusb4500.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/compiler_support.d: -------------------------------------------------------------------------------- 1 | dist/default/production/compiler_support.d dist/default/production/compiler_support.p1: C:/Program\ Files\ (x86)/Microchip/xc8/v2.10/pic/sources/c90/pic/compiler_support.c -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/LED_INTERFACE.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/LED_INTERFACE.d \ 2 | build/default/production/LED_INTERFACE.p1: \ 3 | LED_INTERFACE.c \ 4 | BQ25895M.h \ 5 | time.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/i2c_driver_stusb4500.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/i2c_driver_stusb4500.d \ 2 | build/default/production/i2c_driver_stusb4500.p1: \ 3 | i2c_driver_stusb4500.c \ 4 | PICCONFIG.h \ 5 | i2c_driver_stusb4500.h -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/stusb4500.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/stusb4500.d \ 2 | build/default/production/stusb4500.p1: \ 3 | stusb4500.c \ 4 | PICCONFIG.h \ 5 | i2c_driver_stusb4500.h \ 6 | stusb4500.h -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/WiiPMS_V2.X.production.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gmanmodz/RVL-Power-Management-System/HEAD/RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/WiiPMS_V2.X.production.o -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/BQ25895M.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/BQ25895M.d \ 2 | build/default/production/BQ25895M.p1: \ 3 | BQ25895M.c \ 4 | BQ25895M.h \ 5 | NVM.h \ 6 | I2C.h \ 7 | PICCONFIG.h \ 8 | time.h -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/WiiPMS_V2.X.production.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gmanmodz/RVL-Power-Management-System/HEAD/RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/WiiPMS_V2.X.production.elf -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/WiiPMS_V2.X.production.rlf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gmanmodz/RVL-Power-Management-System/HEAD/RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/WiiPMS_V2.X.production.rlf -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/compiler_support.d: -------------------------------------------------------------------------------- 1 | dist/default/production/compiler_support.d dist/default/production/compiler_support.p1: C:/Program\ Files\ (x86)/Microchip/xc8/v2.10/pic/sources/c90/pic/compiler_support.c -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/i2c_driver_stusb4500.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/i2c_driver_stusb4500.d \ 2 | build/default/production/i2c_driver_stusb4500.p1: \ 3 | i2c_driver_stusb4500.c \ 4 | PICCONFIG.h \ 5 | i2c_driver_stusb4500.h -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/stusb4500_nvm.h: -------------------------------------------------------------------------------- 1 | #ifndef STUSB4500_NVM_H 2 | #define STUSB4500_NVM_H 3 | 4 | #include 5 | 6 | int nvm_flash(void); 7 | int nvm_read(uint8_t* sectors_out); 8 | int nvm_verify(void); 9 | 10 | #endif // STUSB4500_NVM_H -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/stusb4500_nvm.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/stusb4500_nvm.d \ 2 | build/default/production/stusb4500_nvm.p1: \ 3 | stusb4500_nvm.c \ 4 | stusb4500_nvm.h \ 5 | stusb4500_nvm_config.h \ 6 | i2c_driver_stusb4500.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/build/default/production/main.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/main.d \ 2 | build/default/production/main.p1: \ 3 | main.c \ 4 | BQ25895M.h \ 5 | I2C.h \ 6 | PPS.h \ 7 | PWM.h \ 8 | PICCONFIG.h \ 9 | LED_INTERFACE.h \ 10 | time.h \ 11 | stusb4500.h \ 12 | ADC.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/PPS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PPS.h 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef PPS_H 9 | #define PPS_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | void PPS_unlock(); 14 | void PPS_lock(); 15 | 16 | #endif -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/PWM.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PWM.h 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef PWM_H 9 | #define PWM_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | void PWM_INIT(); 14 | void PWM_power_down(); 15 | 16 | #endif -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/PPS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PPS.h 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef PPS_H 9 | #define PPS_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | void PPS_unlock(); 14 | void PPS_lock(); 15 | 16 | #endif -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/build/default/production/main.p1.d: -------------------------------------------------------------------------------- 1 | build/default/production/main.d \ 2 | build/default/production/main.p1: \ 3 | main.c \ 4 | BQ25895M.h \ 5 | NVM.h \ 6 | I2C.h \ 7 | PPS.h \ 8 | PWM.h \ 9 | stusb4500_nvm.h \ 10 | PICCONFIG.h \ 11 | LED_INTERFACE.h \ 12 | time.h \ 13 | stusb4500.h \ 14 | ADC.h -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/ADC.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: ADC.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef ADC_H 9 | #define ADC_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | #define ADCRA4 0b000100 14 | 15 | unsigned int readADC(char channel); 16 | 17 | #endif -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/ADC.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: ADC.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef ADC_H 9 | #define ADC_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | #define ADCRA4 0b000100 14 | 15 | unsigned int readADC(char channel); 16 | 17 | #endif -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/PWM.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PWM.h 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef PWM_H 9 | #define PWM_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | void PWM_INIT(); 14 | void PWM_power_down(); 15 | void PWM_power_up(); 16 | 17 | #endif -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/time.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: time.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 19, 2019, 5:09 PM 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | uint32_t timer_counter = 0; 12 | 13 | inline uint32_t get_time(void) { 14 | return timer_counter; 15 | } 16 | 17 | uint32_t timer_diff(uint32_t t) { 18 | return timer_counter - t; 19 | } -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/PPS.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PPS.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 13, 2019, 10:48 PM 6 | */ 7 | 8 | 9 | #include 10 | 11 | void PPS_unlock() { 12 | PPSLOCK = 0x55; 13 | PPSLOCK = 0xAA; 14 | PPSLOCK = 0; //PPS unlocked 15 | } 16 | 17 | void PPS_lock() { 18 | PPSLOCK = 0x55; 19 | PPSLOCK = 0xAA; 20 | PPSLOCK = 1; //PPS locked 21 | } -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/stusb4500.h: -------------------------------------------------------------------------------- 1 | #ifndef STUSB4500_H 2 | #define STUSB4500_H 3 | 4 | // User adjustable parameters 5 | #define PDO_CURRENT_MIN 0 // mA, 25mA increments 6 | #define PDO_VOLTAGE_MIN 5000 // mV, 50mV increments 7 | #define PDO_VOLTAGE_MAX 12000 // mV, 50mV increments 8 | 9 | #define STUSB_OK 0 10 | #define STUSB_FAILURE -1 11 | 12 | int stusb_negotiate(void); 13 | 14 | #endif // STUSB4500_H -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/NVM.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: NVM.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef NVM_H 9 | #define NVM_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | void EEPROM_WRITE_BYTE(unsigned char addr, char data); 14 | char EEPROM_READ_BYTE(unsigned char addr); 15 | 16 | #endif -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/time.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: time.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 19, 2019, 5:09 PM 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | uint32_t timer_counter = 0; 12 | 13 | inline uint32_t get_time(void) { 14 | return timer_counter; 15 | } 16 | 17 | uint32_t timer_diff(uint32_t t) { 18 | return timer_counter - t; 19 | } -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: time.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef TIME_H 9 | #define TIME_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | #include 13 | 14 | extern uint32_t timer_counter; 15 | 16 | inline uint32_t get_time(void); 17 | uint32_t timer_diff(uint32_t t); 18 | 19 | #endif -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/PPS.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PPS.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 13, 2019, 10:48 PM 6 | */ 7 | 8 | 9 | #include 10 | 11 | void PPS_unlock() { 12 | PPSLOCK = 0x55; 13 | PPSLOCK = 0xAA; 14 | PPSLOCK = 0; //PPS unlocked 15 | } 16 | 17 | void PPS_lock() { 18 | PPSLOCK = 0x55; 19 | PPSLOCK = 0xAA; 20 | PPSLOCK = 1; //PPS locked 21 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/stusb4500.h: -------------------------------------------------------------------------------- 1 | #ifndef STUSB4500_H 2 | #define STUSB4500_H 3 | 4 | // User adjustable parameters 5 | #define PDO_CURRENT_MIN 0 // mA, 25mA increments 6 | #define PDO_VOLTAGE_MIN 5000 // mV, 50mV increments 7 | #define PDO_VOLTAGE_MAX 12000 // mV, 50mV increments 8 | 9 | #define STUSB_OK 0 10 | #define STUSB_FAILURE -1 11 | 12 | int stusb_negotiate(void); 13 | 14 | #endif // STUSB4500_H -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: time.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef TIME_H 9 | #define TIME_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | #include 13 | 14 | extern uint32_t timer_counter; 15 | 16 | inline uint32_t get_time(void); 17 | uint32_t timer_diff(uint32_t t); 18 | 19 | #endif -------------------------------------------------------------------------------- /RVL-PMS_GERBERS/RVL-PMS HW2-NPTH.drl: -------------------------------------------------------------------------------- 1 | M48 2 | ; DRILL file {KiCad (5.1.4)-1} date 9/18/2020 11:06:03 AM 3 | ; FORMAT={-:-/ absolute / inch / decimal} 4 | ; #@! TF.CreationDate,2020-09-18T11:06:03-04:00 5 | ; #@! TF.GenerationSoftware,Kicad,Pcbnew,(5.1.4)-1 6 | ; #@! TF.FileFunction,NonPlated,1,4,NPTH 7 | FMAT,2 8 | INCH 9 | T1C0.0866 10 | % 11 | G90 12 | G05 13 | T1 14 | X5.8406Y-3.3415 15 | X4.2992Y-2.2215 16 | X4.3002Y-3.3415 17 | X5.8406Y-2.2215 18 | T0 19 | M30 20 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/RVLPMS_FIRMWARE.production.mum: -------------------------------------------------------------------------------- 1 | 2 | Memory Summary: 3 | Program space used CE2h ( 3298) of 1000h words ( 80.5%) 4 | Data space used E3h ( 227) of 200h bytes ( 44.3%) 5 | EEPROM space None available 6 | Data stack space used 0h ( 0) of 11Ch bytes ( 0.0%) 7 | Configuration bits used 5h ( 5) of 5h words (100.0%) 8 | ID Location space used 0h ( 0) of 4h bytes ( 0.0%) 9 | 10 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/LED_INTERFACE.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: LED_INTERFACE.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef LED_INTERFACE_H 9 | #define LED_INTERFACE_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | void RGB_fade(); 14 | static char Map(int x, char inMin, char inMax, char outMin, char outMax); 15 | void battery_fade(); 16 | void chrg_led(); 17 | void flash_led(); 18 | void led_modes(); 19 | 20 | extern char mode; 21 | 22 | #endif -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file:/C:/Users/Gunnar/Desktop/Wii-Power-Management-System/RVLPMS_FIRMWARE/BQ25895M.c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /RGB LED pcb/Wiiboy_parts.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # LTST-C19HE1WT 5 | # 6 | DEF LTST-C19HE1WT U 0 40 Y Y 1 F N 7 | F0 "U" 50 -350 50 H V C CNN 8 | F1 "LTST-C19HE1WT" 300 -550 50 H V C CNN 9 | F2 "" 0 0 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | DRAW 12 | S -400 -300 -50 -800 0 1 0 N 13 | X RED 1 -300 -200 100 D 50 50 1 1 I 14 | X Green 2 -150 -200 100 D 50 50 1 1 I 15 | X Blue 3 -150 -900 100 U 50 50 1 1 I 16 | X Anode 4 -300 -900 100 U 50 50 1 1 I 17 | ENDDRAW 18 | ENDDEF 19 | # 20 | #End Library 21 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/nbproject/Makefile-variables.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated - do not edit! 3 | # 4 | # NOCDDL 5 | # 6 | CND_BASEDIR=`pwd` 7 | # default configuration 8 | CND_ARTIFACT_DIR_default=dist/default/production 9 | CND_ARTIFACT_NAME_default=RVLPMS_FIRMWARE.production.hex 10 | CND_ARTIFACT_PATH_default=dist/default/production/RVLPMS_FIRMWARE.production.hex 11 | CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package 12 | CND_PACKAGE_NAME_default=rvlpmsfirmware.tar 13 | CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/rvlpmsfirmware.tar 14 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/WiiPMS_V2.X.production.mum: -------------------------------------------------------------------------------- 1 | 2 | Memory Summary: 3 | Program space used D91h ( 3473) of 1000h words ( 84.8%) 4 | Data space used E2h ( 226) of 200h bytes ( 44.1%) 5 | EEPROM space None available 6 | Data stack space used 0h ( 0) of 11Dh bytes ( 0.0%) 7 | Configuration bits used 5h ( 5) of 5h words (100.0%) 8 | ID Location space used 0h ( 0) of 4h bytes ( 0.0%) 9 | 10 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/Makefile-variables.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated - do not edit! 3 | # 4 | # NOCDDL 5 | # 6 | CND_BASEDIR=`pwd` 7 | # default configuration 8 | CND_ARTIFACT_DIR_default=dist/default/production 9 | CND_ARTIFACT_NAME_default=WiiPMS_V2.X.production.hex 10 | CND_ARTIFACT_PATH_default=dist/default/production/WiiPMS_V2.X.production.hex 11 | CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package 12 | CND_PACKAGE_NAME_default=wiipmsv2.x.tar 13 | CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/wiipmsv2.x.tar 14 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/LED_INTERFACE.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: LED_INTERFACE.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef LED_INTERFACE_H 9 | #define LED_INTERFACE_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | void RGB_fade(); 14 | static char Map(int x, char inMin, char inMax, char outMin, char outMax); 15 | void battery_fade(); 16 | void chrg_led(); 17 | void flash_led(); 18 | void led_modes(); 19 | 20 | extern char mode; 21 | 22 | #endif -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/memoryfile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | words 6 | 4096 7 | 3298 8 | 798 9 | 10 | 11 | bytes 12 | 512 13 | 227 14 | 285 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /RVL-PMS_GERBERS/RVL-PMS HW2-B_Paste.gbr: -------------------------------------------------------------------------------- 1 | G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.4)-1* 2 | G04 #@! TF.CreationDate,2020-09-18T11:06:02-04:00* 3 | G04 #@! TF.ProjectId,RVL-PMS HW2,52564c2d-504d-4532-9048-57322e6b6963,rev?* 4 | G04 #@! TF.SameCoordinates,Original* 5 | G04 #@! TF.FileFunction,Paste,Bot* 6 | G04 #@! TF.FilePolarity,Positive* 7 | %FSLAX46Y46*% 8 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 9 | G04 Created by KiCad (PCBNEW (5.1.4)-1) date 2020-09-18 11:06:02* 10 | %MOMM*% 11 | %LPD*% 12 | G04 APERTURE LIST* 13 | G04 APERTURE END LIST* 14 | M02* 15 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/memoryfile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | words 6 | 4096 7 | 3473 8 | 623 9 | 10 | 11 | bytes 12 | 512 13 | 226 14 | 286 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /RVL-PMS_GERBERS/RVL-PMS HW2-B_SilkS.gbr: -------------------------------------------------------------------------------- 1 | G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.4)-1* 2 | G04 #@! TF.CreationDate,2020-09-18T11:06:02-04:00* 3 | G04 #@! TF.ProjectId,RVL-PMS HW2,52564c2d-504d-4532-9048-57322e6b6963,rev?* 4 | G04 #@! TF.SameCoordinates,Original* 5 | G04 #@! TF.FileFunction,Legend,Bot* 6 | G04 #@! TF.FilePolarity,Positive* 7 | %FSLAX46Y46*% 8 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 9 | G04 Created by KiCad (PCBNEW (5.1.4)-1) date 2020-09-18 11:06:02* 10 | %MOMM*% 11 | %LPD*% 12 | G04 APERTURE LIST* 13 | G04 APERTURE END LIST* 14 | M02* 15 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS Gerber files/Wii reg-B.SilkS.gbr: -------------------------------------------------------------------------------- 1 | G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.0.1)-4* 2 | G04 #@! TF.CreationDate,2019-03-16T12:44:05-04:00* 3 | G04 #@! TF.ProjectId,Wii reg,576969207265672E6B696361645F7063,rev?* 4 | G04 #@! TF.SameCoordinates,Original* 5 | G04 #@! TF.FileFunction,Legend,Bot* 6 | G04 #@! TF.FilePolarity,Positive* 7 | %FSLAX46Y46*% 8 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 9 | G04 Created by KiCad (PCBNEW (5.0.1)-4) date 3/16/2019 12:44:05 PM* 10 | %MOMM*% 11 | %LPD*% 12 | G01* 13 | G04 APERTURE LIST* 14 | G04 APERTURE END LIST* 15 | M02* 16 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/BQ25895M.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: BQ25895M.h 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef BQ25895M_H 9 | #define BQ25895M_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | #define BQ_ADDR 0x6A 14 | 15 | void BQ_Write(unsigned char reg, char data); 16 | unsigned short BQ_Read(unsigned char reg); 17 | void BQ_get_chrg_state(); 18 | void BQ_CONFIG_INIT(); 19 | void BQ_INIT(); 20 | void BQ_UPDATE(); 21 | 22 | extern uint8_t VBUS_CHRG_STATE[2]; 23 | extern uint8_t BATTERY_VOLTAGE; 24 | extern uint8_t BQ_adc_state; 25 | 26 | #endif -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/ADC.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: ADC.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 14, 2019, 11:34 AM 6 | */ 7 | 8 | #include 9 | #include "PICCONFIG.h" 10 | 11 | unsigned int readADC(char channel) { 12 | 13 | ADCON1 = 0b01100000; //Left justified, ADCLK is FOSC/64, VREF is VDD 14 | ADCON0 = (channel << 2) | 0b1; 15 | 16 | __delay_ms(5); //sampling time 17 | 18 | ADCON0bits.GOnDONE = 1; //begin ADC 19 | while (ADCON0bits.GOnDONE); //wait for conversion to complete 20 | 21 | //return ((ADRESH << 6) | (ADRESL >> 2)); //Returns 8-bit result 22 | return ADRESH; //return upper 8bits 23 | } -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/nbproject/Makefile-genesis.properties: -------------------------------------------------------------------------------- 1 | # 2 | #Sat Nov 28 09:04:21 EST 2020 3 | default.Pack.dfplocation=C\:\\Program Files (x86)\\Microchip\\MPLABX\\v5.25\\packs\\Microchip\\PIC16F1xxxx_DFP\\1.1.82 4 | default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc8\\v2.10\\bin 5 | configurations-xml=57cef0b3ab897b0167d81596954321c5 6 | com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=6e453b0cf7f7da72a932cfdb2f655401 7 | default.languagetoolchain.version=2.10 8 | host.platform=windows 9 | conf.ids=default 10 | default.com-microchip-mplab-nbide-toolchainXC8-XC8LanguageToolchain.md5=23d12c447ed4f9462f01e2202bc2f36a 11 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/ADC.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: ADC.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 14, 2019, 11:34 AM 6 | */ 7 | 8 | #include 9 | #include "PICCONFIG.h" 10 | 11 | unsigned int readADC(char channel) { 12 | 13 | ADCON1 = 0b01100000; //Left justified, ADCLK is FOSC/64, VREF is VDD 14 | ADCON0 = (channel << 2) | 0b1; 15 | 16 | __delay_ms(5); //sampling time 17 | 18 | ADCON0bits.GOnDONE = 1; //begin ADC 19 | while (ADCON0bits.GOnDONE); //wait for conversion to complete 20 | 21 | //return ((ADRESH << 6) | (ADRESL >> 2)); //Returns 8-bit result 22 | return ADRESH; //return upper 8bits 23 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/Makefile-genesis.properties: -------------------------------------------------------------------------------- 1 | # 2 | #Wed Oct 21 13:56:29 EDT 2020 3 | default.Pack.dfplocation=C\:\\Program Files (x86)\\Microchip\\MPLABX\\v5.25\\packs\\Microchip\\PIC16F1xxxx_DFP\\1.1.82 4 | default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc8\\v2.10\\bin 5 | configurations-xml=046d4c1cf98c7467eac8fcaba2781d2f 6 | com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=6e453b0cf7f7da72a932cfdb2f655401 7 | default.languagetoolchain.version=2.10 8 | host.platform=windows 9 | conf.ids=default 10 | default.com-microchip-mplab-nbide-toolchainXC8-XC8LanguageToolchain.md5=23d12c447ed4f9462f01e2202bc2f36a 11 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/BQ25895M.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: BQ25895M.h 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef BQ25895M_H 9 | #define BQ25895M_H 10 | 11 | #include // include processor files - each processor file is guarded. 12 | 13 | #define BQ_ADDR 0x6A 14 | 15 | void BQ_Write(unsigned char reg, char data); 16 | unsigned short BQ_Read(unsigned char reg); 17 | char BQ_read_adc(char reg); 18 | char * BQ_get_chrg_state(); 19 | void BQ_CONFIG_INIT(); 20 | void BQ_INIT(); 21 | void BQ_UPDATE(); 22 | 23 | extern char * VBUS_CHRG_STATE; 24 | extern char BATTERY_VOLTAGE; 25 | extern char BQ_adc_state; 26 | 27 | #endif -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/I2C.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: 3 | * Author: 4 | * Comments: 5 | * Revision history: 6 | */ 7 | #ifndef I2C_H 8 | #define I2C_H 9 | 10 | #include // include processor files - each processor file is guarded. 11 | 12 | #define SDA RC1 13 | #define SCL RC0 14 | 15 | #define SDA_OUTPUT_TRIS TRISCbits.TRISC1 16 | #define SCL_OUTPUT_TRIS TRISCbits.TRISC0 17 | 18 | void I2C_bus_reset(); 19 | void I2C_Master_Init(const unsigned long clk); 20 | void I2C_Master_Wait(); 21 | void I2C_Master_Start(); 22 | void I2C_Master_Repeated_Start(); 23 | void I2C_Master_Stop(); 24 | void I2C_Master_Write(unsigned char data); 25 | void I2C_Master_Ack(); 26 | void I2C_Master_nAck(); 27 | unsigned char I2C_Master_Read(char ack); 28 | 29 | #endif -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/I2C.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: 3 | * Author: 4 | * Comments: 5 | * Revision history: 6 | */ 7 | #ifndef I2C_H 8 | #define I2C_H 9 | 10 | #include // include processor files - each processor file is guarded. 11 | 12 | #define SDA RC1 13 | #define SCL RC0 14 | 15 | #define SDA_OUTPUT_TRIS TRISCbits.TRISC1 16 | #define SCL_OUTPUT_TRIS TRISCbits.TRISC0 17 | 18 | void I2C_bus_reset(); 19 | void I2C_Master_Init(const unsigned long clk); 20 | void I2C_Master_Wait(); 21 | void I2C_Master_Start(); 22 | void I2C_Master_Repeated_Start(); 23 | void I2C_Master_Stop(); 24 | void I2C_Master_Write(unsigned char data); 25 | void I2C_Master_Ack(); 26 | void I2C_Master_nAck(); 27 | unsigned char I2C_Master_Read(char ack); 28 | 29 | #endif -------------------------------------------------------------------------------- /RVL-PMS_GERBERS/RVL-PMS HW2-Edge_Cuts.gbr: -------------------------------------------------------------------------------- 1 | G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.4)-1* 2 | G04 #@! TF.CreationDate,2020-09-18T11:06:02-04:00* 3 | G04 #@! TF.ProjectId,RVL-PMS HW2,52564c2d-504d-4532-9048-57322e6b6963,rev?* 4 | G04 #@! TF.SameCoordinates,Original* 5 | G04 #@! TF.FileFunction,Profile,NP* 6 | %FSLAX46Y46*% 7 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 8 | G04 Created by KiCad (PCBNEW (5.1.4)-1) date 2020-09-18 11:06:02* 9 | %MOMM*% 10 | %LPD*% 11 | G04 APERTURE LIST* 12 | %ADD10C,0.050000*% 13 | G04 APERTURE END LIST* 14 | D10* 15 | X107000000Y-87100000D02* 16 | X107000000Y-54200000D01* 17 | X150580000Y-87100000D02* 18 | X107000000Y-87100000D01* 19 | X150580000Y-54200000D02* 20 | X150580000Y-87100000D01* 21 | X107000000Y-54200000D02* 22 | X150580000Y-54200000D01* 23 | M02* 24 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/Wii reg.pro: -------------------------------------------------------------------------------- 1 | update=8/30/2018 9:59:54 PM 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [general] 27 | version=1 28 | [eeschema] 29 | version=1 30 | LibDir= 31 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS Gerber files/Wii reg-Edge.Cuts.gbr: -------------------------------------------------------------------------------- 1 | G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.0.1)-4* 2 | G04 #@! TF.CreationDate,2019-03-16T12:44:05-04:00* 3 | G04 #@! TF.ProjectId,Wii reg,576969207265672E6B696361645F7063,rev?* 4 | G04 #@! TF.SameCoordinates,Original* 5 | G04 #@! TF.FileFunction,Profile,NP* 6 | %FSLAX46Y46*% 7 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 8 | G04 Created by KiCad (PCBNEW (5.0.1)-4) date 3/16/2019 12:44:05 PM* 9 | %MOMM*% 10 | %LPD*% 11 | G01* 12 | G04 APERTURE LIST* 13 | %ADD10C,0.150000*% 14 | G04 APERTURE END LIST* 15 | D10* 16 | X187990000Y-117390000D02* 17 | X231570000Y-117390000D01* 18 | X187990000Y-84490000D02* 19 | X187990000Y-117400000D01* 20 | X231570000Y-84490000D02* 21 | X187990000Y-84490000D01* 22 | X231570000Y-117390000D02* 23 | X231570000Y-84490000D01* 24 | M02* 25 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/NVM.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: NVM.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 15, 2019, 8:30 PM 6 | */ 7 | 8 | #include 9 | 10 | void EEPROM_WRITE_BYTE(unsigned char addr, char data) { 11 | INTCONbits.GIE = 0; 12 | NVMCON1bits.NVMREGS = 1; 13 | NVMCON1bits.WREN = 1; 14 | NVMADRH = 0xF0; 15 | NVMADRL = addr; 16 | NVMDATL = data; 17 | 18 | NVMCON2 = 0x55; 19 | NVMCON2 = 0xAA; 20 | NVMCON1bits.WR = 1; 21 | while(NVMCON1bits.WR); 22 | NVMCON1bits.WREN = 0; 23 | INTCONbits.GIE = 1; 24 | } 25 | 26 | char EEPROM_READ_BYTE(unsigned char addr) { 27 | char data; 28 | NVMCON1bits.NVMREGS = 1; 29 | NVMADRH = 0xF0; 30 | NVMADRL = addr; 31 | NVMCON1bits.RD = 1; 32 | data = NVMDATL; 33 | return data; 34 | } -------------------------------------------------------------------------------- /RGB LED pcb/RGB LED pcb.pro: -------------------------------------------------------------------------------- 1 | update=22/05/2015 07:44:53 2 | version=1 3 | last_client=kicad 4 | [general] 5 | version=1 6 | RootSch= 7 | BoardNm= 8 | [pcbnew] 9 | version=1 10 | LastNetListRead= 11 | UseCmpFile=1 12 | PadDrill=0.600000000000 13 | PadDrillOvalY=0.600000000000 14 | PadSizeH=1.500000000000 15 | PadSizeV=1.500000000000 16 | PcbTextSizeV=1.500000000000 17 | PcbTextSizeH=1.500000000000 18 | PcbTextThickness=0.300000000000 19 | ModuleTextSizeV=1.000000000000 20 | ModuleTextSizeH=1.000000000000 21 | ModuleTextSizeThickness=0.150000000000 22 | SolderMaskClearance=0.000000000000 23 | SolderMaskMinWidth=0.000000000000 24 | DrawSegmentWidth=0.200000000000 25 | BoardOutlineThickness=0.100000000000 26 | ModuleOutlineThickness=0.150000000000 27 | [cvpcb] 28 | version=1 29 | NetIExt=net 30 | [eeschema] 31 | version=1 32 | LibDir= 33 | [eeschema/libraries] 34 | -------------------------------------------------------------------------------- /RGB LED pcb/RGB LED pcb-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # Connector_TestPoint 5 | # 6 | DEF Connector_TestPoint TP 0 30 N N 1 F N 7 | F0 "TP" 0 270 50 H V C CNN 8 | F1 "Connector_TestPoint" 0 200 50 H V C CNN 9 | F2 "" 200 0 50 H I C CNN 10 | F3 "" 200 0 50 H I C CNN 11 | $FPLIST 12 | Pin* 13 | Test* 14 | $ENDFPLIST 15 | DRAW 16 | C 0 130 30 0 1 0 N 17 | X 1 1 0 0 100 U 50 50 1 1 P 18 | ENDDRAW 19 | ENDDEF 20 | # 21 | # Wiiboy_parts_LTST-C19HE1WT 22 | # 23 | DEF Wiiboy_parts_LTST-C19HE1WT U 0 40 Y Y 1 F N 24 | F0 "U" 50 -350 50 H V C CNN 25 | F1 "Wiiboy_parts_LTST-C19HE1WT" 300 -550 50 H V C CNN 26 | F2 "" 0 0 50 H I C CNN 27 | F3 "" 0 0 50 H I C CNN 28 | DRAW 29 | S -400 -300 -50 -800 0 1 0 N 30 | X RED 1 -300 -200 100 D 50 50 1 1 I 31 | X Green 2 -150 -200 100 D 50 50 1 1 I 32 | X Blue 3 -150 -900 100 U 50 50 1 1 I 33 | X Anode 4 -300 -900 100 U 50 50 1 1 I 34 | ENDDRAW 35 | ENDDEF 36 | # 37 | #End Library 38 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/private/configurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Makefile 4 | 0 5 | 6 | 7 | 8 | C:\Program Files (x86)\Microchip\xc8\v2.10\bin 9 | 10 | place holder 1 11 | place holder 2 12 | 13 | 14 | 15 | 16 | true 17 | 0 18 | 0 19 | 0 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/pic16f15324.bak: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # PIC16F15324 5 | # 6 | DEF PIC16F15324 U 0 40 Y Y 1 F N 7 | F0 "U" 650 400 60 H V C CNN 8 | F1 "PIC16F15324" 150 -100 60 H V C CNN 9 | F2 "" 0 550 60 H I C CNN 10 | F3 "" 0 550 60 H I C CNN 11 | DRAW 12 | S -450 450 750 -400 0 1 0 N 13 | X RA5 1 -650 200 200 R 50 50 1 1 I 14 | X RA4 2 -650 100 200 R 50 50 1 1 I 15 | X MCLR/RA3 3 -650 0 200 R 50 50 1 1 I 16 | X RC5 4 -650 -100 200 R 50 50 1 1 I 17 | X RC4 5 -50 -600 200 U 50 50 1 1 I 18 | X RC3 6 50 -600 200 U 50 50 1 1 I 19 | X RC2 7 150 -600 200 U 50 50 1 1 I 20 | X RC1 8 250 -600 200 U 50 50 1 1 I 21 | X RC0 9 950 -100 200 L 50 50 1 1 I 22 | X RA0/ICSPDAT ~ 950 200 200 L 50 50 1 1 I 23 | X RA2 10 950 0 200 L 50 50 1 1 I 24 | X RA1/ICSPCLK 11 950 100 200 L 50 50 1 1 I 25 | X VSS 13 250 650 200 D 50 50 1 1 I 26 | X NC 14 150 650 200 D 50 50 1 1 I 27 | X NC 15 50 650 200 D 50 50 1 1 I 28 | X VDD 16 -50 650 200 D 50 50 1 1 I 29 | X PAD 17 -150 650 200 D 50 50 1 1 I 30 | ENDDRAW 31 | ENDDEF 32 | # 33 | #End Library 34 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/pic16f15324.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # PIC16F15324 5 | # 6 | DEF PIC16F15324 U 0 40 Y Y 1 F N 7 | F0 "U" 650 400 60 H V C CNN 8 | F1 "PIC16F15324" 150 -100 60 H V C CNN 9 | F2 "" 0 550 60 H I C CNN 10 | F3 "" 0 550 60 H I C CNN 11 | DRAW 12 | S -450 450 750 -400 0 1 0 N 13 | X RA5 1 -650 200 200 R 50 50 1 1 I 14 | X RA4 2 -650 100 200 R 50 50 1 1 I 15 | X MCLR/RA3 3 -650 0 200 R 50 50 1 1 I 16 | X RC5 4 -650 -100 200 R 50 50 1 1 I 17 | X RC4 5 -50 -600 200 U 50 50 1 1 I 18 | X RC3 6 50 -600 200 U 50 50 1 1 I 19 | X RC2 7 150 -600 200 U 50 50 1 1 I 20 | X RC1 8 250 -600 200 U 50 50 1 1 I 21 | X RC0 9 950 -100 200 L 50 50 1 1 I 22 | X RA2 10 950 0 200 L 50 50 1 1 I 23 | X RA1/ICSPCLK 11 950 100 200 L 50 50 1 1 I 24 | X RA0/ICSPDAT 12 950 200 200 L 50 50 1 1 I 25 | X VSS 13 250 650 200 D 50 50 1 1 I 26 | X NC 14 150 650 200 D 50 50 1 1 I 27 | X NC 15 50 650 200 D 50 50 1 1 I 28 | X VDD 16 -50 650 200 D 50 50 1 1 I 29 | X PAD 17 -150 650 200 D 50 50 1 1 I 30 | ENDDRAW 31 | ENDDEF 32 | # 33 | #End Library 34 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/nbproject/private/configurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Makefile 4 | 0 5 | 6 | 7 | :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>900A:=<rev>0002:=<man>Microchip Technology Inc.:=<prod>PICkit 3:=<sn>BUR160609814:=<drv>x:=<xpt>h:=end 8 | C:\Program Files (x86)\Microchip\xc8\v2.10\bin 9 | 10 | place holder 1 11 | place holder 2 12 | 13 | 14 | 15 | 16 | true 17 | 0 18 | 0 19 | 0 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/stusb4500_nvm_config.h: -------------------------------------------------------------------------------- 1 | #ifndef STUSB4500_NVM_CONFIG_H 2 | #define STUSB4500_NVM_CONFIG_H 3 | 4 | // See Section 5.2 Table 16/17 5 | #define PDO_VOLTAGE(mV) mV / 50 6 | #define PDO_CURRENT(mA) (mA - 250) / 250 7 | #define PDO_CURRENT_FLEX(mA) mA / 10 8 | 9 | /* PDO1 Configuration */ 10 | // V_SNK_PDO1 fixed to 5V 11 | #define I_SNK_PDO1 PDO_CURRENT(1500) // mA, 25mA increments 12 | 13 | /* PDO2 Configuration */ 14 | #define V_SNK_PDO2 PDO_VOLTAGE(9000) // mV, 50mV increments 15 | #define I_SNK_PDO2 PDO_CURRENT(3000) // mA, 25mA increments 16 | 17 | /* PDO3 Configuration */ 18 | #define V_SNK_PDO3 PDO_VOLTAGE(12000) // mV, 50mV increments 19 | #define I_SNK_PDO3 PDO_CURRENT(2000) // mA, 25mA increments 20 | 21 | /* Misc Configuration */ 22 | #define I_SNK_PDO_FLEX \ 23 | PDO_CURRENT_FLEX(2000) // Global PDO current if I_SNK_PDOX = 0 24 | #define SNK_PDO_NUMB 3 // Number of valid PDOs (1, 2, or 3) 25 | #define REQ_SRC_CURRENT 1 // 1: SRC current, 0: PDO current 26 | #define POWER_ONLY_ABOVE_5V 0 // 1: > 5V negotiation required for output 27 | 28 | #endif // STUSB4500_NVM_CONFIG_H -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/i2c_driver_stusb4500.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: i2c.h 3 | * Author: jefflongo 4 | * Comments: PIC i2c driver 5 | */ 6 | 7 | #ifndef I2C_DRIVER_STUSB4500_H 8 | #define I2C_DRIVER_STUSB4500_H 9 | 10 | #include 11 | 12 | #define I2C_OK 0 13 | #define I2C_FAILURE -1 14 | 15 | #define I2C_ACK 0 16 | #define I2C_NACK 1 17 | 18 | #define _I2C_WRITE 0 19 | #define _I2C_READ 1 20 | 21 | void i2c_master_init(const unsigned long clk); 22 | int i2c_master_write( 23 | const uint8_t device, const uint8_t reg, const void* buf, uint16_t len); 24 | int i2c_master_write_u8( 25 | const uint8_t device, const uint8_t reg, const uint8_t data); 26 | int i2c_master_write_u16( 27 | const uint8_t device, const uint8_t reg, const uint16_t data); 28 | int i2c_master_write_u32( 29 | const uint8_t device, const uint8_t reg, const uint32_t data); 30 | int i2c_master_read( 31 | const uint8_t device, const uint8_t reg, void* buf, uint16_t len); 32 | int i2c_master_read_u8(const uint8_t device, const uint8_t reg, uint8_t* data); 33 | int i2c_master_read_u16( 34 | const uint8_t device, const uint8_t reg, uint16_t* data); 35 | int i2c_master_read_u32( 36 | const uint8_t device, const uint8_t reg, uint32_t* data); 37 | 38 | #endif // I2C_H -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/i2c_driver_stusb4500.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: i2c.h 3 | * Author: jefflongo 4 | * Comments: PIC i2c driver 5 | */ 6 | 7 | #ifndef I2C_DRIVER_STUSB4500_H 8 | #define I2C_DRIVER_STUSB4500_H 9 | 10 | #include 11 | 12 | #define I2C_OK 0 13 | #define I2C_FAILURE -1 14 | 15 | #define I2C_ACK 0 16 | #define I2C_NACK 1 17 | 18 | #define _I2C_WRITE 0 19 | #define _I2C_READ 1 20 | 21 | void i2c_master_init(const unsigned long clk); 22 | int i2c_master_write( 23 | const uint8_t device, const uint8_t reg, const void* buf, uint16_t len); 24 | int i2c_master_write_u8( 25 | const uint8_t device, const uint8_t reg, const uint8_t data); 26 | int i2c_master_write_u16( 27 | const uint8_t device, const uint8_t reg, const uint16_t data); 28 | int i2c_master_write_u32( 29 | const uint8_t device, const uint8_t reg, const uint32_t data); 30 | int i2c_master_read( 31 | const uint8_t device, const uint8_t reg, void* buf, uint16_t len); 32 | int i2c_master_read_u8(const uint8_t device, const uint8_t reg, uint8_t* data); 33 | int i2c_master_read_u16( 34 | const uint8_t device, const uint8_t reg, uint16_t* data); 35 | int i2c_master_read_u32( 36 | const uint8_t device, const uint8_t reg, uint32_t* data); 37 | 38 | #endif // I2C_H -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.microchip.mplab.nbide.embedded.makeproject 4 | 5 | 6 | RVLPMS_FIRMWARE 7 | 2f6d754d-fd12-4918-9a29-239a68a6df78 8 | 0 9 | c 10 | 11 | h 12 | 13 | ISO-8859-1 14 | 15 | 16 | ../STUSB4500-master 17 | 18 | 19 | 20 | default 21 | 2 22 | 23 | 24 | 25 | false 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.microchip.mplab.nbide.embedded.makeproject 4 | 5 | 6 | WiiPMS V2 7 | 2f6d754d-fd12-4918-9a29-239a68a6df78 8 | 0 9 | c 10 | 11 | h 12 | 13 | ISO-8859-1 14 | 15 | 16 | ../STUSB4500-master 17 | 18 | 19 | 20 | default 21 | 2 22 | 23 | 24 | 25 | false 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/compiler_support.i: -------------------------------------------------------------------------------- 1 | 2 | # 1 "C:\Program Files (x86)\Microchip\xc8\v2.10\pic\sources\c90\pic\compiler_support.c" 3 | 4 | # 1 5 | __persistent unsigned char __BTEMP12; 6 | __persistent unsigned char __BTEMP13; 7 | __persistent unsigned char __BTEMP14; 8 | __persistent unsigned char __BTEMP15; 9 | __persistent unsigned char __BTEMP16; 10 | __persistent unsigned char __BTEMP17; 11 | __persistent unsigned char __BTEMP18; 12 | __persistent unsigned char __BTEMP19; 13 | __persistent unsigned char __BTEMP20; 14 | __persistent unsigned char __BTEMP21; 15 | __persistent unsigned char __BTEMP22; 16 | __persistent unsigned char __BTEMP23; 17 | __persistent unsigned char __BTEMP24; 18 | __persistent unsigned char __BTEMP25; 19 | __persistent unsigned char __BTEMP26; 20 | __persistent unsigned char __BTEMP27; 21 | __persistent unsigned char __BTEMP28; 22 | __persistent unsigned char __BTEMP29; 23 | __persistent unsigned char __BTEMP30; 24 | __persistent unsigned char __BTEMP31; 25 | __persistent unsigned char __BTEMP32; 26 | __persistent unsigned char __BTEMP33; 27 | __persistent unsigned char __BTEMP34; 28 | __persistent unsigned char __BTEMP35; 29 | __persistent unsigned char __BTEMP36; 30 | __persistent unsigned char __BTEMP37; 31 | __persistent unsigned char __BTEMP38; 32 | __persistent unsigned char __BTEMP39; 33 | __persistent unsigned char __BTEMP40; 34 | __persistent unsigned char __BTEMP41; 35 | __persistent unsigned char __BTEMP42; 36 | __persistent unsigned char __BTEMP43; 37 | 38 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/compiler_support.i: -------------------------------------------------------------------------------- 1 | 2 | # 1 "C:\Program Files (x86)\Microchip\xc8\v2.10\pic\sources\c90\pic\compiler_support.c" 3 | 4 | # 1 5 | __persistent unsigned char __BTEMP12; 6 | __persistent unsigned char __BTEMP13; 7 | __persistent unsigned char __BTEMP14; 8 | __persistent unsigned char __BTEMP15; 9 | __persistent unsigned char __BTEMP16; 10 | __persistent unsigned char __BTEMP17; 11 | __persistent unsigned char __BTEMP18; 12 | __persistent unsigned char __BTEMP19; 13 | __persistent unsigned char __BTEMP20; 14 | __persistent unsigned char __BTEMP21; 15 | __persistent unsigned char __BTEMP22; 16 | __persistent unsigned char __BTEMP23; 17 | __persistent unsigned char __BTEMP24; 18 | __persistent unsigned char __BTEMP25; 19 | __persistent unsigned char __BTEMP26; 20 | __persistent unsigned char __BTEMP27; 21 | __persistent unsigned char __BTEMP28; 22 | __persistent unsigned char __BTEMP29; 23 | __persistent unsigned char __BTEMP30; 24 | __persistent unsigned char __BTEMP31; 25 | __persistent unsigned char __BTEMP32; 26 | __persistent unsigned char __BTEMP33; 27 | __persistent unsigned char __BTEMP34; 28 | __persistent unsigned char __BTEMP35; 29 | __persistent unsigned char __BTEMP36; 30 | __persistent unsigned char __BTEMP37; 31 | __persistent unsigned char __BTEMP38; 32 | __persistent unsigned char __BTEMP39; 33 | __persistent unsigned char __BTEMP40; 34 | __persistent unsigned char __BTEMP41; 35 | __persistent unsigned char __BTEMP42; 36 | __persistent unsigned char __BTEMP43; 37 | 38 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/nbproject/Package-default.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | # 4 | # Generated - do not edit! 5 | # 6 | 7 | # Macros 8 | TOP=`pwd` 9 | CND_CONF=default 10 | CND_DISTDIR=dist 11 | TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging 12 | TMPDIRNAME=tmp-packaging 13 | OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/RVLPMS_FIRMWARE.${IMAGE_TYPE}.${OUTPUT_SUFFIX} 14 | OUTPUT_BASENAME=RVLPMS_FIRMWARE.${IMAGE_TYPE}.${OUTPUT_SUFFIX} 15 | PACKAGE_TOP_DIR=rvlpmsfirmware/ 16 | 17 | # Functions 18 | function checkReturnCode 19 | { 20 | rc=$? 21 | if [ $rc != 0 ] 22 | then 23 | exit $rc 24 | fi 25 | } 26 | function makeDirectory 27 | # $1 directory path 28 | # $2 permission (optional) 29 | { 30 | mkdir -p "$1" 31 | checkReturnCode 32 | if [ "$2" != "" ] 33 | then 34 | chmod $2 "$1" 35 | checkReturnCode 36 | fi 37 | } 38 | function copyFileToTmpDir 39 | # $1 from-file path 40 | # $2 to-file path 41 | # $3 permission 42 | { 43 | cp "$1" "$2" 44 | checkReturnCode 45 | if [ "$3" != "" ] 46 | then 47 | chmod $3 "$2" 48 | checkReturnCode 49 | fi 50 | } 51 | 52 | # Setup 53 | cd "${TOP}" 54 | mkdir -p ${CND_DISTDIR}/${CND_CONF}/package 55 | rm -rf ${TMPDIR} 56 | mkdir -p ${TMPDIR} 57 | 58 | # Copy files and create directories and links 59 | cd "${TOP}" 60 | makeDirectory ${TMPDIR}/rvlpmsfirmware/bin 61 | copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 62 | 63 | 64 | # Generate tar file 65 | cd "${TOP}" 66 | rm -f ${CND_DISTDIR}/${CND_CONF}/package/rvlpmsfirmware.tar 67 | cd ${TMPDIR} 68 | tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/rvlpmsfirmware.tar * 69 | checkReturnCode 70 | 71 | # Cleanup 72 | cd "${TOP}" 73 | rm -rf ${TMPDIR} 74 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/Package-default.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | # 4 | # Generated - do not edit! 5 | # 6 | 7 | # Macros 8 | TOP=`pwd` 9 | CND_CONF=default 10 | CND_DISTDIR=dist 11 | TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging 12 | TMPDIRNAME=tmp-packaging 13 | OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/WiiPMS_V2.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} 14 | OUTPUT_BASENAME=WiiPMS_V2.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} 15 | PACKAGE_TOP_DIR=wiipmsv2.x/ 16 | 17 | # Functions 18 | function checkReturnCode 19 | { 20 | rc=$? 21 | if [ $rc != 0 ] 22 | then 23 | exit $rc 24 | fi 25 | } 26 | function makeDirectory 27 | # $1 directory path 28 | # $2 permission (optional) 29 | { 30 | mkdir -p "$1" 31 | checkReturnCode 32 | if [ "$2" != "" ] 33 | then 34 | chmod $2 "$1" 35 | checkReturnCode 36 | fi 37 | } 38 | function copyFileToTmpDir 39 | # $1 from-file path 40 | # $2 to-file path 41 | # $3 permission 42 | { 43 | cp "$1" "$2" 44 | checkReturnCode 45 | if [ "$3" != "" ] 46 | then 47 | chmod $3 "$2" 48 | checkReturnCode 49 | fi 50 | } 51 | 52 | # Setup 53 | cd "${TOP}" 54 | mkdir -p ${CND_DISTDIR}/${CND_CONF}/package 55 | rm -rf ${TMPDIR} 56 | mkdir -p ${TMPDIR} 57 | 58 | # Copy files and create directories and links 59 | cd "${TOP}" 60 | makeDirectory ${TMPDIR}/wiipmsv2.x/bin 61 | copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 62 | 63 | 64 | # Generate tar file 65 | cd "${TOP}" 66 | rm -f ${CND_DISTDIR}/${CND_CONF}/package/wiipmsv2.x.tar 67 | cd ${TMPDIR} 68 | tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/wiipmsv2.x.tar * 69 | checkReturnCode 70 | 71 | # Cleanup 72 | cd "${TOP}" 73 | rm -rf ${TMPDIR} 74 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/rescue-backup/Wii reg-2018-08-30-21-59-42.pro: -------------------------------------------------------------------------------- 1 | update=8/27/2018 7:05:44 PM 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [general] 27 | version=1 28 | [eeschema] 29 | version=1 30 | LibDir= 31 | [eeschema/libraries] 32 | LibName1=max6818 33 | LibName2=pic16f15324 34 | LibName3=C:/Users/turnquistg/Desktop/PowerS2/tps61230 35 | LibName4=C:/Users/turnquistg/Desktop/PowerS2/tlv62095 36 | LibName5=C:/Users/turnquistg/Desktop/PowerS2/bq25895m 37 | LibName6=power 38 | LibName7=device 39 | LibName8=switches 40 | LibName9=relays 41 | LibName10=motors 42 | LibName11=transistors 43 | LibName12=conn 44 | LibName13=linear 45 | LibName14=regul 46 | LibName15=74xx 47 | LibName16=cmos4000 48 | LibName17=adc-dac 49 | LibName18=memory 50 | LibName19=xilinx 51 | LibName20=microcontrollers 52 | LibName21=dsp 53 | LibName22=microchip 54 | LibName23=analog_switches 55 | LibName24=motorola 56 | LibName25=texas 57 | LibName26=intel 58 | LibName27=audio 59 | LibName28=interface 60 | LibName29=digital-audio 61 | LibName30=philips 62 | LibName31=display 63 | LibName32=cypress 64 | LibName33=siliconi 65 | LibName34=opto 66 | LibName35=atmel 67 | LibName36=contrib 68 | LibName37=valves 69 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/PWM.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PWM.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 13, 2019, 10:42 PM 6 | */ 7 | 8 | #include 9 | #include "PPS.h" 10 | 11 | void PWM_INIT() { 12 | 13 | PPS_unlock(); 14 | RC2PPS = 0x0B; //PWM3 15 | RC3PPS = 0x0C; //PWM4 16 | RC4PPS = 0x0D; //PWM5 17 | PPS_lock(); 18 | 19 | PWM3CON = 0; 20 | PR2 = 255; 21 | PWM3DCH = 0; 22 | PWM3DCL = 0b00111111; 23 | PWM3CON = 0b10000000; 24 | TRISCbits.TRISC2 = 0; 25 | PWM3CON = 0b11100000; 26 | 27 | PWM4CON = 0; 28 | PWM4DCH = 0; 29 | PWM4DCL = 0b00111111; 30 | PWM4CON = 0b10000000; 31 | TRISCbits.TRISC3 = 0; 32 | PWM4CON = 0b11100000; 33 | 34 | PWM5CON = 0; 35 | PWM5DCH = 0; 36 | PWM5DCL = 0b00111111; 37 | PWM5CON = 0b10000000; 38 | TRISCbits.TRISC4 = 0; 39 | PWM5CON = 0b11100000; 40 | 41 | //TIMER2 setup 42 | T2CLKCON = 0b00000011; //CLK is HFINTOSC 43 | TMR2ON = 1; //TMR2 ON 44 | T2CKPS0 = 0; //prescaler=16 45 | T2CKPS1 = 0; 46 | T2CKPS2 = 1; 47 | 48 | T2OUTPS0 = 1; //postscaler=16 49 | T2OUTPS1 = 1; 50 | T2OUTPS2 = 1; 51 | T2OUTPS3 = 1; 52 | 53 | TMR2 = 0; //set to 0 54 | PR2 = 255; //stop value 55 | TMR2IF = 0; //set flag to 0 56 | 57 | } 58 | 59 | void PWM_power_down() { 60 | //shutdown pwm 61 | PWM3DCH = 0; 62 | PWM4DCH = 0; 63 | PWM5DCH = 0; 64 | PWM3CONbits.EN = 0; 65 | PWM4CONbits.EN = 0; 66 | PWM5CONbits.EN = 0; 67 | RC2 = 0; 68 | RC3 = 0; 69 | RC4 = 0; 70 | } 71 | 72 | void PWM_power_up() { 73 | PWM3CONbits.EN = 1; 74 | PWM4CONbits.EN = 1; 75 | PWM5CONbits.EN = 1; 76 | } -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/PWM.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PWM.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 13, 2019, 10:42 PM 6 | */ 7 | 8 | #include 9 | #include "PPS.h" 10 | 11 | void PWM_INIT() { 12 | 13 | PPS_unlock(); 14 | RC2PPS = 0x0B; //PWM3 15 | RC3PPS = 0x0C; //PWM4 16 | RC4PPS = 0x0D; //PWM5 17 | PPS_lock(); 18 | 19 | PWM3CON = 0; 20 | PR2 = 255; 21 | PWM3DCH = 0; 22 | PWM3DCL = 0b00111111; 23 | PWM3CON = 0b10000000; 24 | TRISCbits.TRISC2 = 0; 25 | PWM3CON = 0b11110000; 26 | 27 | PWM4CON = 0; 28 | PWM4DCH = 0; 29 | PWM4DCL = 0b00111111; 30 | PWM4CON = 0b10000000; 31 | TRISCbits.TRISC3 = 0; 32 | PWM4CON = 0b11110000; 33 | 34 | PWM5CON = 0; 35 | PWM5DCH = 0; 36 | PWM5DCL = 0b00111111; 37 | PWM5CON = 0b10000000; 38 | TRISCbits.TRISC4 = 0; 39 | PWM5CON = 0b11110000; 40 | 41 | //TIMER2 setup 42 | T2CLKCON = 0b00000011; //CLK is HFINTOSC 43 | TMR2ON = 1; //TMR2 ON 44 | T2CKPS0 = 0; //prescaler=16 45 | T2CKPS1 = 0; 46 | T2CKPS2 = 1; 47 | 48 | T2OUTPS0 = 1; //postscaler=16 49 | T2OUTPS1 = 1; 50 | T2OUTPS2 = 1; 51 | T2OUTPS3 = 1; 52 | 53 | TMR2 = 0; //set to 0 54 | PR2 = 255; //stop value 55 | TMR2IF = 0; //set flag to 0 56 | 57 | } 58 | 59 | void PWM_power_down() { 60 | //shutdown pwm 61 | PWM3DCH = 0; 62 | PWM4DCH = 0; 63 | PWM5DCH = 0; 64 | PWM3CONbits.EN = 0; 65 | PWM4CONbits.EN = 0; 66 | PWM5CONbits.EN = 0; 67 | 68 | RC2 = 1; 69 | RC3 = 1; 70 | RC4 = 1; 71 | 72 | PPS_unlock(); 73 | RC2PPS = 0x00; //GPIO 74 | RC3PPS = 0x00; //GPIO 75 | RC4PPS = 0x00; //GPIO 76 | PPS_lock(); 77 | 78 | } -------------------------------------------------------------------------------- /RVL-PMS BOARD FILES/RVL-PMS HW2-rescue.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # Wii_reg-cache_Wii-reg-rescue_TPS61230-tps61230-N64_PMS-cache 5 | # 6 | DEF Wii_reg-cache_Wii-reg-rescue_TPS61230-tps61230-N64_PMS-cache U 0 40 Y Y 1 F N 7 | F0 "U" -50 -950 60 H V C CNN 8 | F1 "Wii_reg-cache_Wii-reg-rescue_TPS61230-tps61230-N64_PMS-cache" -50 -250 60 H V C CNN 9 | F2 "" 0 0 60 H I C CNN 10 | F3 "" 0 0 60 H I C CNN 11 | DRAW 12 | S -300 -300 200 -900 0 1 0 N 13 | X SW 1 -500 -450 200 R 50 50 1 1 I 14 | X VIN 10 400 -450 200 L 50 50 1 1 I 15 | X GND 11 400 -350 200 L 50 50 1 1 I 16 | X SW 2 -500 -550 200 R 50 50 1 1 I 17 | X VOUT 3 -500 -650 200 R 50 50 1 1 I 18 | X VOUT 4 -500 -750 200 R 50 50 1 1 I 19 | X PG 5 -500 -850 200 R 50 50 1 1 I 20 | X SS 6 400 -850 200 L 50 50 1 1 I 21 | X FB 7 400 -750 200 L 50 50 1 1 I 22 | X HSYS 8 400 -650 200 L 50 50 1 1 I 23 | X EN 9 400 -550 200 L 50 50 1 1 I 24 | ENDDRAW 25 | ENDDEF 26 | # 27 | # Wii_reg-cache_pic16f15324_PIC16F15324-N64_PMS-cache 28 | # 29 | DEF Wii_reg-cache_pic16f15324_PIC16F15324-N64_PMS-cache U 0 40 Y Y 1 F N 30 | F0 "U" 650 400 60 H V C CNN 31 | F1 "Wii_reg-cache_pic16f15324_PIC16F15324-N64_PMS-cache" 150 -100 60 H V C CNN 32 | F2 "" 0 550 60 H I C CNN 33 | F3 "" 0 550 60 H I C CNN 34 | DRAW 35 | S -450 450 750 -400 0 1 0 N 36 | X RA5 1 -650 200 200 R 50 50 1 1 I 37 | X RA2 10 950 0 200 L 50 50 1 1 I 38 | X RA1/ICSPCLK 11 950 100 200 L 50 50 1 1 I 39 | X RA0/ICSPDAT 12 950 200 200 L 50 50 1 1 I 40 | X VSS 13 250 650 200 D 50 50 1 1 I 41 | X NC 14 150 650 200 D 50 50 1 1 I 42 | X NC 15 50 650 200 D 50 50 1 1 I 43 | X VDD 16 -50 650 200 D 50 50 1 1 I 44 | X PAD 17 -150 650 200 D 50 50 1 1 I 45 | X RA4 2 -650 100 200 R 50 50 1 1 I 46 | X MCLR/RA3 3 -650 0 200 R 50 50 1 1 I 47 | X RC5 4 -650 -100 200 R 50 50 1 1 I 48 | X RC4 5 -50 -600 200 U 50 50 1 1 I 49 | X RC3 6 50 -600 200 U 50 50 1 1 I 50 | X RC2 7 150 -600 200 U 50 50 1 1 I 51 | X RC1 8 250 -600 200 U 50 50 1 1 I 52 | X RC0 9 950 -100 200 L 50 50 1 1 I 53 | ENDDRAW 54 | ENDDEF 55 | # 56 | #End Library 57 | -------------------------------------------------------------------------------- /RGB LED pcb/RGB LED pcb.bak: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 4 2 | LIBS:RGB LED pcb-cache 3 | EELAYER 26 0 4 | EELAYER END 5 | $Descr A4 11693 8268 6 | encoding utf-8 7 | Sheet 1 1 8 | Title "" 9 | Date "" 10 | Rev "" 11 | Comp "" 12 | Comment1 "" 13 | Comment2 "" 14 | Comment3 "" 15 | Comment4 "" 16 | $EndDescr 17 | $Comp 18 | L Wiiboy_parts:LTST-C19HE1WT U? 19 | U 1 1 5C51ABEB 20 | P 6350 2950 21 | F 0 "U?" H 6328 2446 50 0000 L CNN 22 | F 1 "LTST-C19HE1WT" H 6328 2355 50 0000 L CNN 23 | F 2 "" H 6350 2950 50 0001 C CNN 24 | F 3 "" H 6350 2950 50 0001 C CNN 25 | 1 6350 2950 26 | 1 0 0 -1 27 | $EndComp 28 | Text GLabel 6050 3150 1 50 Input ~ 0 29 | R 30 | Text GLabel 6200 3150 1 50 Input ~ 0 31 | G 32 | Text GLabel 6200 3850 3 50 Input ~ 0 33 | B 34 | Text GLabel 6050 3850 3 50 Input ~ 0 35 | A 36 | $Comp 37 | L Connector:TestPoint TP? 38 | U 1 1 5C55BCA8 39 | P 7150 3050 40 | F 0 "TP?" H 7208 3170 50 0000 L CNN 41 | F 1 "TestPoint" H 7208 3079 50 0000 L CNN 42 | F 2 "" H 7350 3050 50 0001 C CNN 43 | F 3 "~" H 7350 3050 50 0001 C CNN 44 | 1 7150 3050 45 | 1 0 0 -1 46 | $EndComp 47 | $Comp 48 | L Connector:TestPoint TP? 49 | U 1 1 5C55BCDA 50 | P 7600 3050 51 | F 0 "TP?" H 7658 3170 50 0000 L CNN 52 | F 1 "TestPoint" H 7658 3079 50 0000 L CNN 53 | F 2 "" H 7800 3050 50 0001 C CNN 54 | F 3 "~" H 7800 3050 50 0001 C CNN 55 | 1 7600 3050 56 | 1 0 0 -1 57 | $EndComp 58 | $Comp 59 | L Connector:TestPoint TP? 60 | U 1 1 5C55BD18 61 | P 8050 3050 62 | F 0 "TP?" H 8108 3170 50 0000 L CNN 63 | F 1 "TestPoint" H 8108 3079 50 0000 L CNN 64 | F 2 "" H 8250 3050 50 0001 C CNN 65 | F 3 "~" H 8250 3050 50 0001 C CNN 66 | 1 8050 3050 67 | 1 0 0 -1 68 | $EndComp 69 | $Comp 70 | L Connector:TestPoint TP? 71 | U 1 1 5C55BD64 72 | P 8500 3050 73 | F 0 "TP?" H 8558 3170 50 0000 L CNN 74 | F 1 "TestPoint" H 8558 3079 50 0000 L CNN 75 | F 2 "" H 8700 3050 50 0001 C CNN 76 | F 3 "~" H 8700 3050 50 0001 C CNN 77 | 1 8500 3050 78 | 1 0 0 -1 79 | $EndComp 80 | Text GLabel 7150 3050 3 50 Input ~ 0 81 | R 82 | Text GLabel 7600 3050 3 50 Input ~ 0 83 | G 84 | Text GLabel 8050 3050 3 50 Input ~ 0 85 | B 86 | Text GLabel 8500 3050 3 50 Input ~ 0 87 | A 88 | $EndSCHEMATC 89 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/nbproject/Makefile-impl.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated Makefile - do not edit! 3 | # 4 | # Edit the Makefile in the project folder instead (../Makefile). Each target 5 | # has a pre- and a post- target defined where you can add customization code. 6 | # 7 | # This makefile implements macros and targets common to all configurations. 8 | # 9 | # NOCDDL 10 | 11 | 12 | # Building and Cleaning subprojects are done by default, but can be controlled with the SUB 13 | # macro. If SUB=no, subprojects will not be built or cleaned. The following macro 14 | # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf 15 | # and .clean-reqprojects-conf unless SUB has the value 'no' 16 | SUB_no=NO 17 | SUBPROJECTS=${SUB_${SUB}} 18 | BUILD_SUBPROJECTS_=.build-subprojects 19 | BUILD_SUBPROJECTS_NO= 20 | BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} 21 | CLEAN_SUBPROJECTS_=.clean-subprojects 22 | CLEAN_SUBPROJECTS_NO= 23 | CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} 24 | 25 | 26 | # Project Name 27 | PROJECTNAME=RVLPMS_FIRMWARE 28 | 29 | # Active Configuration 30 | DEFAULTCONF=default 31 | CONF=${DEFAULTCONF} 32 | 33 | # All Configurations 34 | ALLCONFS=default 35 | 36 | 37 | # build 38 | .build-impl: .build-pre 39 | ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf 40 | 41 | 42 | # clean 43 | .clean-impl: .clean-pre 44 | ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf 45 | 46 | # clobber 47 | .clobber-impl: .clobber-pre .depcheck-impl 48 | ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean 49 | 50 | 51 | 52 | # all 53 | .all-impl: .all-pre .depcheck-impl 54 | ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build 55 | 56 | 57 | 58 | # dependency checking support 59 | .depcheck-impl: 60 | # @echo "# This code depends on make tool being used" >.dep.inc 61 | # @if [ -n "${MAKE_VERSION}" ]; then \ 62 | # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ 63 | # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ 64 | # echo "include \$${DEPFILES}" >>.dep.inc; \ 65 | # echo "endif" >>.dep.inc; \ 66 | # else \ 67 | # echo ".KEEP_STATE:" >>.dep.inc; \ 68 | # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ 69 | # fi 70 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/Makefile-impl.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated Makefile - do not edit! 3 | # 4 | # Edit the Makefile in the project folder instead (../Makefile). Each target 5 | # has a pre- and a post- target defined where you can add customization code. 6 | # 7 | # This makefile implements macros and targets common to all configurations. 8 | # 9 | # NOCDDL 10 | 11 | 12 | # Building and Cleaning subprojects are done by default, but can be controlled with the SUB 13 | # macro. If SUB=no, subprojects will not be built or cleaned. The following macro 14 | # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf 15 | # and .clean-reqprojects-conf unless SUB has the value 'no' 16 | SUB_no=NO 17 | SUBPROJECTS=${SUB_${SUB}} 18 | BUILD_SUBPROJECTS_=.build-subprojects 19 | BUILD_SUBPROJECTS_NO= 20 | BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} 21 | CLEAN_SUBPROJECTS_=.clean-subprojects 22 | CLEAN_SUBPROJECTS_NO= 23 | CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} 24 | 25 | 26 | # Project Name 27 | PROJECTNAME=WiiPMS V2.X 28 | 29 | # Active Configuration 30 | DEFAULTCONF=default 31 | CONF=${DEFAULTCONF} 32 | 33 | # All Configurations 34 | ALLCONFS=default 35 | 36 | 37 | # build 38 | .build-impl: .build-pre 39 | ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf 40 | 41 | 42 | # clean 43 | .clean-impl: .clean-pre 44 | ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf 45 | 46 | # clobber 47 | .clobber-impl: .clobber-pre .depcheck-impl 48 | ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean 49 | 50 | 51 | 52 | # all 53 | .all-impl: .all-pre .depcheck-impl 54 | ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build 55 | 56 | 57 | 58 | # dependency checking support 59 | .depcheck-impl: 60 | # @echo "# This code depends on make tool being used" >.dep.inc 61 | # @if [ -n "${MAKE_VERSION}" ]; then \ 62 | # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ 63 | # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ 64 | # echo "include \$${DEPFILES}" >>.dep.inc; \ 65 | # echo "endif" >>.dep.inc; \ 66 | # else \ 67 | # echo ".KEEP_STATE:" >>.dep.inc; \ 68 | # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ 69 | # fi 70 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/nbproject/Makefile-local-default.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated Makefile - do not edit! 3 | # 4 | # 5 | # This file contains information about the location of compilers and other tools. 6 | # If you commmit this file into your revision control server, you will be able to 7 | # to checkout the project and build it from the command line with make. However, 8 | # if more than one person works on the same project, then this file might show 9 | # conflicts since different users are bound to have compilers in different places. 10 | # In that case you might choose to not commit this file and let MPLAB X recreate this file 11 | # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at 12 | # least once so the file gets created and the project can be built. Finally, you can also 13 | # avoid using this file at all if you are only building from the command line with make. 14 | # You can invoke make with the values of the macros: 15 | # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... 16 | # 17 | SHELL=cmd.exe 18 | PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/ 19 | # Adding MPLAB X bin directory to path. 20 | PATH:=C:/Program Files (x86)/Microchip/MPLABX/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) 21 | # Path to java used to run MPLAB X when this makefile was created 22 | MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\v5.25\sys\java\jre1.8.0_181/bin/" 23 | OS_CURRENT="$(shell uname -s)" 24 | MP_CC="C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" 25 | # MP_CPPC is not defined 26 | # MP_BC is not defined 27 | MP_AS="C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" 28 | MP_LD="C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" 29 | MP_AR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-ar.exe" 30 | DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" 31 | MP_CC_DIR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin" 32 | # MP_CPPC_DIR is not defined 33 | # MP_BC_DIR is not defined 34 | MP_AS_DIR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin" 35 | MP_LD_DIR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin" 36 | MP_AR_DIR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin" 37 | # MP_BC_DIR is not defined 38 | -------------------------------------------------------------------------------- /RGB LED pcb/RGB LED pcb.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 4 2 | LIBS:RGB LED pcb-cache 3 | EELAYER 26 0 4 | EELAYER END 5 | $Descr A4 11693 8268 6 | encoding utf-8 7 | Sheet 1 1 8 | Title "" 9 | Date "" 10 | Rev "" 11 | Comp "" 12 | Comment1 "" 13 | Comment2 "" 14 | Comment3 "" 15 | Comment4 "" 16 | $EndDescr 17 | $Comp 18 | L Wiiboy_parts:LTST-C19HE1WT U1 19 | U 1 1 5C51ABEB 20 | P 6350 2950 21 | F 0 "U1" H 6328 2446 50 0000 L CNN 22 | F 1 "LTST-C19HE1WT" H 6328 2355 50 0000 L CNN 23 | F 2 "Wiiboy Parts:LTST-C19HE1WT" H 6350 2950 50 0001 C CNN 24 | F 3 "" H 6350 2950 50 0001 C CNN 25 | 1 6350 2950 26 | 1 0 0 -1 27 | $EndComp 28 | Text GLabel 6050 3150 1 50 Input ~ 0 29 | R 30 | Text GLabel 6200 3150 1 50 Input ~ 0 31 | G 32 | Text GLabel 6200 3850 3 50 Input ~ 0 33 | B 34 | Text GLabel 6050 3850 3 50 Input ~ 0 35 | A 36 | $Comp 37 | L Connector:TestPoint TP1 38 | U 1 1 5C55BCA8 39 | P 7150 3050 40 | F 0 "TP1" H 7208 3170 50 0000 L CNN 41 | F 1 "TestPoint" H 7208 3079 50 0000 L CNN 42 | F 2 "Wiiboy Parts:1.25mm pad" H 7350 3050 50 0001 C CNN 43 | F 3 "~" H 7350 3050 50 0001 C CNN 44 | 1 7150 3050 45 | 1 0 0 -1 46 | $EndComp 47 | $Comp 48 | L Connector:TestPoint TP2 49 | U 1 1 5C55BCDA 50 | P 7600 3050 51 | F 0 "TP2" H 7658 3170 50 0000 L CNN 52 | F 1 "TestPoint" H 7658 3079 50 0000 L CNN 53 | F 2 "Wiiboy Parts:1.25mm pad" H 7800 3050 50 0001 C CNN 54 | F 3 "~" H 7800 3050 50 0001 C CNN 55 | 1 7600 3050 56 | 1 0 0 -1 57 | $EndComp 58 | $Comp 59 | L Connector:TestPoint TP3 60 | U 1 1 5C55BD18 61 | P 8050 3050 62 | F 0 "TP3" H 8108 3170 50 0000 L CNN 63 | F 1 "TestPoint" H 8108 3079 50 0000 L CNN 64 | F 2 "Wiiboy Parts:1.25mm pad" H 8250 3050 50 0001 C CNN 65 | F 3 "~" H 8250 3050 50 0001 C CNN 66 | 1 8050 3050 67 | 1 0 0 -1 68 | $EndComp 69 | $Comp 70 | L Connector:TestPoint TP4 71 | U 1 1 5C55BD64 72 | P 8500 3050 73 | F 0 "TP4" H 8558 3170 50 0000 L CNN 74 | F 1 "TestPoint" H 8558 3079 50 0000 L CNN 75 | F 2 "Wiiboy Parts:1.25mm pad" H 8700 3050 50 0001 C CNN 76 | F 3 "~" H 8700 3050 50 0001 C CNN 77 | 1 8500 3050 78 | 1 0 0 -1 79 | $EndComp 80 | Text GLabel 7150 3050 3 50 Input ~ 0 81 | R 82 | Text GLabel 7600 3050 3 50 Input ~ 0 83 | G 84 | Text GLabel 8050 3050 3 50 Input ~ 0 85 | B 86 | Text GLabel 8500 3050 3 50 Input ~ 0 87 | A 88 | $EndSCHEMATC 89 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/nbproject/Makefile-local-default.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated Makefile - do not edit! 3 | # 4 | # 5 | # This file contains information about the location of compilers and other tools. 6 | # If you commmit this file into your revision control server, you will be able to 7 | # to checkout the project and build it from the command line with make. However, 8 | # if more than one person works on the same project, then this file might show 9 | # conflicts since different users are bound to have compilers in different places. 10 | # In that case you might choose to not commit this file and let MPLAB X recreate this file 11 | # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at 12 | # least once so the file gets created and the project can be built. Finally, you can also 13 | # avoid using this file at all if you are only building from the command line with make. 14 | # You can invoke make with the values of the macros: 15 | # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... 16 | # 17 | SHELL=cmd.exe 18 | PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/ 19 | # Adding MPLAB X bin directory to path. 20 | PATH:=C:/Program Files (x86)/Microchip/MPLABX/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) 21 | # Path to java used to run MPLAB X when this makefile was created 22 | MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\v5.25\sys\java\jre1.8.0_181/bin/" 23 | OS_CURRENT="$(shell uname -s)" 24 | MP_CC="C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" 25 | # MP_CPPC is not defined 26 | # MP_BC is not defined 27 | MP_AS="C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" 28 | MP_LD="C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" 29 | MP_AR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-ar.exe" 30 | DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" 31 | MP_CC_DIR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin" 32 | # MP_CPPC_DIR is not defined 33 | # MP_BC_DIR is not defined 34 | MP_AS_DIR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin" 35 | MP_LD_DIR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin" 36 | MP_AR_DIR="C:\Program Files (x86)\Microchip\xc8\v2.10\bin" 37 | # MP_BC_DIR is not defined 38 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/I2C.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: I2C.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 14, 2019, 12:07 AM 6 | */ 7 | 8 | #include 9 | #include "PICCONFIG.h" 10 | #include "I2C.h" 11 | 12 | void I2C_bus_reset() { 13 | 14 | SCL_OUTPUT_TRIS = 1; 15 | SDA_OUTPUT_TRIS = 1; 16 | 17 | char i = 0; 18 | 19 | while(i < 10) { 20 | i++; 21 | while(1) { 22 | if(!SDA) { 23 | //pulse SCL 24 | SCL_OUTPUT_TRIS = 0; //SCL low 25 | SCL = 0; 26 | __delay_ms(1); 27 | SCL_OUTPUT_TRIS = 1; //SCL high 28 | __delay_ms(1); 29 | } 30 | if(SDA) { 31 | //stop sequence 32 | SDA_OUTPUT_TRIS = 0; //SDA low 33 | SDA = 0; 34 | __delay_ms(1); 35 | SDA_OUTPUT_TRIS = 1; //SDA high 36 | __delay_ms(1); 37 | if(SDA) { 38 | break; 39 | } 40 | } 41 | } 42 | } 43 | } 44 | 45 | void I2C_Master_Init(const unsigned long clk) 46 | { 47 | SSP1CON1 = 0b00101000; 48 | SSP1CON2 = 0x00; 49 | SSP1ADD = (_XTAL_FREQ / (4*clk)) - 1; 50 | SSP1STAT = 0b10000000; 51 | } 52 | 53 | void I2C_Master_Wait() 54 | { 55 | while ((SSP1STAT & 0x04) || (SSP1CON2 & 0x1F)); 56 | } 57 | 58 | void I2C_Master_Start() 59 | { 60 | I2C_Master_Wait(); 61 | SSP1CON2bits.SEN = 1; 62 | } 63 | 64 | void I2C_Master_Repeated_Start() 65 | { 66 | I2C_Master_Wait(); 67 | SSP1CON2bits.RSEN = 1; 68 | } 69 | 70 | void I2C_Master_Stop() 71 | { 72 | I2C_Master_Wait(); 73 | SSP1CON2bits.PEN = 1; 74 | } 75 | 76 | void I2C_Master_Write(unsigned char data) 77 | { 78 | I2C_Master_Wait(); 79 | SSP1BUF = data; 80 | } 81 | 82 | void I2C_Master_Ack() 83 | { 84 | SSP1CON2bits.ACKDT = 0; 85 | SSP1CON2bits.ACKEN = 1; 86 | } 87 | 88 | void I2C_Master_nAck() 89 | { 90 | SSP1CON2bits.ACKDT = 1; 91 | SSP1CON2bits.ACKEN = 1; 92 | } 93 | 94 | unsigned char I2C_Master_Read(char ack) 95 | { 96 | I2C_Master_Wait(); 97 | SSP1CON2bits.RCEN = 1; 98 | I2C_Master_Wait(); 99 | 100 | unsigned char data = SSP1BUF; 101 | I2C_Master_Wait(); 102 | 103 | if (ack) 104 | I2C_Master_nAck(); 105 | else 106 | I2C_Master_Ack(); 107 | 108 | return data; 109 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/I2C.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: I2C.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 14, 2019, 12:07 AM 6 | */ 7 | 8 | #include 9 | #include "PICCONFIG.h" 10 | #include "I2C.h" 11 | 12 | void I2C_bus_reset() { 13 | 14 | SCL_OUTPUT_TRIS = 1; 15 | SDA_OUTPUT_TRIS = 1; 16 | 17 | char i = 0; 18 | 19 | while(i < 10) { 20 | i++; 21 | while(1) { 22 | if(!SDA) { 23 | //pulse SCL 24 | SCL_OUTPUT_TRIS = 0; //SCL low 25 | SCL = 0; 26 | __delay_ms(1); 27 | SCL_OUTPUT_TRIS = 1; //SCL high 28 | __delay_ms(1); 29 | } 30 | if(SDA) { 31 | //stop sequence 32 | SDA_OUTPUT_TRIS = 0; //SDA low 33 | SDA = 0; 34 | __delay_ms(1); 35 | SDA_OUTPUT_TRIS = 1; //SDA high 36 | __delay_ms(1); 37 | if(SDA) { 38 | break; 39 | } 40 | } 41 | } 42 | } 43 | } 44 | 45 | void I2C_Master_Init(const unsigned long clk) 46 | { 47 | SSP1CON1 = 0b00101000; 48 | SSP1CON2 = 0x00; 49 | SSP1ADD = (_XTAL_FREQ / (4*clk)) - 1; 50 | SSP1STAT = 0b10000000; 51 | } 52 | 53 | void I2C_Master_Wait() 54 | { 55 | while ((SSP1STAT & 0x04) || (SSP1CON2 & 0x1F)); 56 | } 57 | 58 | void I2C_Master_Start() 59 | { 60 | I2C_Master_Wait(); 61 | SSP1CON2bits.SEN = 1; 62 | } 63 | 64 | void I2C_Master_Repeated_Start() 65 | { 66 | I2C_Master_Wait(); 67 | SSP1CON2bits.RSEN = 1; 68 | } 69 | 70 | void I2C_Master_Stop() 71 | { 72 | I2C_Master_Wait(); 73 | SSP1CON2bits.PEN = 1; 74 | } 75 | 76 | void I2C_Master_Write(unsigned char data) 77 | { 78 | I2C_Master_Wait(); 79 | SSP1BUF = data; 80 | } 81 | 82 | void I2C_Master_Ack() 83 | { 84 | SSP1CON2bits.ACKDT = 0; 85 | SSP1CON2bits.ACKEN = 1; 86 | } 87 | 88 | void I2C_Master_nAck() 89 | { 90 | SSP1CON2bits.ACKDT = 1; 91 | SSP1CON2bits.ACKEN = 1; 92 | } 93 | 94 | unsigned char I2C_Master_Read(char ack) 95 | { 96 | I2C_Master_Wait(); 97 | SSP1CON2bits.RCEN = 1; 98 | I2C_Master_Wait(); 99 | 100 | unsigned char data = SSP1BUF; 101 | I2C_Master_Wait(); 102 | 103 | if (ack) 104 | I2C_Master_nAck(); 105 | else 106 | I2C_Master_Ack(); 107 | 108 | return data; 109 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS Gerber files/Wii reg.drl: -------------------------------------------------------------------------------- 1 | M48 2 | ;DRILL file {KiCad (5.0.1)-4} date 3/16/2019 12:44:09 PM 3 | ;FORMAT={-:-/ absolute / inch / decimal} 4 | FMAT,2 5 | INCH,TZ 6 | T1C0.0118 7 | T2C0.0157 8 | T3C0.0256 9 | T4C0.0866 10 | % 11 | G90 12 | G05 13 | M72 14 | T1 15 | X8.7854Y-3.8598 16 | X8.7854Y-3.8992 17 | X8.815Y-3.8795 18 | X8.8445Y-3.8598 19 | X8.8445Y-3.8992 20 | X8.6248Y-4.3028 21 | X8.6248Y-4.3421 22 | X8.6445Y-4.3224 23 | X8.6642Y-4.3028 24 | X8.6642Y-4.3421 25 | X7.8949Y-3.6087 26 | X7.8949Y-3.648 27 | X7.9146Y-3.6283 28 | X7.9343Y-3.6087 29 | X7.9343Y-3.648 30 | X8.85Y-3.6083 31 | X8.85Y-3.6476 32 | X8.8697Y-3.628 33 | X8.8894Y-3.6083 34 | X8.8894Y-3.6476 35 | X8.3811Y-3.6087 36 | X8.3811Y-3.648 37 | X8.4008Y-3.6283 38 | X8.4205Y-3.6087 39 | X8.4205Y-3.648 40 | T2 41 | X7.4465Y-3.7075 42 | X7.4626Y-4.3197 43 | X7.5449Y-3.9878 44 | X7.5449Y-4.0189 45 | X7.5945Y-4.3281 46 | X7.5994Y-4.4049 47 | X7.6154Y-4.4713 48 | X7.6406Y-4.2732 49 | X7.6803Y-3.989 50 | X7.6872Y-4.34 51 | X7.6872Y-4.3931 52 | X7.6909Y-3.4169 53 | X7.6909Y-4.2453 54 | X7.7098Y-4.5571 55 | X7.7138Y-3.752 56 | X7.7358Y-4.2417 57 | X7.7404Y-4.34 58 | X7.7404Y-4.3931 59 | X7.787Y-4.4484 60 | X7.8008Y-4.5894 61 | X7.8154Y-3.6382 62 | X7.8248Y-3.9898 63 | X7.8335Y-4.2862 64 | X7.8398Y-4.3618 65 | X7.8406Y-4.4366 66 | X7.8409Y-4.3988 67 | X7.8579Y-4.0252 68 | X7.8752Y-4.3587 69 | X7.8961Y-4.4531 70 | X7.937Y-4.4543 71 | X7.9689Y-3.5496 72 | X8.0039Y-3.4555 73 | X8.0039Y-3.4866 74 | X8.0075Y-4.1886 75 | X8.0075Y-4.2398 76 | X8.015Y-4.0693 77 | X8.0248Y-3.6516 78 | X8.0248Y-3.6831 79 | X8.0354Y-3.4551 80 | X8.0354Y-3.4866 81 | X8.0559Y-3.652 82 | X8.0559Y-3.6831 83 | X8.0587Y-4.1886 84 | X8.0587Y-4.2398 85 | X8.1177Y-4.476 86 | X8.1504Y-4.1232 87 | X8.1504Y-4.1547 88 | X8.1882Y-3.4232 89 | X8.1957Y-3.7528 90 | X8.1972Y-4.0913 91 | X8.2756Y-4.0913 92 | X8.3004Y-3.6382 93 | X8.337Y-4.4441 94 | X8.337Y-4.4756 95 | X8.3535Y-4.0913 96 | X8.3685Y-4.4445 97 | X8.3685Y-4.4756 98 | X8.4Y-4.4445 99 | X8.4Y-4.4756 100 | X8.4543Y-3.5476 101 | X8.4626Y-3.889 102 | X8.4626Y-3.9205 103 | X8.4626Y-3.952 104 | X8.4862Y-3.4874 105 | X8.4866Y-3.4559 106 | X8.4941Y-3.889 107 | X8.4941Y-3.9205 108 | X8.4941Y-3.9516 109 | X8.5051Y-3.6516 110 | X8.5051Y-3.6831 111 | X8.5181Y-3.4559 112 | X8.5181Y-3.4874 113 | X8.5256Y-3.889 114 | X8.5256Y-3.9205 115 | X8.5256Y-3.952 116 | X8.5366Y-3.652 117 | X8.5366Y-3.6831 118 | X8.5602Y-3.737 119 | X8.5602Y-3.7685 120 | X8.5811Y-4.3929 121 | X8.5917Y-3.737 122 | X8.5917Y-3.7685 123 | X8.6583Y-3.422 124 | X8.6591Y-3.7512 125 | X8.7398Y-4.3126 126 | X8.7748Y-3.6378 127 | X8.7795Y-3.7752 128 | X8.8146Y-3.7748 129 | X8.848Y-4.2008 130 | X8.8697Y-4.5283 131 | X8.922Y-3.5453 132 | X8.9295Y-3.9579 133 | X8.9425Y-3.8669 134 | X8.9429Y-3.8354 135 | X8.9469Y-4.1843 136 | X8.9469Y-4.2157 137 | X8.9469Y-4.2476 138 | X8.9646Y-3.4484 139 | X8.9646Y-3.4799 140 | X8.9724Y-3.6512 141 | X8.9724Y-3.6827 142 | X8.974Y-3.8354 143 | X8.974Y-3.8669 144 | X8.978Y-4.1854 145 | X8.978Y-4.2165 146 | X8.978Y-4.2476 147 | X9.0039Y-3.6516 148 | X9.0039Y-3.6827 149 | T3 150 | X7.8839Y-4.5535 151 | X7.9339Y-4.5535 152 | X7.9839Y-4.5535 153 | X8.0339Y-4.5535 154 | X8.0839Y-4.5535 155 | T4 156 | X9.0315Y-3.4114 157 | X9.0319Y-4.5362 158 | X7.4862Y-4.537 159 | X7.4866Y-3.4122 160 | T0 161 | M30 162 | -------------------------------------------------------------------------------- /RVL-PMS_GERBERS/RVL-PMS HW2-PTH.drl: -------------------------------------------------------------------------------- 1 | M48 2 | ; DRILL file {KiCad (5.1.4)-1} date 9/18/2020 11:06:03 AM 3 | ; FORMAT={-:-/ absolute / inch / decimal} 4 | ; #@! TF.CreationDate,2020-09-18T11:06:03-04:00 5 | ; #@! TF.GenerationSoftware,Kicad,Pcbnew,(5.1.4)-1 6 | ; #@! TF.FileFunction,Plated,1,4,PTH 7 | FMAT,2 8 | INCH 9 | T1C0.0079 10 | T2C0.0118 11 | T3C0.0157 12 | T4C0.0256 13 | % 14 | G90 15 | G05 16 | T1 17 | X4.8002Y-2.9715 18 | X5.1886Y-2.397 19 | X5.6323Y-2.399 20 | X5.6323Y-2.4455 21 | X5.6787Y-2.399 22 | X5.6787Y-2.4455 23 | X5.4197Y-3.1264 24 | X5.4197Y-3.1728 25 | X5.4661Y-3.1264 26 | X5.4661Y-3.1728 27 | X4.8002Y-2.9281 28 | X4.8002Y-3.0148 29 | X4.8435Y-2.9281 30 | X4.8435Y-2.9715 31 | X4.8435Y-3.0148 32 | X4.8868Y-2.9281 33 | X4.8868Y-2.9715 34 | X4.8868Y-3.0148 35 | X5.1421Y-2.397 36 | X5.1421Y-2.4435 37 | X5.1886Y-2.4435 38 | X4.648Y-2.3961 39 | X4.648Y-2.4425 40 | X4.6945Y-2.3961 41 | X4.6945Y-2.4425 42 | T2 43 | X5.5921Y-2.6848 44 | X5.5921Y-2.7226 45 | X5.626Y-2.7037 46 | X5.6598Y-2.6848 47 | X5.6598Y-2.7226 48 | T3 49 | X4.2524Y-2.7205 50 | X4.315Y-3.0453 51 | X4.3189Y-2.3583 52 | X4.3376Y-3.1752 53 | X4.3632Y-2.751 54 | X4.3829Y-3.06 55 | X4.3878Y-3.3307 56 | X4.4026Y-3.2628 57 | X4.4065Y-2.751 58 | X4.4193Y-2.5384 59 | X4.4528Y-2.751 60 | X4.4675Y-2.2313 61 | X4.4803Y-3.0226 62 | X4.5207Y-3.1535 63 | X4.5236Y-3.0217 64 | X4.5541Y-2.439 65 | X4.5886Y-2.7028 66 | X4.5886Y-2.7421 67 | X4.6029Y-3.2608 68 | X4.626Y-2.9843 69 | X4.6289Y-2.7028 70 | X4.6289Y-2.7421 71 | X4.6683Y-2.7421 72 | X4.669Y-3.1942 73 | X4.6693Y-2.7028 74 | X4.6713Y-3.1157 75 | X4.6724Y-3.155 76 | X4.7195Y-3.0837 77 | X4.7411Y-2.3356 78 | X4.752Y-2.2431 79 | X4.752Y-2.2825 80 | X4.7628Y-3.189 81 | X4.7854Y-2.4528 82 | X4.7854Y-2.4921 83 | X4.7913Y-2.2431 84 | X4.7913Y-2.2825 85 | X4.8091Y-3.2589 86 | X4.81Y-2.8396 87 | X4.8248Y-2.4528 88 | X4.8248Y-2.4921 89 | X4.9104Y-2.5384 90 | X4.94Y-3.2303 91 | X4.9518Y-2.2293 92 | X4.9537Y-2.8652 93 | X5.0413Y-2.8642 94 | X5.0522Y-2.4419 95 | X5.0823Y-2.5366 96 | X5.1191Y-3.1476 97 | X5.1191Y-3.187 98 | X5.1299Y-2.8652 99 | X5.1594Y-3.1476 100 | X5.1594Y-3.187 101 | X5.1988Y-3.187 102 | X5.1998Y-3.1476 103 | X5.2362Y-2.252 104 | X5.2362Y-2.2913 105 | X5.2382Y-2.3366 106 | X5.2598Y-2.7175 107 | X5.2598Y-2.7569 108 | X5.2598Y-2.7972 109 | X5.2756Y-2.252 110 | X5.2756Y-2.2913 111 | X5.2795Y-2.4557 112 | X5.2795Y-2.4951 113 | X5.2894Y-3.0768 114 | X5.2894Y-3.1161 115 | X5.2992Y-2.7175 116 | X5.2992Y-2.7569 117 | X5.2992Y-2.7972 118 | X5.3189Y-2.4557 119 | X5.3189Y-2.4951 120 | X5.3287Y-3.0768 121 | X5.3287Y-3.1161 122 | X5.3386Y-2.7175 123 | X5.3386Y-2.7569 124 | X5.3386Y-2.7972 125 | X5.3652Y-3.2343 126 | X5.3967Y-2.5463 127 | X5.4409Y-2.2293 128 | X5.5187Y-3.0226 129 | X5.5413Y-2.4429 130 | X5.5571Y-3.1299 131 | X5.5713Y-2.5461 132 | X5.6073Y-2.5994 133 | X5.6516Y-2.5994 134 | X5.6673Y-3.3425 135 | X5.689Y-3.0226 136 | X5.7293Y-2.3337 137 | X5.748Y-2.6132 138 | X5.748Y-2.6526 139 | X5.752Y-3.0049 140 | X5.752Y-3.0443 141 | X5.7687Y-2.4567 142 | X5.7687Y-2.4961 143 | X5.7874Y-2.6132 144 | X5.7874Y-2.6526 145 | X5.7913Y-3.0049 146 | X5.7913Y-3.0443 147 | X5.7925Y-2.7843 148 | X5.8081Y-2.4567 149 | X5.8081Y-2.4961 150 | T4 151 | X4.6191Y-3.3691 152 | X4.6691Y-3.3691 153 | X4.7191Y-3.3691 154 | X4.7691Y-3.3691 155 | X4.8191Y-3.3691 156 | T0 157 | M30 158 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (lib (name max6818)(type Legacy)(uri ${KIPRJMOD}/max6818.lib)(options "")(descr "")) 3 | (lib (name pic16f15324)(type Legacy)(uri ${KIPRJMOD}/pic16f15324.lib)(options "")(descr "")) 4 | (lib (name tps61230)(type Legacy)(uri C:/Users/turnquistg/Desktop/PowerS2/tps61230.lib)(options "")(descr "")) 5 | (lib (name tlv62095)(type Legacy)(uri C:/Users/turnquistg/Desktop/PowerS2/tlv62095.lib)(options "")(descr "")) 6 | (lib (name bq25895m)(type Legacy)(uri C:/Users/turnquistg/Desktop/PowerS2/bq25895m.lib)(options "")(descr "")) 7 | (lib (name switches)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/switches.lib)(options "")(descr "")) 8 | (lib (name relays)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/relays.lib)(options "")(descr "")) 9 | (lib (name motors)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/motors.lib)(options "")(descr "")) 10 | (lib (name transistors)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/transistors.lib)(options "")(descr "")) 11 | (lib (name conn)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/conn.lib)(options "")(descr "")) 12 | (lib (name linear)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/linear.lib)(options "")(descr "")) 13 | (lib (name regul)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/regul.lib)(options "")(descr "")) 14 | (lib (name cmos4000)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/cmos4000.lib)(options "")(descr "")) 15 | (lib (name adc-dac)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/adc-dac.lib)(options "")(descr "")) 16 | (lib (name memory)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/memory.lib)(options "")(descr "")) 17 | (lib (name xilinx)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/xilinx.lib)(options "")(descr "")) 18 | (lib (name microcontrollers)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/microcontrollers.lib)(options "")(descr "")) 19 | (lib (name dsp)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/dsp.lib)(options "")(descr "")) 20 | (lib (name microchip)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/microchip.lib)(options "")(descr "")) 21 | (lib (name analog_switches)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/analog_switches.lib)(options "")(descr "")) 22 | (lib (name motorola)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/motorola.lib)(options "")(descr "")) 23 | (lib (name texas)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/texas.lib)(options "")(descr "")) 24 | (lib (name intel)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/intel.lib)(options "")(descr "")) 25 | (lib (name digital-audio)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/digital-audio.lib)(options "")(descr "")) 26 | (lib (name philips)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/philips.lib)(options "")(descr "")) 27 | (lib (name display)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/display.lib)(options "")(descr "")) 28 | (lib (name cypress)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/cypress.lib)(options "")(descr "")) 29 | (lib (name siliconi)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/siliconi.lib)(options "")(descr "")) 30 | (lib (name opto)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/opto.lib)(options "")(descr "")) 31 | (lib (name atmel)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/atmel.lib)(options "")(descr "")) 32 | (lib (name contrib)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/contrib.lib)(options "")(descr "")) 33 | (lib (name valves)(type Legacy)(uri ${KICAD_SYMBOL_DIR}/valves.lib)(options "")(descr "")) 34 | (lib (name Wii-reg-rescue)(type Legacy)(uri "${KIPRJMOD}/Wii reg-rescue.lib")(options "")(descr "")) 35 | ) 36 | -------------------------------------------------------------------------------- /RGB LED pcb/RGB LED pcb.net: -------------------------------------------------------------------------------- 1 | (export (version D) 2 | (design 3 | (source "C:\\Users\\turnquistg\\OneDrive - Wentworth Institute of Technology\\Desktop\\Wiiboy PCBs\\RGB LED pcb\\RGB LED pcb.sch") 4 | (date "2/2/2019 11:00:43 AM") 5 | (tool "Eeschema (5.0.1)-4") 6 | (sheet (number 1) (name /) (tstamps /) 7 | (title_block 8 | (title) 9 | (company) 10 | (rev) 11 | (date) 12 | (source "RGB LED pcb.sch") 13 | (comment (number 1) (value "")) 14 | (comment (number 2) (value "")) 15 | (comment (number 3) (value "")) 16 | (comment (number 4) (value ""))))) 17 | (components 18 | (comp (ref U1) 19 | (value LTST-C19HE1WT) 20 | (footprint "Wiiboy Parts:LTST-C19HE1WT") 21 | (libsource (lib Wiiboy_parts) (part LTST-C19HE1WT) (description "")) 22 | (sheetpath (names /) (tstamps /)) 23 | (tstamp 5C51ABEB)) 24 | (comp (ref TP1) 25 | (value TestPoint) 26 | (footprint "Wiiboy Parts:1.25mm pad") 27 | (datasheet ~) 28 | (libsource (lib Connector) (part TestPoint) (description "test point")) 29 | (sheetpath (names /) (tstamps /)) 30 | (tstamp 5C55BCA8)) 31 | (comp (ref TP2) 32 | (value TestPoint) 33 | (footprint "Wiiboy Parts:1.25mm pad") 34 | (datasheet ~) 35 | (libsource (lib Connector) (part TestPoint) (description "test point")) 36 | (sheetpath (names /) (tstamps /)) 37 | (tstamp 5C55BCDA)) 38 | (comp (ref TP3) 39 | (value TestPoint) 40 | (footprint "Wiiboy Parts:1.25mm pad") 41 | (datasheet ~) 42 | (libsource (lib Connector) (part TestPoint) (description "test point")) 43 | (sheetpath (names /) (tstamps /)) 44 | (tstamp 5C55BD18)) 45 | (comp (ref TP4) 46 | (value TestPoint) 47 | (footprint "Wiiboy Parts:1.25mm pad") 48 | (datasheet ~) 49 | (libsource (lib Connector) (part TestPoint) (description "test point")) 50 | (sheetpath (names /) (tstamps /)) 51 | (tstamp 5C55BD64))) 52 | (libparts 53 | (libpart (lib Connector) (part TestPoint) 54 | (description "test point") 55 | (docs ~) 56 | (footprints 57 | (fp Pin*) 58 | (fp Test*)) 59 | (fields 60 | (field (name Reference) TP) 61 | (field (name Value) TestPoint)) 62 | (pins 63 | (pin (num 1) (name 1) (type passive)))) 64 | (libpart (lib Wiiboy_parts) (part LTST-C19HE1WT) 65 | (fields 66 | (field (name Reference) U) 67 | (field (name Value) LTST-C19HE1WT)) 68 | (pins 69 | (pin (num 1) (name RED) (type input)) 70 | (pin (num 2) (name Green) (type input)) 71 | (pin (num 3) (name Blue) (type input)) 72 | (pin (num 4) (name Anode) (type input))))) 73 | (libraries 74 | (library (logical Connector) 75 | (uri "C:\\Program Files\\KiCad\\share\\kicad\\library/Connector.lib")) 76 | (library (logical Wiiboy_parts) 77 | (uri "C:\\Users\\turnquistg\\OneDrive - Wentworth Institute of Technology\\Desktop\\Wiiboy PCBs\\RGB LED pcb/Wiiboy_parts.lib"))) 78 | (nets 79 | (net (code 1) (name R) 80 | (node (ref U1) (pin 1)) 81 | (node (ref TP1) (pin 1))) 82 | (net (code 2) (name G) 83 | (node (ref U1) (pin 2)) 84 | (node (ref TP2) (pin 1))) 85 | (net (code 3) (name B) 86 | (node (ref U1) (pin 3)) 87 | (node (ref TP3) (pin 1))) 88 | (net (code 4) (name A) 89 | (node (ref U1) (pin 4)) 90 | (node (ref TP4) (pin 1))))) -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/PICCONFIG.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PICCONFIG.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef PICCONFIG_H 9 | #define PICCONFIG_H 10 | 11 | // PIC16F15324 Configuration Bit Settings 12 | 13 | #define _XTAL_FREQ 32000000 14 | #define TMR1_RST 65228 15 | 16 | // CONFIG1 17 | #pragma config FEXTOSC = OFF // External Oscillator mode selection bits (Oscillator not enabled) 18 | #pragma config RSTOSC = HFINT32 // Power-up default value for COSC bits (HFINTOSC with OSCFRQ= 32 MHz and CDIV = 1:1) 19 | #pragma config CLKOUTEN = OFF // Clock Out Enable bit (CLKOUT function is disabled; i/o or oscillator function on OSC2) 20 | #pragma config CSWEN = ON // Clock Switch Enable bit (Writing to NOSC and NDIV is allowed) 21 | #pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable bit (FSCM timer enabled) 22 | 23 | // CONFIG2 24 | #pragma config MCLRE = OFF // Master Clear Enable bit (MCLR pin function is port defined function) 25 | #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) 26 | #pragma config LPBOREN = OFF // Low-Power BOR enable bit (ULPBOR disabled) 27 | #pragma config BOREN = ON // Brown-out reset enable bits (Brown-out Reset Enabled, SBOREN bit is ignored) 28 | #pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (VBOR) set to 1.9V on LF, and 2.45V on F Devices) 29 | #pragma config ZCD = OFF // Zero-cross detect disable (Zero-cross detect circuit is disabled at POR.) 30 | #pragma config PPS1WAY = OFF // Peripheral Pin Select one-way control (The PPSLOCK bit can be set and cleared repeatedly by software) 31 | #pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable bit (Stack Overflow or Underflow will cause a reset) 32 | 33 | // CONFIG3 34 | #pragma config WDTCPS = WDTCPS_13// WDT Period Select bits (Divider ratio 1:262144) 35 | #pragma config WDTE = ON // WDT operating mode (WDT enabled regardless of sleep; SWDTEN ignored) 36 | #pragma config WDTCWS = WDTCWS_7// WDT Window Select bits (window always open (100%); software control; keyed access not required) 37 | //#pragma config WDTCCS = HFINTOSC// WDT input clock selector (WDT reference clock is the 31.25 kHz HFINTOSC) 38 | #pragma config WDTCCS = LFINTOSC// WDT input clock selector (WDT reference clock is the 31.0kHz LFINTOSC output) 39 | 40 | // CONFIG4 41 | #pragma config BBSIZE = BB512 // Boot Block Size Selection bits (512 words boot block size) 42 | #pragma config BBEN = OFF // Boot Block Enable bit (Boot Block disabled) 43 | #pragma config SAFEN = OFF // SAF Enable bit (SAF disabled) 44 | #pragma config WRTAPP = OFF // Application Block Write Protection bit (Application Block not write protected) 45 | #pragma config WRTB = OFF // Boot Block Write Protection bit (Boot Block not write protected) 46 | #pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration Register not write protected) 47 | #pragma config WRTSAF = OFF // Storage Area Flash Write Protection bit (SAF not write protected) 48 | #pragma config LVP = OFF // Low Voltage Programming Enable bit (Low Voltage programming enabled. MCLR/Vpp pin function is MCLR.) 49 | 50 | // CONFIG5 51 | #pragma config CP = OFF // UserNVM Program memory code protection bit (UserNVM code protection disabled) 52 | 53 | //Pin definitions 54 | #define pwr_btn RA5 55 | #define enable RC5 56 | #define aux RA2 57 | #define thermistor RA4 58 | 59 | //PWM 3 4 5 on RC2, RC3, RC4 60 | 61 | #include // include processor files - each processor file is guarded. 62 | 63 | #endif -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/PICCONFIG.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: PICCONFIG.c 3 | * Author: Gunnar T 4 | * Comments: 5 | * Revision history: 6 | */ 7 | 8 | #ifndef PICCONFIG_H 9 | #define PICCONFIG_H 10 | 11 | // PIC16F15324 Configuration Bit Settings 12 | 13 | #define _XTAL_FREQ 32000000 14 | #define TMR1_RST 65228 15 | 16 | // CONFIG1 17 | #pragma config FEXTOSC = OFF // External Oscillator mode selection bits (Oscillator not enabled) 18 | #pragma config RSTOSC = HFINT32 // Power-up default value for COSC bits (HFINTOSC with OSCFRQ= 32 MHz and CDIV = 1:1) 19 | #pragma config CLKOUTEN = OFF // Clock Out Enable bit (CLKOUT function is disabled; i/o or oscillator function on OSC2) 20 | #pragma config CSWEN = ON // Clock Switch Enable bit (Writing to NOSC and NDIV is allowed) 21 | #pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable bit (FSCM timer enabled) 22 | 23 | // CONFIG2 24 | #pragma config MCLRE = OFF // Master Clear Enable bit (MCLR pin function is port defined function) 25 | #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) 26 | #pragma config LPBOREN = OFF // Low-Power BOR enable bit (ULPBOR disabled) 27 | #pragma config BOREN = ON // Brown-out reset enable bits (Brown-out Reset Enabled, SBOREN bit is ignored) 28 | #pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (VBOR) set to 1.9V on LF, and 2.45V on F Devices) 29 | #pragma config ZCD = OFF // Zero-cross detect disable (Zero-cross detect circuit is disabled at POR.) 30 | #pragma config PPS1WAY = OFF // Peripheral Pin Select one-way control (The PPSLOCK bit can be set and cleared repeatedly by software) 31 | #pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable bit (Stack Overflow or Underflow will cause a reset) 32 | 33 | // CONFIG3 34 | #pragma config WDTCPS = WDTCPS_13// WDT Period Select bits (Divider ratio 1:262144) 35 | #pragma config WDTE = ON // WDT operating mode (WDT enabled regardless of sleep; SWDTEN ignored) 36 | #pragma config WDTCWS = WDTCWS_7// WDT Window Select bits (window always open (100%); software control; keyed access not required) 37 | //#pragma config WDTCCS = HFINTOSC// WDT input clock selector (WDT reference clock is the 31.25 kHz HFINTOSC) 38 | #pragma config WDTCCS = LFINTOSC// WDT input clock selector (WDT reference clock is the 31.0kHz LFINTOSC output) 39 | 40 | // CONFIG4 41 | #pragma config BBSIZE = BB512 // Boot Block Size Selection bits (512 words boot block size) 42 | #pragma config BBEN = OFF // Boot Block Enable bit (Boot Block disabled) 43 | #pragma config SAFEN = OFF // SAF Enable bit (SAF disabled) 44 | #pragma config WRTAPP = OFF // Application Block Write Protection bit (Application Block not write protected) 45 | #pragma config WRTB = OFF // Boot Block Write Protection bit (Boot Block not write protected) 46 | #pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration Register not write protected) 47 | #pragma config WRTSAF = OFF // Storage Area Flash Write Protection bit (SAF not write protected) 48 | #pragma config LVP = OFF // Low Voltage Programming Enable bit (Low Voltage programming enabled. MCLR/Vpp pin function is MCLR.) 49 | 50 | // CONFIG5 51 | #pragma config CP = OFF // UserNVM Program memory code protection bit (UserNVM code protection disabled) 52 | 53 | //Pin definitions 54 | #define pwr_btn RA5 55 | #define enable RC5 56 | #define aux RA2 57 | #define thermistor RA4 58 | 59 | //PWM 3 4 5 on RC2, RC3, RC4 60 | 61 | #include // include processor files - each processor file is guarded. 62 | 63 | #endif -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/i2c_driver_stusb4500.c: -------------------------------------------------------------------------------- 1 | #include "i2c_driver_stusb4500.h" 2 | 3 | #include "PICCONFIG.h" 4 | 5 | #include 6 | 7 | static void i2c_master_wait(void) { 8 | while (SSP1STAT & 0x04 || SSP1CON2 & 0x1F); 9 | } 10 | 11 | static void i2c_master_start(void) { 12 | SSP1CON2bits.SEN = 1; 13 | i2c_master_wait(); 14 | } 15 | 16 | static void i2c_master_repeat_start(void) { 17 | SSP1CON2bits.RSEN = 1; 18 | i2c_master_wait(); 19 | } 20 | 21 | static void i2c_master_stop(void) { 22 | SSP1CON2bits.PEN = 1; 23 | i2c_master_wait(); 24 | } 25 | 26 | static int i2c_master_send_byte(const uint8_t data) { 27 | SSP1BUF = data; 28 | i2c_master_wait(); 29 | 30 | return SSP1CON2bits.ACKSTAT ? I2C_FAILURE : I2C_OK; 31 | } 32 | 33 | static uint8_t i2c_master_receive_byte(const char ack) { 34 | SSP1CON2bits.RCEN = 1; 35 | i2c_master_wait(); 36 | uint8_t data = SSP1BUF; 37 | i2c_master_wait(); 38 | SSP1CON2bits.ACKDT = ack; 39 | SSP1CON2bits.ACKEN = 1; 40 | i2c_master_wait(); 41 | 42 | return data; 43 | } 44 | 45 | void i2c_master_init(const unsigned long clk) { 46 | SSP1STAT = 0x80; // No slew rate control 47 | SSP1CON1 = 0x28; // i2c master 48 | SSP1CON2 = 0x00; // Clear i2c bits 49 | SSP1CON3 = 0x00; // Start/stop interrupts disabled 50 | SSP1ADD = (_XTAL_FREQ / (4 * clk)) - 1; 51 | } 52 | 53 | int i2c_master_write( 54 | const uint8_t device, const uint8_t reg, const void* buf, uint16_t len) { 55 | uint8_t* data = (uint8_t*)buf; 56 | if (!data) return I2C_FAILURE; 57 | 58 | int ok = I2C_OK; 59 | 60 | i2c_master_wait(); 61 | i2c_master_start(); 62 | if (ok == I2C_OK) ok = i2c_master_send_byte((device << 1) | _I2C_WRITE); 63 | if (ok == I2C_OK) ok = i2c_master_send_byte(reg); 64 | while (ok == I2C_OK && len--) { 65 | ok = i2c_master_send_byte(*data++); 66 | } 67 | i2c_master_stop(); 68 | 69 | return ok; 70 | } 71 | 72 | int i2c_master_write_u8( 73 | const uint8_t device, const uint8_t reg, const uint8_t data) { 74 | return i2c_master_write(device, reg, &data, 1); 75 | } 76 | 77 | int i2c_master_write_u16( 78 | const uint8_t device, const uint8_t reg, const uint16_t data) { 79 | return i2c_master_write(device, reg, &data, 2); 80 | } 81 | 82 | int i2c_master_write_u32( 83 | const uint8_t device, const uint8_t reg, const uint32_t data) { 84 | return i2c_master_write(device, reg, &data, 4); 85 | } 86 | 87 | int i2c_master_read( 88 | const uint8_t device, const uint8_t reg, void* buf, uint16_t len) { 89 | uint8_t* data = (uint8_t*)buf; 90 | if (!data) return I2C_FAILURE; 91 | 92 | int ok = I2C_OK; 93 | 94 | i2c_master_wait(); 95 | i2c_master_start(); 96 | if (ok == I2C_OK) ok = i2c_master_send_byte((device << 1) | _I2C_WRITE); 97 | if (ok == I2C_OK) ok = i2c_master_send_byte(reg); 98 | if (ok == I2C_OK) i2c_master_repeat_start(); 99 | if (ok == I2C_OK) ok = i2c_master_send_byte((device << 1) | _I2C_READ); 100 | if (ok == I2C_OK) { 101 | while (len--) { 102 | *data++ = i2c_master_receive_byte(len ? I2C_ACK : I2C_NACK); 103 | } 104 | } 105 | i2c_master_stop(); 106 | 107 | return ok; 108 | } 109 | 110 | int i2c_master_read_u8(const uint8_t device, const uint8_t reg, uint8_t* data) { 111 | return i2c_master_read(device, reg, data, 1); 112 | } 113 | 114 | int i2c_master_read_u16( 115 | const uint8_t device, const uint8_t reg, uint16_t* data) { 116 | return i2c_master_read(device, reg, (uint8_t*)data, 2); 117 | } 118 | 119 | int i2c_master_read_u32( 120 | const uint8_t device, const uint8_t reg, uint32_t* data) { 121 | return i2c_master_read(device, reg, (uint8_t*)data, 4); 122 | } -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/compiler_support.p1: -------------------------------------------------------------------------------- 1 | Version 3.2 HI-TECH Software Intermediate Code 2 | "1 C:\Program Files (x86)\Microchip\xc8\v2.10\pic\sources\c90\pic\compiler_support.c 3 | [v ___BTEMP12 `Suc ~T0 @X0 1 e ] 4 | [; ;compiler_support.c: 1: __persistent unsigned char __BTEMP12; 5 | "2 6 | [v ___BTEMP13 `Suc ~T0 @X0 1 e ] 7 | [; ;compiler_support.c: 2: __persistent unsigned char __BTEMP13; 8 | "3 9 | [v ___BTEMP14 `Suc ~T0 @X0 1 e ] 10 | [; ;compiler_support.c: 3: __persistent unsigned char __BTEMP14; 11 | "4 12 | [v ___BTEMP15 `Suc ~T0 @X0 1 e ] 13 | [; ;compiler_support.c: 4: __persistent unsigned char __BTEMP15; 14 | "5 15 | [v ___BTEMP16 `Suc ~T0 @X0 1 e ] 16 | [; ;compiler_support.c: 5: __persistent unsigned char __BTEMP16; 17 | "6 18 | [v ___BTEMP17 `Suc ~T0 @X0 1 e ] 19 | [; ;compiler_support.c: 6: __persistent unsigned char __BTEMP17; 20 | "7 21 | [v ___BTEMP18 `Suc ~T0 @X0 1 e ] 22 | [; ;compiler_support.c: 7: __persistent unsigned char __BTEMP18; 23 | "8 24 | [v ___BTEMP19 `Suc ~T0 @X0 1 e ] 25 | [; ;compiler_support.c: 8: __persistent unsigned char __BTEMP19; 26 | "9 27 | [v ___BTEMP20 `Suc ~T0 @X0 1 e ] 28 | [; ;compiler_support.c: 9: __persistent unsigned char __BTEMP20; 29 | "10 30 | [v ___BTEMP21 `Suc ~T0 @X0 1 e ] 31 | [; ;compiler_support.c: 10: __persistent unsigned char __BTEMP21; 32 | "11 33 | [v ___BTEMP22 `Suc ~T0 @X0 1 e ] 34 | [; ;compiler_support.c: 11: __persistent unsigned char __BTEMP22; 35 | "12 36 | [v ___BTEMP23 `Suc ~T0 @X0 1 e ] 37 | [; ;compiler_support.c: 12: __persistent unsigned char __BTEMP23; 38 | "13 39 | [v ___BTEMP24 `Suc ~T0 @X0 1 e ] 40 | [; ;compiler_support.c: 13: __persistent unsigned char __BTEMP24; 41 | "14 42 | [v ___BTEMP25 `Suc ~T0 @X0 1 e ] 43 | [; ;compiler_support.c: 14: __persistent unsigned char __BTEMP25; 44 | "15 45 | [v ___BTEMP26 `Suc ~T0 @X0 1 e ] 46 | [; ;compiler_support.c: 15: __persistent unsigned char __BTEMP26; 47 | "16 48 | [v ___BTEMP27 `Suc ~T0 @X0 1 e ] 49 | [; ;compiler_support.c: 16: __persistent unsigned char __BTEMP27; 50 | "17 51 | [v ___BTEMP28 `Suc ~T0 @X0 1 e ] 52 | [; ;compiler_support.c: 17: __persistent unsigned char __BTEMP28; 53 | "18 54 | [v ___BTEMP29 `Suc ~T0 @X0 1 e ] 55 | [; ;compiler_support.c: 18: __persistent unsigned char __BTEMP29; 56 | "19 57 | [v ___BTEMP30 `Suc ~T0 @X0 1 e ] 58 | [; ;compiler_support.c: 19: __persistent unsigned char __BTEMP30; 59 | "20 60 | [v ___BTEMP31 `Suc ~T0 @X0 1 e ] 61 | [; ;compiler_support.c: 20: __persistent unsigned char __BTEMP31; 62 | "21 63 | [v ___BTEMP32 `Suc ~T0 @X0 1 e ] 64 | [; ;compiler_support.c: 21: __persistent unsigned char __BTEMP32; 65 | "22 66 | [v ___BTEMP33 `Suc ~T0 @X0 1 e ] 67 | [; ;compiler_support.c: 22: __persistent unsigned char __BTEMP33; 68 | "23 69 | [v ___BTEMP34 `Suc ~T0 @X0 1 e ] 70 | [; ;compiler_support.c: 23: __persistent unsigned char __BTEMP34; 71 | "24 72 | [v ___BTEMP35 `Suc ~T0 @X0 1 e ] 73 | [; ;compiler_support.c: 24: __persistent unsigned char __BTEMP35; 74 | "25 75 | [v ___BTEMP36 `Suc ~T0 @X0 1 e ] 76 | [; ;compiler_support.c: 25: __persistent unsigned char __BTEMP36; 77 | "26 78 | [v ___BTEMP37 `Suc ~T0 @X0 1 e ] 79 | [; ;compiler_support.c: 26: __persistent unsigned char __BTEMP37; 80 | "27 81 | [v ___BTEMP38 `Suc ~T0 @X0 1 e ] 82 | [; ;compiler_support.c: 27: __persistent unsigned char __BTEMP38; 83 | "28 84 | [v ___BTEMP39 `Suc ~T0 @X0 1 e ] 85 | [; ;compiler_support.c: 28: __persistent unsigned char __BTEMP39; 86 | "29 87 | [v ___BTEMP40 `Suc ~T0 @X0 1 e ] 88 | [; ;compiler_support.c: 29: __persistent unsigned char __BTEMP40; 89 | "30 90 | [v ___BTEMP41 `Suc ~T0 @X0 1 e ] 91 | [; ;compiler_support.c: 30: __persistent unsigned char __BTEMP41; 92 | "31 93 | [v ___BTEMP42 `Suc ~T0 @X0 1 e ] 94 | [; ;compiler_support.c: 31: __persistent unsigned char __BTEMP42; 95 | "32 96 | [v ___BTEMP43 `Suc ~T0 @X0 1 e ] 97 | [; ;compiler_support.c: 32: __persistent unsigned char __BTEMP43; 98 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/i2c_driver_stusb4500.c: -------------------------------------------------------------------------------- 1 | #include "i2c_driver_stusb4500.h" 2 | 3 | #include "PICCONFIG.h" 4 | 5 | #include 6 | 7 | static void i2c_master_wait(void) { 8 | while (SSP1STAT & 0x04 || SSP1CON2 & 0x1F) 9 | ; 10 | } 11 | 12 | static void i2c_master_start(void) { 13 | SSP1CON2bits.SEN = 1; 14 | i2c_master_wait(); 15 | } 16 | 17 | static void i2c_master_repeat_start(void) { 18 | SSP1CON2bits.RSEN = 1; 19 | i2c_master_wait(); 20 | } 21 | 22 | static void i2c_master_stop(void) { 23 | SSP1CON2bits.PEN = 1; 24 | i2c_master_wait(); 25 | } 26 | 27 | static int i2c_master_send_byte(const uint8_t data) { 28 | SSP1BUF = data; 29 | i2c_master_wait(); 30 | 31 | return SSP1CON2bits.ACKSTAT ? I2C_FAILURE : I2C_OK; 32 | } 33 | 34 | static uint8_t i2c_master_receive_byte(const char ack) { 35 | SSP1CON2bits.RCEN = 1; 36 | i2c_master_wait(); 37 | uint8_t data = SSP1BUF; 38 | i2c_master_wait(); 39 | SSP1CON2bits.ACKDT = ack; 40 | SSP1CON2bits.ACKEN = 1; 41 | i2c_master_wait(); 42 | 43 | return data; 44 | } 45 | 46 | void i2c_master_init(const unsigned long clk) { 47 | SSP1STAT = 0x80; // No slew rate control 48 | SSP1CON1 = 0x28; // i2c master 49 | SSP1CON2 = 0x00; // Clear i2c bits 50 | SSP1CON3 = 0x00; // Start/stop interrupts disabled 51 | SSP1ADD = (_XTAL_FREQ / (4 * clk)) - 1; 52 | } 53 | 54 | int i2c_master_write( 55 | const uint8_t device, const uint8_t reg, const void* buf, uint16_t len) { 56 | uint8_t* data = (uint8_t*)buf; 57 | if (!data) return I2C_FAILURE; 58 | 59 | int ok = I2C_OK; 60 | 61 | i2c_master_wait(); 62 | i2c_master_start(); 63 | if (ok == I2C_OK) ok = i2c_master_send_byte((device << 1) | _I2C_WRITE); 64 | if (ok == I2C_OK) ok = i2c_master_send_byte(reg); 65 | while (ok == I2C_OK && len--) { 66 | ok = i2c_master_send_byte(*data++); 67 | } 68 | i2c_master_stop(); 69 | 70 | return ok; 71 | } 72 | 73 | int i2c_master_write_u8( 74 | const uint8_t device, const uint8_t reg, const uint8_t data) { 75 | return i2c_master_write(device, reg, &data, 1); 76 | } 77 | 78 | int i2c_master_write_u16( 79 | const uint8_t device, const uint8_t reg, const uint16_t data) { 80 | return i2c_master_write(device, reg, &data, 2); 81 | } 82 | 83 | int i2c_master_write_u32( 84 | const uint8_t device, const uint8_t reg, const uint32_t data) { 85 | return i2c_master_write(device, reg, &data, 4); 86 | } 87 | 88 | int i2c_master_read( 89 | const uint8_t device, const uint8_t reg, void* buf, uint16_t len) { 90 | uint8_t* data = (uint8_t*)buf; 91 | if (!data) return I2C_FAILURE; 92 | 93 | int ok = I2C_OK; 94 | 95 | i2c_master_wait(); 96 | i2c_master_start(); 97 | if (ok == I2C_OK) ok = i2c_master_send_byte((device << 1) | _I2C_WRITE); 98 | if (ok == I2C_OK) ok = i2c_master_send_byte(reg); 99 | if (ok == I2C_OK) i2c_master_repeat_start(); 100 | if (ok == I2C_OK) ok = i2c_master_send_byte((device << 1) | _I2C_READ); 101 | if (ok == I2C_OK) { 102 | while (len--) { 103 | *data++ = i2c_master_receive_byte(len ? I2C_ACK : I2C_NACK); 104 | } 105 | } 106 | i2c_master_stop(); 107 | 108 | return ok; 109 | } 110 | 111 | int i2c_master_read_u8(const uint8_t device, const uint8_t reg, uint8_t* data) { 112 | return i2c_master_read(device, reg, data, 1); 113 | } 114 | 115 | int i2c_master_read_u16( 116 | const uint8_t device, const uint8_t reg, uint16_t* data) { 117 | return i2c_master_read(device, reg, (uint8_t*)data, 2); 118 | } 119 | 120 | int i2c_master_read_u32( 121 | const uint8_t device, const uint8_t reg, uint32_t* data) { 122 | return i2c_master_read(device, reg, (uint8_t*)data, 4); 123 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/dist/default/production/compiler_support.p1: -------------------------------------------------------------------------------- 1 | Version 3.2 HI-TECH Software Intermediate Code 2 | "1 C:\Program Files (x86)\Microchip\xc8\v2.10\pic\sources\c90\pic\compiler_support.c 3 | [v ___BTEMP12 `Suc ~T0 @X0 1 e ] 4 | [; ;compiler_support.c: 1: __persistent unsigned char __BTEMP12; 5 | "2 6 | [v ___BTEMP13 `Suc ~T0 @X0 1 e ] 7 | [; ;compiler_support.c: 2: __persistent unsigned char __BTEMP13; 8 | "3 9 | [v ___BTEMP14 `Suc ~T0 @X0 1 e ] 10 | [; ;compiler_support.c: 3: __persistent unsigned char __BTEMP14; 11 | "4 12 | [v ___BTEMP15 `Suc ~T0 @X0 1 e ] 13 | [; ;compiler_support.c: 4: __persistent unsigned char __BTEMP15; 14 | "5 15 | [v ___BTEMP16 `Suc ~T0 @X0 1 e ] 16 | [; ;compiler_support.c: 5: __persistent unsigned char __BTEMP16; 17 | "6 18 | [v ___BTEMP17 `Suc ~T0 @X0 1 e ] 19 | [; ;compiler_support.c: 6: __persistent unsigned char __BTEMP17; 20 | "7 21 | [v ___BTEMP18 `Suc ~T0 @X0 1 e ] 22 | [; ;compiler_support.c: 7: __persistent unsigned char __BTEMP18; 23 | "8 24 | [v ___BTEMP19 `Suc ~T0 @X0 1 e ] 25 | [; ;compiler_support.c: 8: __persistent unsigned char __BTEMP19; 26 | "9 27 | [v ___BTEMP20 `Suc ~T0 @X0 1 e ] 28 | [; ;compiler_support.c: 9: __persistent unsigned char __BTEMP20; 29 | "10 30 | [v ___BTEMP21 `Suc ~T0 @X0 1 e ] 31 | [; ;compiler_support.c: 10: __persistent unsigned char __BTEMP21; 32 | "11 33 | [v ___BTEMP22 `Suc ~T0 @X0 1 e ] 34 | [; ;compiler_support.c: 11: __persistent unsigned char __BTEMP22; 35 | "12 36 | [v ___BTEMP23 `Suc ~T0 @X0 1 e ] 37 | [; ;compiler_support.c: 12: __persistent unsigned char __BTEMP23; 38 | "13 39 | [v ___BTEMP24 `Suc ~T0 @X0 1 e ] 40 | [; ;compiler_support.c: 13: __persistent unsigned char __BTEMP24; 41 | "14 42 | [v ___BTEMP25 `Suc ~T0 @X0 1 e ] 43 | [; ;compiler_support.c: 14: __persistent unsigned char __BTEMP25; 44 | "15 45 | [v ___BTEMP26 `Suc ~T0 @X0 1 e ] 46 | [; ;compiler_support.c: 15: __persistent unsigned char __BTEMP26; 47 | "16 48 | [v ___BTEMP27 `Suc ~T0 @X0 1 e ] 49 | [; ;compiler_support.c: 16: __persistent unsigned char __BTEMP27; 50 | "17 51 | [v ___BTEMP28 `Suc ~T0 @X0 1 e ] 52 | [; ;compiler_support.c: 17: __persistent unsigned char __BTEMP28; 53 | "18 54 | [v ___BTEMP29 `Suc ~T0 @X0 1 e ] 55 | [; ;compiler_support.c: 18: __persistent unsigned char __BTEMP29; 56 | "19 57 | [v ___BTEMP30 `Suc ~T0 @X0 1 e ] 58 | [; ;compiler_support.c: 19: __persistent unsigned char __BTEMP30; 59 | "20 60 | [v ___BTEMP31 `Suc ~T0 @X0 1 e ] 61 | [; ;compiler_support.c: 20: __persistent unsigned char __BTEMP31; 62 | "21 63 | [v ___BTEMP32 `Suc ~T0 @X0 1 e ] 64 | [; ;compiler_support.c: 21: __persistent unsigned char __BTEMP32; 65 | "22 66 | [v ___BTEMP33 `Suc ~T0 @X0 1 e ] 67 | [; ;compiler_support.c: 22: __persistent unsigned char __BTEMP33; 68 | "23 69 | [v ___BTEMP34 `Suc ~T0 @X0 1 e ] 70 | [; ;compiler_support.c: 23: __persistent unsigned char __BTEMP34; 71 | "24 72 | [v ___BTEMP35 `Suc ~T0 @X0 1 e ] 73 | [; ;compiler_support.c: 24: __persistent unsigned char __BTEMP35; 74 | "25 75 | [v ___BTEMP36 `Suc ~T0 @X0 1 e ] 76 | [; ;compiler_support.c: 25: __persistent unsigned char __BTEMP36; 77 | "26 78 | [v ___BTEMP37 `Suc ~T0 @X0 1 e ] 79 | [; ;compiler_support.c: 26: __persistent unsigned char __BTEMP37; 80 | "27 81 | [v ___BTEMP38 `Suc ~T0 @X0 1 e ] 82 | [; ;compiler_support.c: 27: __persistent unsigned char __BTEMP38; 83 | "28 84 | [v ___BTEMP39 `Suc ~T0 @X0 1 e ] 85 | [; ;compiler_support.c: 28: __persistent unsigned char __BTEMP39; 86 | "29 87 | [v ___BTEMP40 `Suc ~T0 @X0 1 e ] 88 | [; ;compiler_support.c: 29: __persistent unsigned char __BTEMP40; 89 | "30 90 | [v ___BTEMP41 `Suc ~T0 @X0 1 e ] 91 | [; ;compiler_support.c: 30: __persistent unsigned char __BTEMP41; 92 | "31 93 | [v ___BTEMP42 `Suc ~T0 @X0 1 e ] 94 | [; ;compiler_support.c: 31: __persistent unsigned char __BTEMP42; 95 | "32 96 | [v ___BTEMP43 `Suc ~T0 @X0 1 e ] 97 | [; ;compiler_support.c: 32: __persistent unsigned char __BTEMP43; 98 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # There exist several targets which are by default empty and which can be 3 | # used for execution of your targets. These targets are usually executed 4 | # before and after some main targets. They are: 5 | # 6 | # .build-pre: called before 'build' target 7 | # .build-post: called after 'build' target 8 | # .clean-pre: called before 'clean' target 9 | # .clean-post: called after 'clean' target 10 | # .clobber-pre: called before 'clobber' target 11 | # .clobber-post: called after 'clobber' target 12 | # .all-pre: called before 'all' target 13 | # .all-post: called after 'all' target 14 | # .help-pre: called before 'help' target 15 | # .help-post: called after 'help' target 16 | # 17 | # Targets beginning with '.' are not intended to be called on their own. 18 | # 19 | # Main targets can be executed directly, and they are: 20 | # 21 | # build build a specific configuration 22 | # clean remove built files from a configuration 23 | # clobber remove all built files 24 | # all build all configurations 25 | # help print help mesage 26 | # 27 | # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and 28 | # .help-impl are implemented in nbproject/makefile-impl.mk. 29 | # 30 | # Available make variables: 31 | # 32 | # CND_BASEDIR base directory for relative paths 33 | # CND_DISTDIR default top distribution directory (build artifacts) 34 | # CND_BUILDDIR default top build directory (object files, ...) 35 | # CONF name of current configuration 36 | # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) 37 | # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) 38 | # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) 39 | # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) 40 | # CND_PACKAGE_NAME_${CONF} name of package (current configuration) 41 | # CND_PACKAGE_PATH_${CONF} path to package (current configuration) 42 | # 43 | # NOCDDL 44 | 45 | 46 | # Environment 47 | MKDIR=mkdir 48 | CP=cp 49 | CCADMIN=CCadmin 50 | RANLIB=ranlib 51 | 52 | 53 | # build 54 | build: .build-post 55 | 56 | .build-pre: 57 | # Add your pre 'build' code here... 58 | 59 | .build-post: .build-impl 60 | # Add your post 'build' code here... 61 | 62 | 63 | # clean 64 | clean: .clean-post 65 | 66 | .clean-pre: 67 | # Add your pre 'clean' code here... 68 | # WARNING: the IDE does not call this target since it takes a long time to 69 | # simply run make. Instead, the IDE removes the configuration directories 70 | # under build and dist directly without calling make. 71 | # This target is left here so people can do a clean when running a clean 72 | # outside the IDE. 73 | 74 | .clean-post: .clean-impl 75 | # Add your post 'clean' code here... 76 | 77 | 78 | # clobber 79 | clobber: .clobber-post 80 | 81 | .clobber-pre: 82 | # Add your pre 'clobber' code here... 83 | 84 | .clobber-post: .clobber-impl 85 | # Add your post 'clobber' code here... 86 | 87 | 88 | # all 89 | all: .all-post 90 | 91 | .all-pre: 92 | # Add your pre 'all' code here... 93 | 94 | .all-post: .all-impl 95 | # Add your post 'all' code here... 96 | 97 | 98 | # help 99 | help: .help-post 100 | 101 | .help-pre: 102 | # Add your pre 'help' code here... 103 | 104 | .help-post: .help-impl 105 | # Add your post 'help' code here... 106 | 107 | 108 | 109 | # include project implementation makefile 110 | include nbproject/Makefile-impl.mk 111 | 112 | # include project make variables 113 | include nbproject/Makefile-variables.mk 114 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # There exist several targets which are by default empty and which can be 3 | # used for execution of your targets. These targets are usually executed 4 | # before and after some main targets. They are: 5 | # 6 | # .build-pre: called before 'build' target 7 | # .build-post: called after 'build' target 8 | # .clean-pre: called before 'clean' target 9 | # .clean-post: called after 'clean' target 10 | # .clobber-pre: called before 'clobber' target 11 | # .clobber-post: called after 'clobber' target 12 | # .all-pre: called before 'all' target 13 | # .all-post: called after 'all' target 14 | # .help-pre: called before 'help' target 15 | # .help-post: called after 'help' target 16 | # 17 | # Targets beginning with '.' are not intended to be called on their own. 18 | # 19 | # Main targets can be executed directly, and they are: 20 | # 21 | # build build a specific configuration 22 | # clean remove built files from a configuration 23 | # clobber remove all built files 24 | # all build all configurations 25 | # help print help mesage 26 | # 27 | # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and 28 | # .help-impl are implemented in nbproject/makefile-impl.mk. 29 | # 30 | # Available make variables: 31 | # 32 | # CND_BASEDIR base directory for relative paths 33 | # CND_DISTDIR default top distribution directory (build artifacts) 34 | # CND_BUILDDIR default top build directory (object files, ...) 35 | # CONF name of current configuration 36 | # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) 37 | # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) 38 | # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) 39 | # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) 40 | # CND_PACKAGE_NAME_${CONF} name of package (current configuration) 41 | # CND_PACKAGE_PATH_${CONF} path to package (current configuration) 42 | # 43 | # NOCDDL 44 | 45 | 46 | # Environment 47 | MKDIR=mkdir 48 | CP=cp 49 | CCADMIN=CCadmin 50 | RANLIB=ranlib 51 | 52 | 53 | # build 54 | build: .build-post 55 | 56 | .build-pre: 57 | # Add your pre 'build' code here... 58 | 59 | .build-post: .build-impl 60 | # Add your post 'build' code here... 61 | 62 | 63 | # clean 64 | clean: .clean-post 65 | 66 | .clean-pre: 67 | # Add your pre 'clean' code here... 68 | # WARNING: the IDE does not call this target since it takes a long time to 69 | # simply run make. Instead, the IDE removes the configuration directories 70 | # under build and dist directly without calling make. 71 | # This target is left here so people can do a clean when running a clean 72 | # outside the IDE. 73 | 74 | .clean-post: .clean-impl 75 | # Add your post 'clean' code here... 76 | 77 | 78 | # clobber 79 | clobber: .clobber-post 80 | 81 | .clobber-pre: 82 | # Add your pre 'clobber' code here... 83 | 84 | .clobber-post: .clobber-impl 85 | # Add your post 'clobber' code here... 86 | 87 | 88 | # all 89 | all: .all-post 90 | 91 | .all-pre: 92 | # Add your pre 'all' code here... 93 | 94 | .all-post: .all-impl 95 | # Add your post 'all' code here... 96 | 97 | 98 | # help 99 | help: .help-post 100 | 101 | .help-pre: 102 | # Add your pre 'help' code here... 103 | 104 | .help-post: .help-impl 105 | # Add your post 'help' code here... 106 | 107 | 108 | 109 | # include project implementation makefile 110 | include nbproject/Makefile-impl.mk 111 | 112 | # include project make variables 113 | include nbproject/Makefile-variables.mk 114 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/BQ25895M.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: BQ25895M.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 14, 2019, 11:18 AM 6 | */ 7 | 8 | #include 9 | #include 10 | #include "I2C.h" 11 | #include "BQ25895M.h" 12 | #include "PICCONFIG.h" 13 | #include "time.h" 14 | 15 | void BQ_Write(unsigned char reg, char data) { 16 | I2C_Master_Start(); 17 | I2C_Master_Write(BQ_ADDR << 1); 18 | I2C_Master_Write(reg); 19 | I2C_Master_Write(data); 20 | I2C_Master_Stop(); 21 | } 22 | 23 | unsigned short BQ_Read(unsigned char reg) { 24 | unsigned char data; 25 | 26 | I2C_Master_Start(); 27 | I2C_Master_Write(BQ_ADDR << 1); 28 | I2C_Master_Write(reg); 29 | I2C_Master_Start(); 30 | I2C_Master_Write(0b11010101); //Address Read 31 | data=I2C_Master_Read(1); 32 | I2C_Master_Stop(); 33 | return data; 34 | } 35 | 36 | uint8_t VBUS_CHRG_STATE[2] = {0, 0}; 37 | uint8_t BATTERY_VOLTAGE; 38 | uint8_t BQ_adc_state = 0; 39 | uint32_t BQ_adc_time = 0; 40 | 41 | void BQ_get_chrg_state() { 42 | char temp = BQ_Read(0x0B); //get charge/vbus status 43 | 44 | VBUS_CHRG_STATE[0] = (temp >> 4) & 0b00000111; //vbus stat 45 | VBUS_CHRG_STATE[1] = (temp >> 2) & 0b00000011; //chrg stat 46 | } 47 | 48 | void BQ_UPDATE() { 49 | if(BQ_adc_state == 0) { 50 | BQ_get_chrg_state(); 51 | BQ_Write(0x02, 0b10010001); //start ADC 52 | BQ_adc_time = get_time(); 53 | BQ_adc_state = 1; 54 | } 55 | else if(BQ_adc_state == 1) { 56 | if(timer_diff(BQ_adc_time) >= 80) { 57 | BATTERY_VOLTAGE = BQ_Read(0x0E); 58 | BQ_adc_state = 2; 59 | BQ_adc_time = get_time(); 60 | } 61 | } 62 | else if(BQ_adc_state == 2) { 63 | if(timer_diff(BQ_adc_time) >= 20) { 64 | BQ_adc_state = 0; 65 | } 66 | } 67 | else { 68 | BQ_adc_state = 0; 69 | } 70 | } 71 | 72 | uint8_t REG00_config; 73 | uint8_t REG01_config; 74 | uint8_t REG02_config; 75 | uint8_t REG03_config; 76 | uint8_t REG04_config; 77 | uint8_t REG05_config; 78 | uint8_t REG06_config; 79 | uint8_t REG07_config; 80 | uint8_t REG08_config; 81 | 82 | //REG00 83 | uint8_t EN_HIZ = 0; 84 | uint8_t EN_ILIM = 1; 85 | uint8_t INILIM = 0b111010; //3A 86 | 87 | //REG01 88 | uint8_t BHOT = 0b00; 89 | uint8_t BCOLD = 0b0; 90 | uint8_t VINDPM_OS = 0b00110; 91 | 92 | //REG02 93 | uint8_t CONV_START = 0b0; 94 | uint8_t CONV_RATE = 0; 95 | uint8_t BOOST_FREQ = 1; 96 | uint8_t ICO_EN = 1; 97 | uint8_t HVDCP_EN = 0; 98 | uint8_t MAXC_EN = 0; 99 | uint8_t FORCE_DPDM = 0; 100 | uint8_t AUTO_DPDM_EN = 1; 101 | 102 | //REG03 103 | uint8_t WD_RST = 0; 104 | uint8_t OTG_CONFIG = 0; 105 | uint8_t CHG_CONFIG = 1; 106 | uint8_t SYS_MIN = 0b101; 107 | 108 | //REG04 109 | uint8_t ICHG = 0b1100000; //3.072A 110 | 111 | //REG05 112 | uint8_t IPRECHG = 0b0001; 113 | uint8_t ITERM = 0b0011; 114 | 115 | //REG06 116 | uint8_t VREG = 0b010110; //4.192V 117 | uint8_t BATLOWV = 0; 118 | uint8_t VRECHG = 0; 119 | 120 | //REG07 121 | uint8_t EN_TERM = 1; 122 | uint8_t STAT_DIS = 1; //disable stat pin 123 | uint8_t WATCHDOG = 0; 124 | uint8_t EN_TIMER = 1; 125 | uint8_t CHG_TIMER = 0b10; 126 | 127 | //REG08 128 | uint8_t BAT_COMP = 0; 129 | uint8_t VCLAMP = 0; 130 | uint8_t TREG = 0b01; //80C 131 | 132 | void BQ_CONFIG_INIT() { 133 | REG00_config = (EN_HIZ<<7)|(EN_ILIM<<6)|(INILIM); 134 | REG01_config = (BHOT<<6)|(BCOLD<<5)|(VINDPM_OS); 135 | REG02_config = (CONV_START<<7)|(CONV_RATE<<6)|(BOOST_FREQ<<5)|(ICO_EN<<4)|(HVDCP_EN<<3)|(MAXC_EN<<2)|(FORCE_DPDM<<1)|(AUTO_DPDM_EN); 136 | REG03_config = (WD_RST<<6)|(OTG_CONFIG<<5)|(CHG_CONFIG<<4)|(SYS_MIN<<1); 137 | REG04_config = (ICHG); 138 | REG05_config = (IPRECHG<<4)|(ITERM); 139 | REG06_config = (VREG<<2)|(BATLOWV<<1)|(VRECHG); 140 | REG07_config = (EN_TERM<<7)|(STAT_DIS<<6)|(WATCHDOG<<4)|(EN_TIMER<<3)|(CHG_TIMER<<1)|0b1; 141 | REG08_config = (BAT_COMP<<5)|(VCLAMP<<2)|TREG; 142 | } 143 | 144 | void BQ_INIT() { 145 | BQ_Write(0x00, REG00_config); 146 | BQ_Write(0x01, REG01_config); 147 | BQ_Write(0x02, REG02_config); 148 | BQ_Write(0x03, REG03_config); 149 | BQ_Write(0x04, REG04_config); 150 | BQ_Write(0x05, REG05_config); 151 | BQ_Write(0x06, REG06_config); 152 | BQ_Write(0x07, REG07_config); 153 | BQ_Write(0x08, REG08_config); 154 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/BQ25895M.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: BQ25895M.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 14, 2019, 11:18 AM 6 | */ 7 | 8 | #include 9 | #include 10 | #include "I2C.h" 11 | #include "BQ25895M.h" 12 | #include "PICCONFIG.h" 13 | #include "NVM.h" 14 | #include "time.h" 15 | 16 | void BQ_Write(unsigned char reg, char data) { 17 | I2C_Master_Start(); 18 | I2C_Master_Write(BQ_ADDR << 1); 19 | I2C_Master_Write(reg); 20 | I2C_Master_Write(data); 21 | I2C_Master_Stop(); 22 | } 23 | 24 | unsigned short BQ_Read(unsigned char reg) { 25 | unsigned char data; 26 | 27 | I2C_Master_Start(); 28 | I2C_Master_Write(BQ_ADDR << 1); 29 | I2C_Master_Write(reg); 30 | I2C_Master_Start(); 31 | I2C_Master_Write(0b11010101); //Address Read 32 | data=I2C_Master_Read(1); 33 | I2C_Master_Stop(); 34 | return data; 35 | } 36 | 37 | char BQ_read_adc(char reg) { 38 | BQ_Write(0x02, 0b10010001); //start ADC 39 | __delay_ms(500); //delay for conversion 40 | return BQ_Read(reg); 41 | } 42 | 43 | char * BQ_get_chrg_state() { 44 | 45 | char data[2]; 46 | char temp = BQ_Read(0x0B); //get charge/vbus status 47 | 48 | data[0] = (temp >> 4) & 0b00000111; //vbus stat 49 | data[1] = (temp >> 2) & 0b00000011; //chrg stat 50 | 51 | return data; 52 | } 53 | 54 | uint8_t * VBUS_CHRG_STATE; 55 | uint8_t BATTERY_VOLTAGE; 56 | 57 | uint8_t BQ_adc_state = 0; 58 | uint32_t BQ_adc_time = 0; 59 | 60 | void BQ_UPDATE() { 61 | if(BQ_adc_state == 0) { 62 | VBUS_CHRG_STATE = BQ_get_chrg_state(); 63 | BQ_Write(0x02, 0b10010001); //start ADC 64 | BQ_adc_time = get_time(); 65 | BQ_adc_state = 1; 66 | } 67 | else if(BQ_adc_state == 1) { 68 | if(timer_diff(BQ_adc_time) >= 80) { 69 | BATTERY_VOLTAGE = BQ_Read(0x0E); 70 | BQ_adc_state = 2; 71 | BQ_adc_time = get_time(); 72 | } 73 | } 74 | else if(BQ_adc_state == 2) { 75 | if(timer_diff(BQ_adc_time) >= 20) { 76 | BQ_adc_state = 0; 77 | } 78 | } 79 | else { 80 | BQ_adc_state = 0; 81 | } 82 | } 83 | 84 | uint8_t REG00_config; 85 | uint8_t REG01_config; 86 | uint8_t REG02_config; 87 | uint8_t REG03_config; 88 | uint8_t REG04_config; 89 | uint8_t REG05_config; 90 | uint8_t REG06_config; 91 | uint8_t REG07_config; 92 | uint8_t REG08_config; 93 | 94 | //REG00 95 | uint8_t EN_HIZ = 0; 96 | uint8_t EN_ILIM = 1; 97 | uint8_t INILIM = 0b111010; //3A 98 | 99 | //REG01 100 | uint8_t BHOT = 0b00; 101 | uint8_t BCOLD = 0b0; 102 | uint8_t VINDPM_OS = 0b00110; 103 | 104 | //REG02 105 | uint8_t CONV_START = 0b0; 106 | uint8_t CONV_RATE = 0; 107 | uint8_t BOOST_FREQ = 1; 108 | uint8_t ICO_EN = 1; 109 | uint8_t HVDCP_EN = 0; 110 | uint8_t MAXC_EN = 1; 111 | uint8_t FORCE_DPDM = 0; 112 | uint8_t AUTO_DPDM_EN = 1; 113 | 114 | //REG03 115 | uint8_t WD_RST = 0; 116 | uint8_t OTG_CONFIG = 0; 117 | uint8_t CHG_CONFIG = 1; 118 | uint8_t SYS_MIN = 0b101; 119 | 120 | //REG04 121 | uint8_t ICHG = 0b1100000; //3.072A 122 | 123 | //REG05 124 | uint8_t IPRECHG = 0b0001; 125 | uint8_t ITERM = 0b0011; 126 | 127 | //REG06 128 | uint8_t VREG = 0b010110; //4.192V 129 | uint8_t BATLOWV = 0; 130 | uint8_t VRECHG = 0; 131 | 132 | //REG07 133 | uint8_t EN_TERM = 1; 134 | uint8_t STAT_DIS = 1; //disable stat pin 135 | uint8_t WATCHDOG = 0; 136 | uint8_t EN_TIMER = 1; 137 | uint8_t CHG_TIMER = 10; 138 | 139 | //REG08 140 | uint8_t BAT_COMP = 0; 141 | uint8_t VCLAMP = 0; 142 | uint8_t TREG = 0b01; //80C 143 | 144 | void BQ_CONFIG_INIT() { 145 | REG00_config = (EN_HIZ<<7)|(EN_ILIM<<6)|(INILIM); 146 | REG01_config = (BHOT<<6)|(BCOLD<<5)|(VINDPM_OS); 147 | REG02_config = (CONV_START<<7)|(CONV_RATE<<6)|(BOOST_FREQ<<5)|(ICO_EN<<4)|(HVDCP_EN<<3)|(MAXC_EN<<2)|(FORCE_DPDM<<1)|(AUTO_DPDM_EN); 148 | REG03_config = (WD_RST<<6)|(OTG_CONFIG<<5)|(CHG_CONFIG<<4)|(SYS_MIN<<1); 149 | REG04_config = (ICHG); 150 | REG05_config = (IPRECHG<<4)|(ITERM); 151 | REG06_config = (VREG<<2)|(BATLOWV<<1)|(VRECHG); 152 | REG07_config = (EN_TERM<<7)|(STAT_DIS<<6)|(WATCHDOG<<4)|(EN_TIMER<<3)|(CHG_TIMER<<1)|0b1; 153 | REG08_config = (BAT_COMP<<5)|(VCLAMP<<2)|TREG; 154 | } 155 | 156 | void BQ_INIT() { 157 | BQ_Write(0x00, REG00_config); 158 | BQ_Write(0x01, REG01_config); 159 | BQ_Write(0x02, REG02_config); 160 | BQ_Write(0x03, REG03_config); 161 | BQ_Write(0x04, REG04_config); 162 | BQ_Write(0x05, REG05_config); 163 | BQ_Write(0x06, REG06_config); 164 | BQ_Write(0x07, REG07_config); 165 | BQ_Write(0x08, REG08_config); 166 | } -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/LED_INTERFACE.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: LED_INTERFACE.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 14, 2019, 9:21 PM 6 | */ 7 | 8 | #include 9 | #include 10 | #include "BQ25895M.h" 11 | #include "time.h" 12 | 13 | uint8_t i = 0; 14 | uint8_t c = 0; 15 | uint8_t color = 0; 16 | uint32_t rgb_delay = 0; 17 | 18 | void RGB_fade() { 19 | //this function fades between continuous colors using the RGB led 20 | if(timer_diff(rgb_delay) >= 2) { 21 | rgb_delay = get_time(); 22 | if (i >= 255) { 23 | i = 0; 24 | color++; 25 | if (color > 2) { 26 | color = 0; 27 | } 28 | } 29 | i++; 30 | if (color == 0) { 31 | PWM3DCH = 255 - i; 32 | PWM4DCH = i; 33 | PWM5DCH = 0; 34 | } 35 | if (color == 1) { 36 | PWM3DCH = 0; 37 | PWM4DCH = 255 - i; 38 | PWM5DCH = i; 39 | } 40 | if (color == 2) { 41 | PWM3DCH = i; 42 | PWM4DCH = 0; 43 | PWM5DCH = 255 - i; 44 | } 45 | } 46 | } 47 | 48 | static char Map(int x, char inMin, char inMax, char outMin, char outMax) { 49 | // Map a single value onto a different range 50 | return (((x - inMin) * (outMax - outMin)) / (inMax - inMin)) +outMin; 51 | } 52 | 53 | void battery_fade() { 54 | //this function is used to demonstrate the battery voltage on the RG led 55 | 56 | char v = BATTERY_VOLTAGE; //temp variable holding the battery voltage 57 | 58 | //initial map v to lowest and highest battery acceptable 59 | char battery_min = 0; //2.304V 60 | char battery_max = 98; //4.25 61 | 62 | if (v > battery_max) { 63 | v = battery_max; 64 | } 65 | if (v < battery_min) { 66 | v = battery_min; 67 | } 68 | 69 | v = Map(v, battery_min, battery_max, 0, 127); //map battery voltage to full scale 70 | 71 | //yellow-red: 63-0 72 | if (v <= 63) { 73 | v = Map(v, 0, 63, 0, 255); 74 | PWM3DCH = 0; //blue 75 | PWM4DCH = v; //green 76 | PWM5DCH = 255; //red 77 | } 78 | //green-yellow 127-63 79 | else if (v >= 63) { 80 | v = Map(v, 63, 127, 0, 255); 81 | PWM3DCH = 0; //blue 82 | PWM4DCH = 255; //green 83 | PWM5DCH = 255 - v; //red 84 | } 85 | } 86 | 87 | uint8_t dir = 0; 88 | uint32_t chrg_delay = 0; 89 | 90 | void chrg_led() { 91 | 92 | if(timer_diff(chrg_delay) >= 2) { 93 | chrg_delay = get_time(); 94 | if(c >= 255) { 95 | dir = 0; 96 | } 97 | if(c <= 1) { 98 | dir = 1; 99 | } 100 | if(dir == 1) { 101 | c++; 102 | } 103 | else if(dir == 0) { 104 | c--; 105 | } 106 | 107 | switch(VBUS_CHRG_STATE[1]) { 108 | case 0b01: 109 | //status is pre-charge 110 | PWM3DCH = 0; //blue 111 | PWM4DCH = 0; //green 112 | PWM5DCH = c; //red 113 | break; 114 | case 0b10: 115 | //status is fast charge 116 | PWM3DCH = 0; //blue 117 | PWM4DCH = c; //green 118 | PWM5DCH = c; //red 119 | break; 120 | case 0b11: 121 | //charge is complete 122 | PWM3DCH = 0; //blue 123 | PWM4DCH = c; //green 124 | PWM5DCH = 0; //red 125 | break; 126 | default: 127 | PWM3DCH = 0; //blue 128 | PWM4DCH = 0; //green 129 | PWM5DCH = 0; //red 130 | } 131 | } 132 | } 133 | 134 | uint8_t flash_state = 0; 135 | uint32_t flash_time = 0; 136 | 137 | void flash_led() { 138 | if(timer_diff(flash_time) >= 50) { 139 | flash_state = !flash_state; 140 | flash_time = get_time(); 141 | } 142 | if(flash_state) { 143 | PWM3DCH = 0; 144 | PWM4DCH = 0; 145 | PWM5DCH = 255; 146 | } 147 | else { 148 | PWM3DCH = 0; 149 | PWM4DCH = 0; 150 | PWM5DCH = 0; 151 | } 152 | } 153 | 154 | char mode = 2; 155 | 156 | void led_modes() { 157 | //this function is used to set some led modes that are cycled when pwr_btn is tapped 158 | if(mode == 0) { 159 | PWM3DCH = 0; 160 | PWM4DCH = 0; 161 | PWM5DCH = 0; 162 | } 163 | else if(mode == 1) { 164 | RGB_fade(); 165 | } 166 | else if(mode == 2) { 167 | battery_fade(); 168 | } 169 | else if(mode == 3) { 170 | flash_led(); 171 | } 172 | else { 173 | mode = 0; 174 | } 175 | 176 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/LED_INTERFACE.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: LED_INTERFACE.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 14, 2019, 9:21 PM 6 | */ 7 | 8 | #include 9 | #include 10 | #include "BQ25895M.h" 11 | #include "time.h" 12 | 13 | uint8_t i = 0; 14 | uint8_t c = 0; 15 | uint8_t color = 0; 16 | uint32_t rgb_delay = 0; 17 | 18 | void RGB_fade() { 19 | //this function fades between continuous colors using the RGB led 20 | if(timer_diff(rgb_delay) >= 2) { 21 | rgb_delay = get_time(); 22 | if (i >= 255) { 23 | i = 0; 24 | color++; 25 | if (color > 2) { 26 | color = 0; 27 | } 28 | } 29 | i++; 30 | if (color == 0) { 31 | PWM3DCH = 255 - i; 32 | PWM4DCH = i; 33 | PWM5DCH = 0; 34 | } 35 | if (color == 1) { 36 | PWM3DCH = 0; 37 | PWM4DCH = 255 - i; 38 | PWM5DCH = i; 39 | } 40 | if (color == 2) { 41 | PWM3DCH = i; 42 | PWM4DCH = 0; 43 | PWM5DCH = 255 - i; 44 | } 45 | } 46 | } 47 | 48 | static char Map(int x, char inMin, char inMax, char outMin, char outMax) { 49 | // Map a single value onto a different range 50 | return (((x - inMin) * (outMax - outMin)) / (inMax - inMin)) +outMin; 51 | } 52 | 53 | void battery_fade() { 54 | //this function is used to demonstrate the battery voltage on the RG led 55 | 56 | char v = BATTERY_VOLTAGE; //temp variable holding the battery voltage 57 | 58 | //initial map v to lowest and highest battery acceptable 59 | char battery_min = 0; //2.304V 60 | char battery_max = 98; //4.25 61 | 62 | if (v > battery_max) { 63 | v = battery_max; 64 | } 65 | if (v < battery_min) { 66 | v = battery_min; 67 | } 68 | 69 | v = Map(v, battery_min, battery_max, 0, 127); //map battery voltage to full scale 70 | 71 | //yellow-red: 63-0 72 | if (v <= 63) { 73 | v = Map(v, 0, 63, 0, 255); 74 | PWM3DCH = 0; //blue 75 | PWM4DCH = v; //green 76 | PWM5DCH = 255; //red 77 | } 78 | //green-yellow 127-63 79 | else if (v >= 63) { 80 | v = Map(v, 63, 127, 0, 255); 81 | PWM3DCH = 0; //blue 82 | PWM4DCH = 255; //green 83 | PWM5DCH = 255 - v; //red 84 | } 85 | } 86 | 87 | uint8_t dir = 0; 88 | uint32_t chrg_delay = 0; 89 | 90 | void chrg_led() { 91 | 92 | if(timer_diff(chrg_delay) >= 2) { 93 | chrg_delay = get_time(); 94 | if(c >= 255) { 95 | dir = 0; 96 | } 97 | if(c <= 1) { 98 | dir = 1; 99 | } 100 | if(dir == 1) { 101 | c++; 102 | } 103 | else if(dir == 0) { 104 | c--; 105 | } 106 | 107 | switch(VBUS_CHRG_STATE[1]) { 108 | case 0b01: 109 | //status is pre-charge 110 | PWM3DCH = 0; //blue 111 | PWM4DCH = 0; //green 112 | PWM5DCH = c; //red 113 | break; 114 | case 0b10: 115 | //status is fast charge 116 | PWM3DCH = 0; //blue 117 | PWM4DCH = c; //green 118 | PWM5DCH = c; //red 119 | break; 120 | case 0b11: 121 | //charge is complete 122 | PWM3DCH = 0; //blue 123 | PWM4DCH = c; //green 124 | PWM5DCH = 0; //red 125 | break; 126 | default: 127 | PWM3DCH = 0; //blue 128 | PWM4DCH = 0; //green 129 | PWM5DCH = 0; //red 130 | } 131 | } 132 | } 133 | 134 | uint8_t flash_state = 0; 135 | uint32_t flash_time = 0; 136 | 137 | void flash_led() { 138 | if(timer_diff(flash_time) >= 50) { 139 | flash_state = !flash_state; 140 | flash_time = get_time(); 141 | } 142 | if(flash_state) { 143 | PWM3DCH = 0; 144 | PWM4DCH = 0; 145 | PWM5DCH = 255; 146 | } 147 | else { 148 | PWM3DCH = 0; 149 | PWM4DCH = 0; 150 | PWM5DCH = 0; 151 | } 152 | } 153 | 154 | char mode = 2; 155 | 156 | void led_modes() { 157 | //this function is used to set some led modes that are cycled when pwr_btn is tapped 158 | if(mode == 0) { 159 | PWM3DCH = 0; 160 | PWM4DCH = 0; 161 | PWM5DCH = 0; 162 | } 163 | else if(mode == 1) { 164 | RGB_fade(); 165 | } 166 | else if(mode == 2) { 167 | battery_fade(); 168 | } 169 | else if(mode == 3) { 170 | flash_led(); 171 | } 172 | else { 173 | mode = 0; 174 | } 175 | 176 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/Wii reg-rescue.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # 2N3904-transistors 5 | # 6 | DEF 2N3904-transistors Q 0 0 Y N 1 F N 7 | F0 "Q" 200 75 50 H V L CNN 8 | F1 "2N3904-transistors" 200 0 50 H V L CNN 9 | F2 "TO_SOT_Packages_THT:TO-92_Molded_Narrow" 200 -75 50 H I L CIN 10 | F3 "" 0 0 50 H I L CNN 11 | $FPLIST 12 | TO?92* 13 | $ENDFPLIST 14 | DRAW 15 | C 50 0 111 0 1 10 N 16 | P 2 0 1 0 25 25 100 100 N 17 | P 3 0 1 0 25 -25 100 -100 100 -100 N 18 | P 3 0 1 20 25 75 25 -75 25 -75 N 19 | P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F 20 | X E 1 100 -200 100 U 50 50 1 1 P 21 | X B 2 -200 0 225 R 50 50 1 1 P 22 | X C 3 100 200 100 D 50 50 1 1 P 23 | ENDDRAW 24 | ENDDEF 25 | # 26 | # Conn_01x05-conn 27 | # 28 | DEF Conn_01x05-conn J 0 40 Y N 1 F N 29 | F0 "J" 0 300 50 H V C CNN 30 | F1 "Conn_01x05-conn" 0 -300 50 H V C CNN 31 | F2 "" 0 0 50 H I C CNN 32 | F3 "" 0 0 50 H I C CNN 33 | $FPLIST 34 | Connector*:*_??x*mm* 35 | Connector*:*1x??x*mm* 36 | Pin?Header?Straight?1X* 37 | Pin?Header?Angled?1X* 38 | Socket?Strip?Straight?1X* 39 | Socket?Strip?Angled?1X* 40 | $ENDFPLIST 41 | DRAW 42 | S -50 -195 0 -205 1 1 6 N 43 | S -50 -95 0 -105 1 1 6 N 44 | S -50 5 0 -5 1 1 6 N 45 | S -50 105 0 95 1 1 6 N 46 | S -50 205 0 195 1 1 6 N 47 | S -50 250 50 -250 1 1 10 f 48 | X Pin_1 1 -200 200 150 R 50 50 1 1 P 49 | X Pin_2 2 -200 100 150 R 50 50 1 1 P 50 | X Pin_3 3 -200 0 150 R 50 50 1 1 P 51 | X Pin_4 4 -200 -100 150 R 50 50 1 1 P 52 | X Pin_5 5 -200 -200 150 R 50 50 1 1 P 53 | ENDDRAW 54 | ENDDEF 55 | # 56 | # TEST_1P-conn 57 | # 58 | DEF TEST_1P-conn J 0 30 N N 1 F N 59 | F0 "J" 0 270 50 H V C CNN 60 | F1 "TEST_1P-conn" 0 200 50 H V C CNN 61 | F2 "" 200 0 50 H I C CNN 62 | F3 "" 200 0 50 H I C CNN 63 | DRAW 64 | C 0 130 30 0 1 0 N 65 | X 1 1 0 0 100 U 50 50 1 1 P 66 | ENDDRAW 67 | ENDDEF 68 | # 69 | # TPS61230-tps61230 70 | # 71 | DEF TPS61230-tps61230 U 0 40 Y Y 1 F N 72 | F0 "U" -50 -950 60 H V C CNN 73 | F1 "TPS61230-tps61230" -50 -250 60 H V C CNN 74 | F2 "" 0 0 60 H I C CNN 75 | F3 "" 0 0 60 H I C CNN 76 | DRAW 77 | S -300 -300 200 -900 0 1 0 N 78 | X SW 1 -500 -450 200 R 50 50 1 1 I 79 | X VIN 10 400 -450 200 L 50 50 1 1 I 80 | X GND 11 400 -350 200 L 50 50 1 1 I 81 | X SW 2 -500 -550 200 R 50 50 1 1 I 82 | X VOUT 3 -500 -650 200 R 50 50 1 1 I 83 | X VOUT 4 -500 -750 200 R 50 50 1 1 I 84 | X PG 5 -500 -850 200 R 50 50 1 1 I 85 | X SS 6 400 -850 200 L 50 50 1 1 I 86 | X FB 7 400 -750 200 L 50 50 1 1 I 87 | X HSYS 8 400 -650 200 L 50 50 1 1 I 88 | X EN 9 400 -550 200 L 50 50 1 1 I 89 | ENDDRAW 90 | ENDDEF 91 | # 92 | # bq25895m-bq25895m 93 | # 94 | DEF bq25895m-bq25895m U 0 40 Y Y 1 F N 95 | F0 "U" 100 -600 60 H V C CNN 96 | F1 "bq25895m-bq25895m" 100 -750 60 H V C CNN 97 | F2 "" 0 0 60 H I C CNN 98 | F3 "" 0 0 60 H I C CNN 99 | DRAW 100 | S -450 -250 650 -1100 0 1 0 N 101 | X VBUS 1 -650 -450 200 R 50 50 1 1 I 102 | X ILIM 10 200 -1250 200 U 50 50 1 1 I 103 | X TS 11 300 -1250 200 U 50 50 1 1 I 104 | X QON 12 400 -1250 200 U 50 50 1 1 I 105 | X BAT 13 850 -950 200 L 50 50 1 1 I 106 | X BAT 14 850 -850 200 L 50 50 1 1 I 107 | X SYS 15 850 -750 200 L 50 50 1 1 I 108 | X SYS 16 850 -650 200 L 50 50 1 1 I 109 | X PGND 17 850 -550 200 L 50 50 1 1 I 110 | X PGND 18 850 -450 200 L 50 50 1 1 I 111 | X SW 19 400 -50 200 D 50 50 1 1 I 112 | X D+ 2 -650 -550 200 R 50 50 1 1 I 113 | X SW 20 300 -50 200 D 50 50 1 1 I 114 | X BTST 21 200 -50 200 D 50 50 1 1 I 115 | X REGN 22 100 -50 200 D 50 50 1 1 I 116 | X PMID 23 0 -50 200 D 50 50 1 1 I 117 | X DSEL 24 -100 -50 200 D 50 50 1 1 I 118 | X PAD 25 -650 -350 200 R 50 50 1 1 I 119 | X D- 3 -650 -650 200 R 50 50 1 1 I 120 | X STAT 4 -650 -750 200 R 50 50 1 1 I 121 | X SCL 5 -650 -850 200 R 50 50 1 1 I 122 | X SDA 6 -650 -950 200 R 50 50 1 1 I 123 | X INT 7 -100 -1250 200 U 50 50 1 1 I 124 | X OTG 8 0 -1250 200 U 50 50 1 1 I 125 | X CE 9 100 -1250 200 U 50 50 1 1 I 126 | ENDDRAW 127 | ENDDEF 128 | # 129 | # tlv62095-tlv62095 130 | # 131 | DEF tlv62095-tlv62095 U 0 40 Y Y 1 F N 132 | F0 "U" 450 -950 60 H V C CNN 133 | F1 "tlv62095-tlv62095" -450 -950 60 H V C CNN 134 | F2 "" 0 0 60 H I C CNN 135 | F3 "" 0 0 60 H I C CNN 136 | DRAW 137 | S -400 -250 350 -900 0 1 0 N 138 | X SW 1 -600 -450 200 R 50 50 1 1 I 139 | X AVIN 10 550 -650 200 L 50 50 1 1 I 140 | X PVIN 11 550 -550 200 L 50 50 1 1 I 141 | X PVIN 12 550 -450 200 L 50 50 1 1 I 142 | X EN 13 150 -50 200 D 50 50 1 1 I 143 | X PGND 14 50 -50 200 D 50 50 1 1 I 144 | X PGND 15 -50 -50 200 D 50 50 1 1 I 145 | X VOS 16 -150 -50 200 D 50 50 1 1 I 146 | X PAD 17 -600 -350 200 R 50 50 1 1 I 147 | X SW 2 -600 -550 200 R 50 50 1 1 I 148 | X DEF 3 -600 -650 200 R 50 50 1 1 I 149 | X PG 4 -600 -750 200 R 50 50 1 1 I 150 | X FB 5 -150 -1100 200 U 50 50 1 1 I 151 | X AGND 6 -50 -1100 200 U 50 50 1 1 I 152 | X CP 7 50 -1100 200 U 50 50 1 1 I 153 | X CN 8 150 -1100 200 U 50 50 1 1 I 154 | X SS 9 550 -750 200 L 50 50 1 1 I 155 | ENDDRAW 156 | ENDDEF 157 | # 158 | #End Library 159 | -------------------------------------------------------------------------------- /RVL-PMS BOARD FILES/RVL-PMS HW2.pro: -------------------------------------------------------------------------------- 1 | update=4/5/2020 3:51:21 PM 2 | version=1 3 | last_client=kicad 4 | [general] 5 | version=1 6 | RootSch= 7 | BoardNm= 8 | [cvpcb] 9 | version=1 10 | NetIExt=net 11 | [eeschema] 12 | version=1 13 | LibDir= 14 | [eeschema/libraries] 15 | [schematic_editor] 16 | version=1 17 | PageLayoutDescrFile= 18 | PlotDirectoryName= 19 | SubpartIdSeparator=0 20 | SubpartFirstId=65 21 | NetFmtName=Pcbnew 22 | SpiceAjustPassiveValues=0 23 | LabSize=50 24 | ERC_TestSimilarLabels=1 25 | [pcbnew] 26 | version=1 27 | PageLayoutDescrFile= 28 | LastNetListRead=RVL-PMS HW2.net 29 | CopperLayerCount=4 30 | BoardThickness=1.6 31 | AllowMicroVias=0 32 | AllowBlindVias=0 33 | RequireCourtyardDefinitions=0 34 | ProhibitOverlappingCourtyards=1 35 | MinTrackWidth=0.2 36 | MinViaDiameter=0.4 37 | MinViaDrill=0.3 38 | MinMicroViaDiameter=0.2 39 | MinMicroViaDrill=0.09999999999999999 40 | MinHoleToHole=0.25 41 | TrackWidth1=0.25 42 | ViaDiameter1=0.8 43 | ViaDrill1=0.4 44 | dPairWidth1=0.2 45 | dPairGap1=0.25 46 | dPairViaGap1=0.25 47 | SilkLineWidth=0.12 48 | SilkTextSizeV=1 49 | SilkTextSizeH=1 50 | SilkTextSizeThickness=0.15 51 | SilkTextItalic=0 52 | SilkTextUpright=1 53 | CopperLineWidth=0.2 54 | CopperTextSizeV=1.5 55 | CopperTextSizeH=1.5 56 | CopperTextThickness=0.3 57 | CopperTextItalic=0 58 | CopperTextUpright=1 59 | EdgeCutLineWidth=0.05 60 | CourtyardLineWidth=0.05 61 | OthersLineWidth=0.15 62 | OthersTextSizeV=1 63 | OthersTextSizeH=1 64 | OthersTextSizeThickness=0.15 65 | OthersTextItalic=0 66 | OthersTextUpright=1 67 | SolderMaskClearance=0.051 68 | SolderMaskMinWidth=0.05 69 | SolderPasteClearance=0 70 | SolderPasteRatio=-0 71 | [pcbnew/Layer.F.Cu] 72 | Name=F.Cu 73 | Type=0 74 | Enabled=1 75 | [pcbnew/Layer.In1.Cu] 76 | Name=In1.Cu 77 | Type=0 78 | Enabled=1 79 | [pcbnew/Layer.In2.Cu] 80 | Name=In2.Cu 81 | Type=0 82 | Enabled=1 83 | [pcbnew/Layer.In3.Cu] 84 | Name=In3.Cu 85 | Type=0 86 | Enabled=0 87 | [pcbnew/Layer.In4.Cu] 88 | Name=In4.Cu 89 | Type=0 90 | Enabled=0 91 | [pcbnew/Layer.In5.Cu] 92 | Name=In5.Cu 93 | Type=0 94 | Enabled=0 95 | [pcbnew/Layer.In6.Cu] 96 | Name=In6.Cu 97 | Type=0 98 | Enabled=0 99 | [pcbnew/Layer.In7.Cu] 100 | Name=In7.Cu 101 | Type=0 102 | Enabled=0 103 | [pcbnew/Layer.In8.Cu] 104 | Name=In8.Cu 105 | Type=0 106 | Enabled=0 107 | [pcbnew/Layer.In9.Cu] 108 | Name=In9.Cu 109 | Type=0 110 | Enabled=0 111 | [pcbnew/Layer.In10.Cu] 112 | Name=In10.Cu 113 | Type=0 114 | Enabled=0 115 | [pcbnew/Layer.In11.Cu] 116 | Name=In11.Cu 117 | Type=0 118 | Enabled=0 119 | [pcbnew/Layer.In12.Cu] 120 | Name=In12.Cu 121 | Type=0 122 | Enabled=0 123 | [pcbnew/Layer.In13.Cu] 124 | Name=In13.Cu 125 | Type=0 126 | Enabled=0 127 | [pcbnew/Layer.In14.Cu] 128 | Name=In14.Cu 129 | Type=0 130 | Enabled=0 131 | [pcbnew/Layer.In15.Cu] 132 | Name=In15.Cu 133 | Type=0 134 | Enabled=0 135 | [pcbnew/Layer.In16.Cu] 136 | Name=In16.Cu 137 | Type=0 138 | Enabled=0 139 | [pcbnew/Layer.In17.Cu] 140 | Name=In17.Cu 141 | Type=0 142 | Enabled=0 143 | [pcbnew/Layer.In18.Cu] 144 | Name=In18.Cu 145 | Type=0 146 | Enabled=0 147 | [pcbnew/Layer.In19.Cu] 148 | Name=In19.Cu 149 | Type=0 150 | Enabled=0 151 | [pcbnew/Layer.In20.Cu] 152 | Name=In20.Cu 153 | Type=0 154 | Enabled=0 155 | [pcbnew/Layer.In21.Cu] 156 | Name=In21.Cu 157 | Type=0 158 | Enabled=0 159 | [pcbnew/Layer.In22.Cu] 160 | Name=In22.Cu 161 | Type=0 162 | Enabled=0 163 | [pcbnew/Layer.In23.Cu] 164 | Name=In23.Cu 165 | Type=0 166 | Enabled=0 167 | [pcbnew/Layer.In24.Cu] 168 | Name=In24.Cu 169 | Type=0 170 | Enabled=0 171 | [pcbnew/Layer.In25.Cu] 172 | Name=In25.Cu 173 | Type=0 174 | Enabled=0 175 | [pcbnew/Layer.In26.Cu] 176 | Name=In26.Cu 177 | Type=0 178 | Enabled=0 179 | [pcbnew/Layer.In27.Cu] 180 | Name=In27.Cu 181 | Type=0 182 | Enabled=0 183 | [pcbnew/Layer.In28.Cu] 184 | Name=In28.Cu 185 | Type=0 186 | Enabled=0 187 | [pcbnew/Layer.In29.Cu] 188 | Name=In29.Cu 189 | Type=0 190 | Enabled=0 191 | [pcbnew/Layer.In30.Cu] 192 | Name=In30.Cu 193 | Type=0 194 | Enabled=0 195 | [pcbnew/Layer.B.Cu] 196 | Name=B.Cu 197 | Type=0 198 | Enabled=1 199 | [pcbnew/Layer.B.Adhes] 200 | Enabled=1 201 | [pcbnew/Layer.F.Adhes] 202 | Enabled=1 203 | [pcbnew/Layer.B.Paste] 204 | Enabled=1 205 | [pcbnew/Layer.F.Paste] 206 | Enabled=1 207 | [pcbnew/Layer.B.SilkS] 208 | Enabled=1 209 | [pcbnew/Layer.F.SilkS] 210 | Enabled=1 211 | [pcbnew/Layer.B.Mask] 212 | Enabled=1 213 | [pcbnew/Layer.F.Mask] 214 | Enabled=1 215 | [pcbnew/Layer.Dwgs.User] 216 | Enabled=1 217 | [pcbnew/Layer.Cmts.User] 218 | Enabled=1 219 | [pcbnew/Layer.Eco1.User] 220 | Enabled=1 221 | [pcbnew/Layer.Eco2.User] 222 | Enabled=1 223 | [pcbnew/Layer.Edge.Cuts] 224 | Enabled=1 225 | [pcbnew/Layer.Margin] 226 | Enabled=1 227 | [pcbnew/Layer.B.CrtYd] 228 | Enabled=1 229 | [pcbnew/Layer.F.CrtYd] 230 | Enabled=1 231 | [pcbnew/Layer.B.Fab] 232 | Enabled=1 233 | [pcbnew/Layer.F.Fab] 234 | Enabled=1 235 | [pcbnew/Layer.Rescue] 236 | Enabled=0 237 | [pcbnew/Netclasses] 238 | [pcbnew/Netclasses/Default] 239 | Name=Default 240 | Clearance=0.2 241 | TrackWidth=0.25 242 | ViaDiameter=0.8 243 | ViaDrill=0.4 244 | uViaDiameter=0.3 245 | uViaDrill=0.1 246 | dPairWidth=0.2 247 | dPairGap=0.25 248 | dPairViaGap=0.25 249 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: main.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 13, 2019, 9:32 PM 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include "PICCONFIG.h" 12 | #include "PWM.h" 13 | #include "PPS.h" 14 | #include "I2C.h" 15 | #include "BQ25895M.h" 16 | #include "ADC.h" 17 | #include "LED_INTERFACE.h" 18 | #include "NVM.h" 19 | #include "stusb4500.h" 20 | #include "stusb4500_nvm.h" 21 | #include "time.h" 22 | 23 | uint8_t SYS_ENABLE = 0; 24 | 25 | void PIC_SETUP(){ 26 | 27 | CPUDOZEbits.IDLEN = 0; //clear idle mode 28 | VREGCON = 0b00000011; //low power sleep mode 29 | 30 | //IO setup 31 | TRISA = 0xFF; 32 | TRISC = 0xFF; 33 | ANSELA = 0; 34 | ANSELC = 0; 35 | ANSELAbits.ANSA4 = 1; //thermistor 36 | WPUA = 0b00100000; //WPU on RA5 BTN 37 | 38 | //TIMER1 setup 39 | T1CONbits.CKPS = 0b00; //1:1 prescale 40 | T1CONbits.nSYNC = 0; 41 | T1CONbits.RD16 = 1; //16-bit read 42 | T1GCONbits.GE = 0; //Gate OFF 43 | T1CLK = 0b00000100; //CLK is LFINTOSC 44 | TMR1 = TMR1_RST; 45 | PIE4bits.TMR1IE = 1; //enable tmr1 interrupt 46 | T1CONbits.ON = 1; 47 | 48 | //IOC setup 49 | PIE0bits.IOCIE = 1; //enable IOC module 50 | IOCAP = 0b00100000; //PSEDGE enable bits 51 | IOCAN = 0b00100000; //NEGEDGE enable bits 52 | IOCAF = 0x00; 53 | 54 | INTCONbits.GIE = 1; //enable active interrupts 55 | INTCONbits.PEIE = 1; //enable peripheral interrupts 56 | } 57 | 58 | uint8_t btn_is_pressed = 0; 59 | uint8_t btn_is_debounced = 0; 60 | uint32_t btn_time_start = 0; 61 | uint32_t btn_time = 0; 62 | 63 | void interrupt ISR(){ 64 | 65 | if(TMR1IF) { 66 | TMR1IF = 0; 67 | TMR1 = TMR1_RST; 68 | timer_counter++; 69 | } 70 | 71 | if(IOCAF5) { 72 | IOCAF5 = 0; 73 | } 74 | 75 | if(!pwr_btn) { 76 | if(!btn_is_pressed) { 77 | btn_time_start = get_time(); 78 | } 79 | btn_is_pressed = 1; 80 | } 81 | else { 82 | if(btn_is_pressed) { 83 | btn_time = timer_diff(btn_time_start); 84 | if(btn_time >= 5) { 85 | btn_is_debounced = 1; 86 | } 87 | } 88 | btn_is_pressed = 0; 89 | } 90 | 91 | } 92 | 93 | void thermal_protection(){ 94 | //calculating setpoint = 255 / [(Therm_resistance(at temp) / 10,000 ) + 1] 95 | //For temp = 75C, setpoint = 222 96 | if(readADC(ADCRA4) >= 222) { 97 | SYS_ENABLE = 0; 98 | TRISCbits.TRISC5 = 1; //turn off regulators 99 | BQ_Write(0x09, 0b01100100); //Force BATFET off 100 | } 101 | } 102 | 103 | void ps2_on() { 104 | //turn on ps2 105 | __delay_ms(1100); 106 | TRISAbits.TRISA2 = 0; //ps2 reset output 107 | aux = 0; //ps2 reset low 108 | __delay_ms(100); 109 | TRISAbits.TRISA2 = 1; //ps2 reset float 110 | } 111 | 112 | uint8_t set_stusb4500 = 0; 113 | uint32_t stusb4500_timeout = 0; 114 | 115 | void main() { 116 | 117 | PIC_SETUP(); 118 | 119 | //clear i2c bus if SDA held low 120 | I2C_bus_reset(); 121 | 122 | //Initialize I2C Master 123 | PPS_unlock(); 124 | SSP1DATPPS = 0x11; //SDA INPUT 125 | RC1PPS = 0x16; //SDA OUTPUT 126 | SSP1CLKPPS = 0x10; //SDA INPUT 127 | RC0PPS = 0x15; //SCL OUTPUT 128 | PPS_lock(); 129 | I2C_Master_Init(350000); 130 | 131 | BQ_CONFIG_INIT(); 132 | BQ_INIT(); 133 | 134 | PWM_INIT(); 135 | 136 | while(1) { 137 | 138 | CLRWDT(); 139 | 140 | if(btn_is_debounced) { 141 | if(btn_time >= 85) { //btn is long press 142 | SYS_ENABLE = !SYS_ENABLE; 143 | if(SYS_ENABLE) { 144 | TRISCbits.TRISC5 = 0; 145 | enable = 1; //turn on regulators 146 | //nvm_flash(); 147 | //ps2_on(); 148 | } 149 | else { 150 | TRISCbits.TRISC5 = 1; //turn off regulators 151 | if(mode == 3) { //shipping mode 152 | BQ_Write(0x09, 0b01100100); //Force BATFET off 153 | } 154 | } 155 | } 156 | else if(SYS_ENABLE && btn_time<=50 && !VBUS_CHRG_STATE[1]) { //btn is short press 157 | //if battery is low, revert to mode 2 to warn user 158 | //.02V/bit, 2.304V offset. bit value = [(desired cutoff voltage) - 2.304] / .02V/bit 159 | if(BATTERY_VOLTAGE <= 50) { //45 = (3.2 - 2.304)/.02 160 | mode = 2; 161 | } 162 | else { 163 | mode++; 164 | } 165 | } 166 | btn_is_debounced = 0; 167 | } 168 | 169 | BQ_UPDATE(); 170 | 171 | thermal_protection(); 172 | 173 | //setting the led interface 174 | if(VBUS_CHRG_STATE[1] == 0) { 175 | if(SYS_ENABLE) { 176 | led_modes(); 177 | } 178 | if(timer_diff(stusb4500_timeout) >= 500) { 179 | set_stusb4500 = 0; 180 | } 181 | } 182 | else { 183 | chrg_led(); 184 | if(!set_stusb4500) { 185 | stusb_negotiate(); 186 | set_stusb4500 = 1; 187 | stusb4500_timeout = get_time(); 188 | } 189 | } 190 | 191 | //power consumption putting pic to sleep 192 | if(!SYS_ENABLE && VBUS_CHRG_STATE[1]==0 && !btn_is_debounced && pwr_btn && BQ_adc_state==0 && !set_stusb4500) { 193 | PWM_power_down(); 194 | CLRWDT(); 195 | SLEEP(); 196 | RESET(); 197 | } 198 | 199 | } 200 | } -------------------------------------------------------------------------------- /RVL-PMS BOARD FILES/RVL-PMS HW2.pretty/BQ25895.kicad_mod: -------------------------------------------------------------------------------- 1 | (module BQ25895 (layer F.Cu) (tedit 5E87DEA1) 2 | (fp_text reference REF** (at -1.475 -2.95) (layer F.SilkS) 3 | (effects (font (size 0.5 0.5) (thickness 0.125))) 4 | ) 5 | (fp_text value BQ25895 (at 0.075 3.075) (layer F.Fab) 6 | (effects (font (size 0.5 0.5) (thickness 0.125))) 7 | ) 8 | (fp_line (start -1.45 2.45) (end -2.45 2.45) (layer F.SilkS) (width 0.12)) 9 | (fp_line (start -2.45 2.45) (end -2.45 1.45) (layer F.SilkS) (width 0.12)) 10 | (fp_line (start 1.45 2.45) (end 2.45 2.45) (layer F.SilkS) (width 0.12)) 11 | (fp_line (start 2.45 2.45) (end 2.45 1.45) (layer F.SilkS) (width 0.12)) 12 | (fp_line (start 2.45 -1.45) (end 2.45 -2.4) (layer F.SilkS) (width 0.12)) 13 | (fp_line (start 2.45 -2.4) (end 1.45 -2.4) (layer F.SilkS) (width 0.12)) 14 | (fp_line (start -1.45 -2.4) (end -2.45 -2.4) (layer F.SilkS) (width 0.12)) 15 | (pad 25 smd roundrect (at 0 0 270) (size 2.7 2.7) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.09300000000000001) 16 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 17 | (pad 24 smd roundrect (at -1.25 -1.975 270) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 18 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 19 | (pad 23 smd roundrect (at -0.75 -1.975 270) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 20 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 21 | (pad 22 smd roundrect (at -0.25 -1.975 270) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 22 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 23 | (pad 21 smd roundrect (at 0.25 -1.975 270) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 24 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 25 | (pad 20 smd roundrect (at 0.75 -1.975 270) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 26 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 27 | (pad 19 smd roundrect (at 1.25 -1.975 270) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 28 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 29 | (pad 18 smd roundrect (at 1.975 -1.25 180) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 30 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 31 | (pad 17 smd roundrect (at 1.975 -0.75 180) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 32 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 33 | (pad 16 smd roundrect (at 1.975 -0.25 180) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 34 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 35 | (pad 15 smd roundrect (at 1.975 0.25 180) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 36 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 37 | (pad 14 smd roundrect (at 1.975 0.75 180) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 38 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 39 | (pad 13 smd roundrect (at 1.975 1.25 180) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 40 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 41 | (pad 12 smd roundrect (at 1.25 1.975 90) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 42 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 43 | (pad 11 smd roundrect (at 0.75 1.975 90) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 44 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 45 | (pad 10 smd roundrect (at 0.25 1.975 90) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 46 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 47 | (pad 9 smd roundrect (at -0.25 1.975 90) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 48 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 49 | (pad 8 smd roundrect (at -0.75 1.975 90) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 50 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 51 | (pad 7 smd roundrect (at -1.25 1.975 90) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 52 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 53 | (pad 6 smd roundrect (at -1.975 1.25) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 54 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 55 | (pad 5 smd roundrect (at -1.975 0.75) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 56 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 57 | (pad 4 smd roundrect (at -1.975 0.25) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 58 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 59 | (pad 3 smd roundrect (at -1.975 -0.25) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 60 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 61 | (pad 2 smd roundrect (at -1.975 -0.75) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 62 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 63 | (pad 1 smd roundrect (at -1.975 -1.25) (size 0.85 0.28) (layers F.Cu F.Paste F.Mask) (roundrect_rratio 0.25) 64 | (solder_mask_margin 0.05) (solder_paste_margin -0.05)) 65 | (pad 25 thru_hole circle (at -1.1 -1.1) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 66 | (pad 25 thru_hole circle (at 1.1 -1.1) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 67 | (pad 25 thru_hole circle (at 1.1 1.1) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 68 | (pad 25 thru_hole circle (at -1.1 1.1) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 69 | (pad 25 thru_hole circle (at 0 1.1) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 70 | (pad 25 thru_hole circle (at -1.1 0) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 71 | (pad 25 thru_hole circle (at 1.1 0) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 72 | (pad 25 thru_hole circle (at 0 -1.1) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 73 | (pad 25 thru_hole circle (at 0 0) (size 0.5 0.5) (drill 0.2) (layers *.Cu *.Mask)) 74 | ) 75 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/stusb4500.c: -------------------------------------------------------------------------------- 1 | //library by Jeff Longo 2 | 3 | #include "stusb4500.h" 4 | 5 | #include "i2c_driver_stusb4500.h" 6 | #include "PICCONFIG.h" 7 | 8 | #include 9 | #include 10 | 11 | // STUSB4500 i2c address 12 | #define STUSB_ADDR 0x28 13 | 14 | // STUSB4500 registers 15 | #define PORT_STATUS 0x0E 16 | #define PRT_STATUS 0x16 17 | #define CMD_CTRL 0x1A 18 | #define RESET_CTRL 0x23 19 | #define WHO_AM_I 0x2F 20 | #define RX_BYTE_CNT 0x30 21 | #define RX_HEADER 0x31 22 | #define RX_DATA_OBJ 0x33 23 | #define TX_HEADER 0x51 24 | #define DPM_SNK_PDO1 0x85 25 | 26 | // STUSB4500 masks 27 | #define DEVICE_ID 0x25 28 | #define DEVICE_ID_B 0x21 29 | #define SW_RESET_ON 0x01 30 | #define SW_RESET_OFF 0x00 31 | #define ATTACH 0x01 32 | #define PRT_MESSAGE_RECEIVED 0x04 33 | #define SRC_CAPABILITIES_MSG 0x01 34 | 35 | // PD protocol commands, see USB PD spec Table 6-3 36 | #define PD_CMD 0x26 37 | #define PD_GET_SRC_CAP 0x0007 38 | #define PD_SOFT_RESET 0x000D 39 | 40 | // See USB PD spec Table 6-1 41 | #ifdef USBPD_REV30_SUPPORT 42 | #define HEADER_MESSAGE_TYPE(header) (header & 0x1F) 43 | #else // USBPD_REV30_SUPPORT 44 | #define HEADER_MESSAGE_TYPE(header) (header & 0x0F) 45 | #endif // USBPD_REV30_SUPPORT 46 | #define HEADER_NUM_DATA_OBJECTS(header) ((header >> 12) & 0x07) 47 | 48 | // See USB PD spec Section 7.1.3 and STUSB4500 Section 5.2 Table 16 49 | #define PDO_TYPE(pdo) ((pdo >> 30) & 0x03) 50 | #define PDO_TYPE_FIXED 0x00 51 | #define FROM_PDO_CURRENT(pdo) ((pdo & 0x03FF) * 10) 52 | #define FROM_PDO_VOLTAGE(pdo) (((pdo >> 10) & 0x03FF) * 50) 53 | #define TO_PDO_CURRENT(mA) ((mA / 10) & 0x03FF) 54 | #define TO_PDO_VOLTAGE(mV) ((uint32_t)((mV / 50) & 0x03FF) << 10) 55 | 56 | // TODO: This doesn't work 57 | static int send_pd_message(const uint16_t msg) { 58 | int ok = I2C_OK; 59 | 60 | if (ok) ok = i2c_master_write_u16(STUSB_ADDR, TX_HEADER, msg); 61 | if (ok) ok = i2c_master_write_u8(STUSB_ADDR, CMD_CTRL, PD_CMD); 62 | 63 | return (ok == I2C_OK) ? STUSB_OK : STUSB_FAILURE; 64 | } 65 | 66 | static int reset(void) { 67 | int ok = I2C_OK; 68 | 69 | // Enable software reset 70 | if (ok == I2C_OK) 71 | ok = i2c_master_write_u8(STUSB_ADDR, RESET_CTRL, SW_RESET_ON); 72 | 73 | // Wait for stusb to respond 74 | if (ok == I2C_OK) { 75 | uint8_t res; 76 | do { 77 | ok = i2c_master_read_u8(STUSB_ADDR, WHO_AM_I, &res); 78 | } while (ok == I2C_OK && res != DEVICE_ID && res != DEVICE_ID_B); 79 | } 80 | 81 | // TODO: Necessary? Wait for source to be ready 82 | if (ok == I2C_OK) __delay_ms(27); 83 | 84 | // Disable software reset 85 | if (ok == I2C_OK) 86 | ok = i2c_master_write_u8(STUSB_ADDR, RESET_CTRL, SW_RESET_OFF); 87 | 88 | return (ok == I2C_OK) ? STUSB_OK : STUSB_FAILURE; 89 | } 90 | 91 | static int 92 | write_pdo(uint16_t current_mA, uint16_t voltage_mV, uint8_t pdo_num) { 93 | if (pdo_num < 1 || pdo_num > 3) return STUSB_FAILURE; 94 | 95 | // Format the sink PDO 96 | uint32_t pdo = 97 | 0x00000000 | TO_PDO_CURRENT(current_mA) | TO_PDO_VOLTAGE(voltage_mV); 98 | 99 | // Write the sink PDO 100 | if ( 101 | i2c_master_write_u32(STUSB_ADDR, DPM_SNK_PDO1 + 4 * (pdo_num - 1), pdo) != 102 | I2C_OK) 103 | return STUSB_FAILURE; 104 | 105 | // Force a renegotiation 106 | return reset(); 107 | } 108 | 109 | static int negotiate_optimal_pdo(uint32_t* src_pdos, uint8_t num_pdos) { 110 | int ok = STUSB_FAILURE; 111 | 112 | uint16_t opt_pdo_current = 0; 113 | uint16_t opt_pdo_voltage = 0; 114 | uint32_t opt_pdo_power = 0; 115 | 116 | // Search for the optimal PDO, if any 117 | for (int i = 0; i < num_pdos; i++) { 118 | uint32_t pdo = src_pdos[i]; 119 | 120 | // Extract PDO parameters 121 | uint16_t pdo_current = FROM_PDO_CURRENT(pdo); 122 | uint16_t pdo_voltage = FROM_PDO_VOLTAGE(pdo); 123 | uint32_t pdo_power = (uint32_t)pdo_current * pdo_voltage / 1000; 124 | 125 | if ( 126 | PDO_TYPE(pdo) != PDO_TYPE_FIXED || pdo_current < PDO_CURRENT_MIN || 127 | pdo_voltage < PDO_VOLTAGE_MIN || pdo_voltage > PDO_VOLTAGE_MAX) 128 | continue; 129 | if (pdo_power > opt_pdo_power) { 130 | opt_pdo_current = pdo_current; 131 | opt_pdo_voltage = pdo_voltage; 132 | opt_pdo_power = pdo_power; 133 | ok = STUSB_OK; 134 | } 135 | } 136 | 137 | // Push the new PDO 138 | if (ok == STUSB_OK) ok = write_pdo(opt_pdo_current, opt_pdo_voltage, 3); 139 | 140 | return ok; 141 | } 142 | 143 | int stusb_negotiate(void) { 144 | uint8_t buffer[40]; 145 | uint16_t header; 146 | 147 | // Check if cable attached 148 | if ( 149 | i2c_master_read_u8(STUSB_ADDR, PORT_STATUS, buffer) != I2C_OK || 150 | !(buffer[0] & ATTACH)) 151 | return STUSB_FAILURE; 152 | 153 | // Soft reset to force source capabilities message transmission 154 | if (reset() != STUSB_OK) return STUSB_FAILURE; 155 | 156 | while (1) { 157 | // Read the port status to look for a source capabilities message 158 | if (i2c_master_read_u8(STUSB_ADDR, PRT_STATUS, buffer) != I2C_OK) 159 | return STUSB_FAILURE; 160 | 161 | // Message has not arrived yet 162 | if (!(buffer[0] & PRT_MESSAGE_RECEIVED)) continue; 163 | 164 | // Read message header 165 | if (i2c_master_read_u16(STUSB_ADDR, RX_HEADER, &header) != I2C_OK) 166 | return STUSB_FAILURE; 167 | 168 | // Not a data/source capabilities message, continue waiting 169 | if ( 170 | !HEADER_NUM_DATA_OBJECTS(header) || 171 | HEADER_MESSAGE_TYPE(header) != SRC_CAPABILITIES_MSG) 172 | continue; 173 | 174 | // Read number of received bytes 175 | if (i2c_master_read_u8(STUSB_ADDR, RX_BYTE_CNT, buffer) != I2C_OK) 176 | return STUSB_FAILURE; 177 | 178 | // Check for missing data 179 | if (buffer[0] != HEADER_NUM_DATA_OBJECTS(header) * 4) 180 | return STUSB_FAILURE; 181 | 182 | break; 183 | } 184 | 185 | // Read source capabilities 186 | // WARNING: This must happen very soon after the previous code block is 187 | // executed. The source will send an accept message which partially 188 | // overwrites the source capabilities message. Use i2c clock >= 300 kHz 189 | if ( 190 | i2c_master_read( 191 | STUSB_ADDR, RX_DATA_OBJ, buffer, HEADER_NUM_DATA_OBJECTS(header) * 4) != 192 | I2C_OK) 193 | return STUSB_FAILURE; 194 | 195 | // Find and negotiate the optimal PDO, if any 196 | return negotiate_optimal_pdo( 197 | (uint32_t*)buffer, HEADER_NUM_DATA_OBJECTS(header)); 198 | } -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS firmware v2/WiiPMS V2.X/stusb4500.c: -------------------------------------------------------------------------------- 1 | //library by Jeff Longo 2 | 3 | #include "stusb4500.h" 4 | 5 | #include "i2c_driver_stusb4500.h" 6 | #include "PICCONFIG.h" 7 | 8 | #include 9 | #include 10 | 11 | // STUSB4500 i2c address 12 | #define STUSB_ADDR 0x28 13 | 14 | // STUSB4500 registers 15 | #define PORT_STATUS 0x0E 16 | #define PRT_STATUS 0x16 17 | #define CMD_CTRL 0x1A 18 | #define RESET_CTRL 0x23 19 | #define WHO_AM_I 0x2F 20 | #define RX_BYTE_CNT 0x30 21 | #define RX_HEADER 0x31 22 | #define RX_DATA_OBJ 0x33 23 | #define TX_HEADER 0x51 24 | #define DPM_SNK_PDO1 0x85 25 | 26 | // STUSB4500 masks 27 | #define DEVICE_ID 0x25 28 | #define DEVICE_ID_B 0x21 29 | #define SW_RESET_ON 0x01 30 | #define SW_RESET_OFF 0x00 31 | #define ATTACH 0x01 32 | #define PRT_MESSAGE_RECEIVED 0x04 33 | #define SRC_CAPABILITIES_MSG 0x01 34 | 35 | // PD protocol commands, see USB PD spec Table 6-3 36 | #define PD_CMD 0x26 37 | #define PD_GET_SRC_CAP 0x0007 38 | #define PD_SOFT_RESET 0x000D 39 | 40 | // See USB PD spec Table 6-1 41 | #ifdef USBPD_REV30_SUPPORT 42 | #define HEADER_MESSAGE_TYPE(header) (header & 0x1F) 43 | #else // USBPD_REV30_SUPPORT 44 | #define HEADER_MESSAGE_TYPE(header) (header & 0x0F) 45 | #endif // USBPD_REV30_SUPPORT 46 | #define HEADER_NUM_DATA_OBJECTS(header) ((header >> 12) & 0x07) 47 | 48 | // See USB PD spec Section 7.1.3 and STUSB4500 Section 5.2 Table 16 49 | #define PDO_TYPE(pdo) ((pdo >> 30) & 0x03) 50 | #define PDO_TYPE_FIXED 0x00 51 | #define FROM_PDO_CURRENT(pdo) ((pdo & 0x03FF) * 10) 52 | #define FROM_PDO_VOLTAGE(pdo) (((pdo >> 10) & 0x03FF) * 50) 53 | #define TO_PDO_CURRENT(mA) ((mA / 10) & 0x03FF) 54 | #define TO_PDO_VOLTAGE(mV) ((uint32_t)((mV / 50) & 0x03FF) << 10) 55 | 56 | // TODO: This doesn't work 57 | static int send_pd_message(const uint16_t msg) { 58 | int ok = I2C_OK; 59 | 60 | if (ok) ok = i2c_master_write_u16(STUSB_ADDR, TX_HEADER, msg); 61 | if (ok) ok = i2c_master_write_u8(STUSB_ADDR, CMD_CTRL, PD_CMD); 62 | 63 | return (ok == I2C_OK) ? STUSB_OK : STUSB_FAILURE; 64 | } 65 | 66 | static int reset(void) { 67 | int ok = I2C_OK; 68 | 69 | // Enable software reset 70 | if (ok == I2C_OK) 71 | ok = i2c_master_write_u8(STUSB_ADDR, RESET_CTRL, SW_RESET_ON); 72 | 73 | // Wait for stusb to respond 74 | if (ok == I2C_OK) { 75 | uint8_t res; 76 | do { 77 | ok = i2c_master_read_u8(STUSB_ADDR, WHO_AM_I, &res); 78 | } while (ok == I2C_OK && res != DEVICE_ID && res != DEVICE_ID_B); 79 | } 80 | 81 | // TODO: Necessary? Wait for source to be ready 82 | if (ok == I2C_OK) __delay_ms(27); 83 | 84 | // Disable software reset 85 | if (ok == I2C_OK) 86 | ok = i2c_master_write_u8(STUSB_ADDR, RESET_CTRL, SW_RESET_OFF); 87 | 88 | return (ok == I2C_OK) ? STUSB_OK : STUSB_FAILURE; 89 | } 90 | 91 | static int 92 | write_pdo(uint16_t current_mA, uint16_t voltage_mV, uint8_t pdo_num) { 93 | if (pdo_num < 1 || pdo_num > 3) return STUSB_FAILURE; 94 | 95 | // Format the sink PDO 96 | uint32_t pdo = 97 | 0x00000000 | TO_PDO_CURRENT(current_mA) | TO_PDO_VOLTAGE(voltage_mV); 98 | 99 | // Write the sink PDO 100 | if ( 101 | i2c_master_write_u32(STUSB_ADDR, DPM_SNK_PDO1 + 4 * (pdo_num - 1), pdo) != 102 | I2C_OK) 103 | return STUSB_FAILURE; 104 | 105 | // Force a renegotiation 106 | return reset(); 107 | } 108 | 109 | static int negotiate_optimal_pdo(uint32_t* src_pdos, uint8_t num_pdos) { 110 | int ok = STUSB_FAILURE; 111 | 112 | uint16_t opt_pdo_current = 0; 113 | uint16_t opt_pdo_voltage = 0; 114 | uint32_t opt_pdo_power = 0; 115 | 116 | // Search for the optimal PDO, if any 117 | for (int i = 0; i < num_pdos; i++) { 118 | uint32_t pdo = src_pdos[i]; 119 | 120 | // Extract PDO parameters 121 | uint16_t pdo_current = FROM_PDO_CURRENT(pdo); 122 | uint16_t pdo_voltage = FROM_PDO_VOLTAGE(pdo); 123 | uint32_t pdo_power = (uint32_t)pdo_current * pdo_voltage / 1000; 124 | 125 | if ( 126 | PDO_TYPE(pdo) != PDO_TYPE_FIXED || pdo_current < PDO_CURRENT_MIN || 127 | pdo_voltage < PDO_VOLTAGE_MIN || pdo_voltage > PDO_VOLTAGE_MAX) 128 | continue; 129 | if (pdo_power > opt_pdo_power) { 130 | opt_pdo_current = pdo_current; 131 | opt_pdo_voltage = pdo_voltage; 132 | opt_pdo_power = pdo_power; 133 | ok = STUSB_OK; 134 | } 135 | } 136 | 137 | // Push the new PDO 138 | if (ok == STUSB_OK) ok = write_pdo(opt_pdo_current, opt_pdo_voltage, 3); 139 | 140 | return ok; 141 | } 142 | 143 | int stusb_negotiate(void) { 144 | uint8_t buffer[40]; 145 | uint16_t header; 146 | 147 | // Check if cable attached 148 | if ( 149 | i2c_master_read_u8(STUSB_ADDR, PORT_STATUS, buffer) != I2C_OK || 150 | !(buffer[0] & ATTACH)) 151 | return STUSB_FAILURE; 152 | 153 | // Soft reset to force source capabilities message transmission 154 | if (reset() != STUSB_OK) return STUSB_FAILURE; 155 | 156 | while (1) { 157 | // Read the port status to look for a source capabilities message 158 | if (i2c_master_read_u8(STUSB_ADDR, PRT_STATUS, buffer) != I2C_OK) 159 | return STUSB_FAILURE; 160 | 161 | // Message has not arrived yet 162 | if (!(buffer[0] & PRT_MESSAGE_RECEIVED)) continue; 163 | 164 | // Read message header 165 | if (i2c_master_read_u16(STUSB_ADDR, RX_HEADER, &header) != I2C_OK) 166 | return STUSB_FAILURE; 167 | 168 | // Not a data/source capabilities message, continue waiting 169 | if ( 170 | !HEADER_NUM_DATA_OBJECTS(header) || 171 | HEADER_MESSAGE_TYPE(header) != SRC_CAPABILITIES_MSG) 172 | continue; 173 | 174 | // Read number of received bytes 175 | if (i2c_master_read_u8(STUSB_ADDR, RX_BYTE_CNT, buffer) != I2C_OK) 176 | return STUSB_FAILURE; 177 | 178 | // Check for missing data 179 | if (buffer[0] != HEADER_NUM_DATA_OBJECTS(header) * 4) 180 | return STUSB_FAILURE; 181 | 182 | break; 183 | } 184 | 185 | // Read source capabilities 186 | // WARNING: This must happen very soon after the previous code block is 187 | // executed. The source will send an accept message which partially 188 | // overwrites the source capabilities message. Use i2c clock >= 300 kHz 189 | if ( 190 | i2c_master_read( 191 | STUSB_ADDR, RX_DATA_OBJ, buffer, HEADER_NUM_DATA_OBJECTS(header) * 4) != 192 | I2C_OK) 193 | return STUSB_FAILURE; 194 | 195 | // Find and negotiate the optimal PDO, if any 196 | return negotiate_optimal_pdo( 197 | (uint32_t*)buffer, HEADER_NUM_DATA_OBJECTS(header)); 198 | } -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: main.c 3 | * Author: Gunnar 4 | * 5 | * Created on September 13, 2019, 9:32 PM 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include "PICCONFIG.h" 12 | #include "PWM.h" 13 | #include "PPS.h" 14 | #include "I2C.h" 15 | #include "BQ25895M.h" 16 | #include "ADC.h" 17 | #include "LED_INTERFACE.h" 18 | #include "stusb4500.h" 19 | #include "time.h" 20 | 21 | void PIC_SETUP(){ 22 | 23 | CPUDOZEbits.IDLEN = 0; //clear idle mode 24 | VREGCON = 0b00000011; //low power sleep mode 25 | 26 | //IO setup 27 | TRISA = 0xFF; 28 | TRISC = 0xFF; 29 | ANSELA = 0; 30 | ANSELC = 0; 31 | ANSELAbits.ANSA4 = 1; //thermistor 32 | WPUA = 0b00100000; //WPU on RA5 BTN 33 | 34 | //TIMER1 setup 35 | T1CONbits.CKPS = 0b00; //1:1 prescale 36 | T1CONbits.nSYNC = 0; 37 | T1CONbits.RD16 = 1; //16-bit read 38 | T1GCONbits.GE = 0; //Gate OFF 39 | T1CLK = 0b00000100; //CLK is LFINTOSC 40 | TMR1 = TMR1_RST; 41 | PIE4bits.TMR1IE = 1; //enable tmr1 interrupt 42 | T1CONbits.ON = 1; 43 | 44 | //IOC setup 45 | PIE0bits.IOCIE = 1; //enable IOC module 46 | IOCAP = 0b00100000; //PSEDGE enable bits 47 | IOCAN = 0b00100000; //NEGEDGE enable bits 48 | IOCAF = 0x00; 49 | 50 | INTCONbits.GIE = 1; //enable active interrupts 51 | INTCONbits.PEIE = 1; //enable peripheral interrupts 52 | } 53 | 54 | uint8_t SYS_ENABLE = 0; //regulator enable state 55 | uint32_t btn_time_start = 0; //timer for debouncing button 56 | uint8_t pwr_btn_temp = 0; 57 | uint8_t pwr_btn_temp_prev = 0; 58 | uint8_t btn_state = 0; //0: not pressed 1: being debounced 2: pressed 59 | uint32_t btn_time_pressed = 0; //timer for how long button has been held 60 | uint8_t btn_high_edge = 1; //goes high when button is released 61 | uint8_t btn_press_count = 0; //how many times button has been pressed in short time interval 62 | uint32_t btn_press_timer = 0; //timer for determining double press 63 | uint8_t btn_long_edge = 0; //goes high when btn is long press, resets when btn is released 64 | 65 | uint8_t set_stusb4500 = 0; 66 | uint32_t stusb4500_timeout = 0; 67 | 68 | void interrupt ISR(){ 69 | 70 | if(TMR1IF) { 71 | TMR1IF = 0; 72 | TMR1 = TMR1_RST; 73 | timer_counter++; 74 | } 75 | 76 | if(IOCAF5) { 77 | IOCAF5 = 0; 78 | } 79 | 80 | } 81 | 82 | void thermal_protection(){ 83 | //calculating setpoint = 255 / [(Therm_resistance(at temp) / 10,000 ) + 1] 84 | //For temp = 75C, setpoint = 222 85 | if(readADC(ADCRA4) >= 222) { 86 | SYS_ENABLE = 0; 87 | TRISCbits.TRISC5 = 1; //turn off regulators 88 | BQ_Write(0x09, 0b01100100); //Force BATFET off 89 | } 90 | } 91 | 92 | void ps2_on() { 93 | //turn on ps2 94 | __delay_ms(1200); 95 | TRISAbits.TRISA2 = 0; //ps2 reset output 96 | aux = 0; //ps2 reset low 97 | __delay_ms(200); 98 | TRISAbits.TRISA2 = 1; //ps2 reset float 99 | } 100 | 101 | void main() { 102 | 103 | PIC_SETUP(); 104 | 105 | //clear i2c bus if SDA held low 106 | I2C_bus_reset(); 107 | 108 | //Initialize I2C Master 109 | PPS_unlock(); 110 | SSP1DATPPS = 0x11; //SDA INPUT 111 | RC1PPS = 0x16; //SDA OUTPUT 112 | SSP1CLKPPS = 0x10; //SDA INPUT 113 | RC0PPS = 0x15; //SCL OUTPUT 114 | PPS_lock(); 115 | I2C_Master_Init(350000); 116 | 117 | BQ_CONFIG_INIT(); 118 | BQ_INIT(); 119 | 120 | PWM_INIT(); 121 | 122 | while(1) { 123 | 124 | CLRWDT(); 125 | 126 | //debouncing the power button 127 | pwr_btn_temp = pwr_btn; 128 | if(pwr_btn_temp ^ pwr_btn_temp_prev) { //if curr/prev values are not equal, then it is not debounced 129 | btn_time_start = get_time(); 130 | btn_state = 1; 131 | } 132 | if(timer_diff(btn_time_start) > 4) { 133 | if(!pwr_btn_temp) { //btn is pressed, on first edge, grab the time 134 | if(btn_state != 2) btn_time_pressed = get_time(); 135 | btn_state = 2; 136 | } 137 | else { //btn is not pressed 138 | btn_state = 0; 139 | } 140 | } 141 | pwr_btn_temp_prev = pwr_btn_temp; 142 | 143 | //power_button state machine 144 | if(btn_state == 2) { 145 | if(timer_diff(btn_time_pressed) > 84 && btn_long_edge == 0) { 146 | SYS_ENABLE = !SYS_ENABLE; 147 | if(SYS_ENABLE) { 148 | TRISCbits.TRISC5 = 0; 149 | enable = 1; //turn on regulators 150 | //ps2_on(); 151 | } 152 | else { 153 | TRISCbits.TRISC5 = 1; //turn off regulators 154 | if(mode == 3) { //shipping mode 155 | BQ_Write(0x09, 0b01100100); //Force BATFET off 156 | } 157 | } 158 | btn_long_edge = 1; 159 | } 160 | btn_high_edge = 0; 161 | } 162 | if(btn_state == 0) { 163 | if(btn_high_edge == 0) { 164 | if(SYS_ENABLE && timer_diff(btn_time_pressed)<=50){ //short press 165 | if(btn_press_count == 0) btn_press_timer = get_time(); 166 | btn_press_count++; 167 | if(btn_press_count == 2) { //double press 168 | if(!VBUS_CHRG_STATE[1]) mode++; //only increment mode when not charging 169 | } 170 | } 171 | } 172 | btn_high_edge = 1; 173 | btn_long_edge = 0; 174 | } 175 | if(timer_diff(btn_press_timer) > 50) btn_press_count = 0; //reset double press counter 176 | 177 | BQ_UPDATE(); 178 | thermal_protection(); 179 | 180 | //if battery is low, revert to mode 2 to warn user 181 | //.02V/bit, 2.304V offset. bit value = [(desired cutoff voltage) - 2.304] / .02V/bit 182 | if(BATTERY_VOLTAGE <= 50) mode = 2; 183 | 184 | //setting the led interface 185 | if(VBUS_CHRG_STATE[1] == 0) { 186 | if(SYS_ENABLE) { 187 | led_modes(); 188 | } 189 | if(timer_diff(stusb4500_timeout) >= 500) { 190 | set_stusb4500 = 0; 191 | } 192 | } 193 | else { 194 | chrg_led(); 195 | if(!set_stusb4500) { 196 | stusb_negotiate(); 197 | set_stusb4500 = 1; 198 | stusb4500_timeout = get_time(); 199 | } 200 | } 201 | 202 | //power consumption putting pic to sleep 203 | if(!SYS_ENABLE && VBUS_CHRG_STATE[1]==0 && btn_state==0 && BQ_adc_state==0 && !set_stusb4500) { 204 | PWM_power_down(); 205 | CLRWDT(); 206 | SLEEP(); 207 | RESET(); 208 | } 209 | 210 | } 211 | } -------------------------------------------------------------------------------- /RVL-PMS BOARD FILES/RVL-PMS HW2-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # Battery_Management_BQ25895RTW 5 | # 6 | DEF Battery_Management_BQ25895RTW U 0 20 Y Y 1 F N 7 | F0 "U" -200 900 50 H V C CNN 8 | F1 "Battery_Management_BQ25895RTW" 200 900 50 H V C CNN 9 | F2 "Package_DFN_QFN:Texas_S-PWQFN-N24_EP2.7x2.7mm_ThermalVias" -100 1000 50 H I C CNN 10 | F3 "" -200 800 50 H I C CNN 11 | $FPLIST 12 | Texas*S?PWQFN?N*EP* 13 | $ENDFPLIST 14 | DRAW 15 | S -300 800 300 -800 0 1 10 f 16 | X VBUS 1 -400 700 100 R 50 50 1 1 W 17 | X ILIM 10 -400 200 100 R 50 50 1 1 P 18 | X TS 11 400 -700 100 L 50 50 1 1 P 19 | X ~QON 12 -400 -700 100 R 50 50 1 1 I 20 | X BAT 13 400 0 100 L 50 50 1 1 P 21 | X BAT 14 400 0 100 L 50 50 1 1 P N 22 | X SYS 15 400 100 100 L 50 50 1 1 P 23 | X SYS 16 400 100 100 L 50 50 1 1 P N 24 | X PGND 17 0 -900 100 U 50 50 1 1 W 25 | X PGND 18 0 -900 100 U 50 50 1 1 P N 26 | X SW 19 400 500 100 L 50 50 1 1 w 27 | X D+ 2 -400 500 100 R 50 50 1 1 B 28 | X SW 20 400 500 100 L 50 50 1 1 P N 29 | X BTST 21 400 200 100 L 50 50 1 1 P 30 | X REGN 22 400 -500 100 L 50 50 1 1 P 31 | X PMID 23 400 700 100 L 50 50 1 1 w 32 | X DSEL 24 400 -400 100 L 50 50 1 1 C 33 | X PGND 25 0 -900 100 U 50 50 1 1 P N 34 | X D- 3 -400 400 100 R 50 50 1 1 B 35 | X STAT 4 -400 0 100 R 50 50 1 1 C 36 | X SCL 5 -400 -300 100 R 50 50 1 1 I 37 | X SDA 6 -400 -200 100 R 50 50 1 1 B 38 | X INT 7 -400 -400 100 R 50 50 1 1 C 39 | X OTG 8 -400 -500 100 R 50 50 1 1 I 40 | X ~CE 9 -400 -600 100 R 50 50 1 1 I 41 | ENDDRAW 42 | ENDDEF 43 | # 44 | # Connector_Conn_01x05_Female 45 | # 46 | DEF Connector_Conn_01x05_Female J 0 40 Y N 1 F N 47 | F0 "J" 0 300 50 H V C CNN 48 | F1 "Connector_Conn_01x05_Female" 0 -300 50 H V C CNN 49 | F2 "" 0 0 50 H I C CNN 50 | F3 "" 0 0 50 H I C CNN 51 | $FPLIST 52 | Connector*:*_1x??_* 53 | $ENDFPLIST 54 | DRAW 55 | A 0 -200 20 901 -901 1 1 6 N 0 -180 0 -220 56 | A 0 -100 20 901 -901 1 1 6 N 0 -80 0 -120 57 | A 0 0 20 901 -901 1 1 6 N 0 20 0 -20 58 | A 0 100 20 901 -901 1 1 6 N 0 120 0 80 59 | A 0 200 20 901 -901 1 1 6 N 0 220 0 180 60 | P 2 1 1 6 -50 -200 -20 -200 N 61 | P 2 1 1 6 -50 -100 -20 -100 N 62 | P 2 1 1 6 -50 0 -20 0 N 63 | P 2 1 1 6 -50 100 -20 100 N 64 | P 2 1 1 6 -50 200 -20 200 N 65 | X Pin_1 1 -200 200 150 R 50 50 1 1 P 66 | X Pin_2 2 -200 100 150 R 50 50 1 1 P 67 | X Pin_3 3 -200 0 150 R 50 50 1 1 P 68 | X Pin_4 4 -200 -100 150 R 50 50 1 1 P 69 | X Pin_5 5 -200 -200 150 R 50 50 1 1 P 70 | ENDDRAW 71 | ENDDEF 72 | # 73 | # Connector_TestPoint 74 | # 75 | DEF Connector_TestPoint TP 0 30 N N 1 F N 76 | F0 "TP" 0 270 50 H V C CNN 77 | F1 "Connector_TestPoint" 0 200 50 H V C CNN 78 | F2 "" 200 0 50 H I C CNN 79 | F3 "" 200 0 50 H I C CNN 80 | $FPLIST 81 | Pin* 82 | Test* 83 | $ENDFPLIST 84 | DRAW 85 | C 0 130 30 0 1 0 N 86 | X 1 1 0 0 100 U 50 50 1 1 P 87 | ENDDRAW 88 | ENDDEF 89 | # 90 | # Device_C 91 | # 92 | DEF Device_C C 0 10 N Y 1 F N 93 | F0 "C" 25 100 50 H V L CNN 94 | F1 "Device_C" 25 -100 50 H V L CNN 95 | F2 "" 38 -150 50 H I C CNN 96 | F3 "" 0 0 50 H I C CNN 97 | $FPLIST 98 | C_* 99 | $ENDFPLIST 100 | DRAW 101 | P 2 0 1 20 -80 -30 80 -30 N 102 | P 2 0 1 20 -80 30 80 30 N 103 | X ~ 1 0 150 110 D 50 50 1 1 P 104 | X ~ 2 0 -150 110 U 50 50 1 1 P 105 | ENDDRAW 106 | ENDDEF 107 | # 108 | # Device_L 109 | # 110 | DEF Device_L L 0 40 N N 1 F N 111 | F0 "L" -50 0 50 V V C CNN 112 | F1 "Device_L" 75 0 50 V V C CNN 113 | F2 "" 0 0 50 H I C CNN 114 | F3 "" 0 0 50 H I C CNN 115 | $FPLIST 116 | Choke_* 117 | *Coil* 118 | Inductor_* 119 | L_* 120 | $ENDFPLIST 121 | DRAW 122 | A 0 -75 25 -899 899 0 1 0 N 0 -100 0 -50 123 | A 0 -25 25 -899 899 0 1 0 N 0 -50 0 0 124 | A 0 25 25 -899 899 0 1 0 N 0 0 0 50 125 | A 0 75 25 -899 899 0 1 0 N 0 50 0 100 126 | X 1 1 0 150 50 D 50 50 1 1 P 127 | X 2 2 0 -150 50 U 50 50 1 1 P 128 | ENDDRAW 129 | ENDDEF 130 | # 131 | # Device_R 132 | # 133 | DEF Device_R R 0 0 N Y 1 F N 134 | F0 "R" 80 0 50 V V C CNN 135 | F1 "Device_R" 0 0 50 V V C CNN 136 | F2 "" -70 0 50 V I C CNN 137 | F3 "" 0 0 50 H I C CNN 138 | $FPLIST 139 | R_* 140 | $ENDFPLIST 141 | DRAW 142 | S -40 -100 40 100 0 1 10 N 143 | X ~ 1 0 150 50 D 50 50 1 1 P 144 | X ~ 2 0 -150 50 U 50 50 1 1 P 145 | ENDDRAW 146 | ENDDEF 147 | # 148 | # N64_PMS-cache_Wii_reg-cache_Wii-reg-rescue_TPS61230-tps61230 149 | # 150 | DEF N64_PMS-cache_Wii_reg-cache_Wii-reg-rescue_TPS61230-tps61230 U 0 40 Y Y 1 F N 151 | F0 "U" -50 -950 60 H V C CNN 152 | F1 "N64_PMS-cache_Wii_reg-cache_Wii-reg-rescue_TPS61230-tps61230" -50 -250 60 H V C CNN 153 | F2 "" 0 0 60 H I C CNN 154 | F3 "" 0 0 60 H I C CNN 155 | DRAW 156 | S -300 -300 200 -900 0 1 0 N 157 | X SW 1 -500 -450 200 R 50 50 1 1 I 158 | X VIN 10 400 -450 200 L 50 50 1 1 I 159 | X GND 11 400 -350 200 L 50 50 1 1 I 160 | X SW 2 -500 -550 200 R 50 50 1 1 I 161 | X VOUT 3 -500 -650 200 R 50 50 1 1 I 162 | X VOUT 4 -500 -750 200 R 50 50 1 1 I 163 | X PG 5 -500 -850 200 R 50 50 1 1 I 164 | X SS 6 400 -850 200 L 50 50 1 1 I 165 | X FB 7 400 -750 200 L 50 50 1 1 I 166 | X HSYS 8 400 -650 200 L 50 50 1 1 I 167 | X EN 9 400 -550 200 L 50 50 1 1 I 168 | ENDDRAW 169 | ENDDEF 170 | # 171 | # N64_PMS-cache_Wii_reg-cache_pic16f15324_PIC16F15324 172 | # 173 | DEF N64_PMS-cache_Wii_reg-cache_pic16f15324_PIC16F15324 U 0 40 Y Y 1 F N 174 | F0 "U" 650 400 60 H V C CNN 175 | F1 "N64_PMS-cache_Wii_reg-cache_pic16f15324_PIC16F15324" 150 -100 60 H V C CNN 176 | F2 "" 0 550 60 H I C CNN 177 | F3 "" 0 550 60 H I C CNN 178 | DRAW 179 | S -450 450 750 -400 0 1 0 N 180 | X RA5 1 -650 200 200 R 50 50 1 1 I 181 | X RA2 10 950 0 200 L 50 50 1 1 I 182 | X RA1/ICSPCLK 11 950 100 200 L 50 50 1 1 I 183 | X RA0/ICSPDAT 12 950 200 200 L 50 50 1 1 I 184 | X VSS 13 250 650 200 D 50 50 1 1 I 185 | X NC 14 150 650 200 D 50 50 1 1 I 186 | X NC 15 50 650 200 D 50 50 1 1 I 187 | X VDD 16 -50 650 200 D 50 50 1 1 I 188 | X PAD 17 -150 650 200 D 50 50 1 1 I 189 | X RA4 2 -650 100 200 R 50 50 1 1 I 190 | X MCLR/RA3 3 -650 0 200 R 50 50 1 1 I 191 | X RC5 4 -650 -100 200 R 50 50 1 1 I 192 | X RC4 5 -50 -600 200 U 50 50 1 1 I 193 | X RC3 6 50 -600 200 U 50 50 1 1 I 194 | X RC2 7 150 -600 200 U 50 50 1 1 I 195 | X RC1 8 250 -600 200 U 50 50 1 1 I 196 | X RC0 9 950 -100 200 L 50 50 1 1 I 197 | ENDDRAW 198 | ENDDEF 199 | # 200 | # Regulator_Switching_TLV62095RGTx 201 | # 202 | DEF Regulator_Switching_TLV62095RGTx U 0 20 Y Y 1 F N 203 | F0 "U" -250 650 50 H V C CNN 204 | F1 "Regulator_Switching_TLV62095RGTx" 300 650 50 H V C CNN 205 | F2 "Package_DFN_QFN:VQFN-16-1EP_3x3mm_P0.5mm_EP1.68x1.68mm_ThermalVias" 0 750 50 H I C CNN 206 | F3 "" -50 900 50 H I C CNN 207 | $FPLIST 208 | VQFN*1EP*3x3mm*P0.5mm* 209 | $ENDFPLIST 210 | DRAW 211 | S -300 -600 300 600 0 1 10 f 212 | X SW 1 400 500 100 L 50 50 0 1 w 213 | X AVIN 10 -400 300 100 R 50 50 0 1 W 214 | X PVIN 11 -400 500 100 R 50 50 0 1 W 215 | X PVIN 12 -400 400 100 R 50 50 0 1 W 216 | X EN 13 -400 0 100 R 50 50 0 1 I 217 | X PGND 14 -100 -700 100 U 50 50 0 1 W 218 | X PGND 15 0 -700 100 U 50 50 0 1 W 219 | X VOS 16 400 200 100 L 50 50 0 1 I 220 | X AGND 17 100 -700 100 U 50 50 0 1 W N 221 | X SW 2 400 400 100 L 50 50 0 1 w 222 | X DEF 3 -400 100 100 R 50 50 0 1 I 223 | X PG 4 400 0 100 L 50 50 0 1 T 224 | X FB 5 400 -200 100 L 50 50 0 1 I 225 | X AGND 6 100 -700 100 U 50 50 0 1 W 226 | X CP 7 -400 -400 100 R 50 50 0 1 P 227 | X CN 8 -400 -500 100 R 50 50 0 1 P 228 | X SS 9 -400 -200 100 R 50 50 0 1 I 229 | ENDDRAW 230 | ENDDEF 231 | # 232 | # power_GND 233 | # 234 | DEF power_GND #PWR 0 0 Y Y 1 F P 235 | F0 "#PWR" 0 -250 50 H I C CNN 236 | F1 "power_GND" 0 -150 50 H V C CNN 237 | F2 "" 0 0 50 H I C CNN 238 | F3 "" 0 0 50 H I C CNN 239 | DRAW 240 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N 241 | X GND 1 0 0 0 D 50 50 1 1 W N 242 | ENDDRAW 243 | ENDDEF 244 | # 245 | #End Library 246 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/rescue-backup/Wii reg-cache-2018-08-30-21-59-42.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # 2N3904 5 | # 6 | DEF 2N3904 Q 0 0 Y N 1 F N 7 | F0 "Q" 200 75 50 H V L CNN 8 | F1 "2N3904" 200 0 50 H V L CNN 9 | F2 "TO_SOT_Packages_THT:TO-92_Molded_Narrow" 200 -75 50 H I L CIN 10 | F3 "" 0 0 50 H I L CNN 11 | $FPLIST 12 | TO?92* 13 | $ENDFPLIST 14 | DRAW 15 | C 50 0 111 0 1 10 N 16 | P 2 0 1 0 25 25 100 100 N 17 | P 3 0 1 0 25 -25 100 -100 100 -100 N 18 | P 3 0 1 20 25 75 25 -75 25 -75 N 19 | P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F 20 | X E 1 100 -200 100 U 50 50 1 1 P 21 | X B 2 -200 0 225 R 50 50 1 1 P 22 | X C 3 100 200 100 D 50 50 1 1 P 23 | ENDDRAW 24 | ENDDEF 25 | # 26 | # C 27 | # 28 | DEF C C 0 10 N Y 1 F N 29 | F0 "C" 25 100 50 H V L CNN 30 | F1 "C" 25 -100 50 H V L CNN 31 | F2 "" 38 -150 50 H I C CNN 32 | F3 "" 0 0 50 H I C CNN 33 | $FPLIST 34 | C_* 35 | $ENDFPLIST 36 | DRAW 37 | P 2 0 1 20 -80 -30 80 -30 N 38 | P 2 0 1 20 -80 30 80 30 N 39 | X ~ 1 0 150 110 D 50 50 1 1 P 40 | X ~ 2 0 -150 110 U 50 50 1 1 P 41 | ENDDRAW 42 | ENDDEF 43 | # 44 | # Conn_01x05 45 | # 46 | DEF Conn_01x05 J 0 40 Y N 1 F N 47 | F0 "J" 0 300 50 H V C CNN 48 | F1 "Conn_01x05" 0 -300 50 H V C CNN 49 | F2 "" 0 0 50 H I C CNN 50 | F3 "" 0 0 50 H I C CNN 51 | $FPLIST 52 | Connector*:*_??x*mm* 53 | Connector*:*1x??x*mm* 54 | Pin?Header?Straight?1X* 55 | Pin?Header?Angled?1X* 56 | Socket?Strip?Straight?1X* 57 | Socket?Strip?Angled?1X* 58 | $ENDFPLIST 59 | DRAW 60 | S -50 -195 0 -205 1 1 6 N 61 | S -50 -95 0 -105 1 1 6 N 62 | S -50 5 0 -5 1 1 6 N 63 | S -50 105 0 95 1 1 6 N 64 | S -50 205 0 195 1 1 6 N 65 | S -50 250 50 -250 1 1 10 f 66 | X Pin_1 1 -200 200 150 R 50 50 1 1 P 67 | X Pin_2 2 -200 100 150 R 50 50 1 1 P 68 | X Pin_3 3 -200 0 150 R 50 50 1 1 P 69 | X Pin_4 4 -200 -100 150 R 50 50 1 1 P 70 | X Pin_5 5 -200 -200 150 R 50 50 1 1 P 71 | ENDDRAW 72 | ENDDEF 73 | # 74 | # GND 75 | # 76 | DEF GND #PWR 0 0 Y Y 1 F P 77 | F0 "#PWR" 0 -250 50 H I C CNN 78 | F1 "GND" 0 -150 50 H V C CNN 79 | F2 "" 0 0 50 H I C CNN 80 | F3 "" 0 0 50 H I C CNN 81 | DRAW 82 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N 83 | X GND 1 0 0 0 D 50 50 1 1 W N 84 | ENDDRAW 85 | ENDDEF 86 | # 87 | # L 88 | # 89 | DEF L L 0 40 N N 1 F N 90 | F0 "L" -50 0 50 V V C CNN 91 | F1 "L" 75 0 50 V V C CNN 92 | F2 "" 0 0 50 H I C CNN 93 | F3 "" 0 0 50 H I C CNN 94 | $FPLIST 95 | Choke_* 96 | *Coil* 97 | Inductor_* 98 | L_* 99 | $ENDFPLIST 100 | DRAW 101 | A 0 -75 25 -899 899 0 1 0 N 0 -100 0 -50 102 | A 0 -25 25 -899 899 0 1 0 N 0 -50 0 0 103 | A 0 25 25 -899 899 0 1 0 N 0 0 0 50 104 | A 0 75 25 -899 899 0 1 0 N 0 50 0 100 105 | X 1 1 0 150 50 D 50 50 1 1 P 106 | X 2 2 0 -150 50 U 50 50 1 1 P 107 | ENDDRAW 108 | ENDDEF 109 | # 110 | # PIC16F15324 111 | # 112 | DEF PIC16F15324 U 0 40 Y Y 1 F N 113 | F0 "U" 650 400 60 H V C CNN 114 | F1 "PIC16F15324" 150 -100 60 H V C CNN 115 | F2 "" 0 550 60 H I C CNN 116 | F3 "" 0 550 60 H I C CNN 117 | DRAW 118 | S -450 450 750 -400 0 1 0 N 119 | X RA5 1 -650 200 200 R 50 50 1 1 I 120 | X RA4 2 -650 100 200 R 50 50 1 1 I 121 | X MCLR/RA3 3 -650 0 200 R 50 50 1 1 I 122 | X RC5 4 -650 -100 200 R 50 50 1 1 I 123 | X RC4 5 -50 -600 200 U 50 50 1 1 I 124 | X RC3 6 50 -600 200 U 50 50 1 1 I 125 | X RC2 7 150 -600 200 U 50 50 1 1 I 126 | X RC1 8 250 -600 200 U 50 50 1 1 I 127 | X RC0 9 950 -100 200 L 50 50 1 1 I 128 | X RA2 10 950 0 200 L 50 50 1 1 I 129 | X RA1/ICSPCLK 11 950 100 200 L 50 50 1 1 I 130 | X RA0/ICSPDAT 12 950 200 200 L 50 50 1 1 I 131 | X VSS 13 250 650 200 D 50 50 1 1 I 132 | X NC 14 150 650 200 D 50 50 1 1 I 133 | X NC 15 50 650 200 D 50 50 1 1 I 134 | X VDD 16 -50 650 200 D 50 50 1 1 I 135 | X PAD 17 -150 650 200 D 50 50 1 1 I 136 | ENDDRAW 137 | ENDDEF 138 | # 139 | # R 140 | # 141 | DEF R R 0 0 N Y 1 F N 142 | F0 "R" 80 0 50 V V C CNN 143 | F1 "R" 0 0 50 V V C CNN 144 | F2 "" -70 0 50 V I C CNN 145 | F3 "" 0 0 50 H I C CNN 146 | $FPLIST 147 | R_* 148 | R_* 149 | $ENDFPLIST 150 | DRAW 151 | S -40 -100 40 100 0 1 10 N 152 | X ~ 1 0 150 50 D 50 50 1 1 P 153 | X ~ 2 0 -150 50 U 50 50 1 1 P 154 | ENDDRAW 155 | ENDDEF 156 | # 157 | # R_Pack04 158 | # 159 | DEF R_Pack04 RN 0 0 Y N 1 F N 160 | F0 "RN" -300 0 50 V V C CNN 161 | F1 "R_Pack04" 200 0 50 V V C CNN 162 | F2 "" 275 0 50 V I C CNN 163 | F3 "" 0 0 50 H I C CNN 164 | $FPLIST 165 | DIP* 166 | SOIC* 167 | $ENDFPLIST 168 | DRAW 169 | S -250 -95 150 95 0 1 10 f 170 | S -225 75 -175 -75 0 1 10 N 171 | S -125 75 -75 -75 0 1 10 N 172 | S -25 75 25 -75 0 1 10 N 173 | S 75 75 125 -75 0 1 10 N 174 | P 2 0 1 0 -200 -100 -200 -75 N 175 | P 2 0 1 0 -200 75 -200 100 N 176 | P 2 0 1 0 -100 -100 -100 -75 N 177 | P 2 0 1 0 -100 75 -100 100 N 178 | P 2 0 1 0 0 -100 0 -75 N 179 | P 2 0 1 0 0 75 0 100 N 180 | P 2 0 1 0 100 -100 100 -75 N 181 | P 2 0 1 0 100 75 100 100 N 182 | X R1.1 1 -200 -200 100 U 50 50 1 1 P 183 | X R2.1 2 -100 -200 100 U 50 50 1 1 P 184 | X R3.1 3 0 -200 100 U 50 50 1 1 P 185 | X R4.1 4 100 -200 100 U 50 50 1 1 P 186 | X R4.2 5 100 200 100 D 50 50 1 1 P 187 | X R3.2 6 0 200 100 D 50 50 1 1 P 188 | X R2.2 7 -100 200 100 D 50 50 1 1 P 189 | X R1.2 8 -200 200 100 D 50 50 1 1 P 190 | ENDDRAW 191 | ENDDEF 192 | # 193 | # TEST_1P 194 | # 195 | DEF TEST_1P J 0 30 N N 1 F N 196 | F0 "J" 0 270 50 H V C CNN 197 | F1 "TEST_1P" 0 200 50 H V C CNN 198 | F2 "" 200 0 50 H I C CNN 199 | F3 "" 200 0 50 H I C CNN 200 | DRAW 201 | C 0 130 30 0 1 0 N 202 | X 1 1 0 0 100 U 50 50 1 1 P 203 | ENDDRAW 204 | ENDDEF 205 | # 206 | # TPS61230 207 | # 208 | DEF TPS61230 U 0 40 Y Y 1 F N 209 | F0 "U" -50 -950 60 H V C CNN 210 | F1 "TPS61230" -50 -250 60 H V C CNN 211 | F2 "" 0 0 60 H I C CNN 212 | F3 "" 0 0 60 H I C CNN 213 | DRAW 214 | S -300 -300 200 -900 0 1 0 N 215 | X SW 1 -500 -450 200 R 50 50 1 1 I 216 | X SW 2 -500 -550 200 R 50 50 1 1 I 217 | X VOUT 3 -500 -650 200 R 50 50 1 1 I 218 | X VOUT 4 -500 -750 200 R 50 50 1 1 I 219 | X PG 5 -500 -850 200 R 50 50 1 1 I 220 | X SS 6 400 -850 200 L 50 50 1 1 I 221 | X FB 7 400 -750 200 L 50 50 1 1 I 222 | X HSYS 8 400 -650 200 L 50 50 1 1 I 223 | X EN 9 400 -550 200 L 50 50 1 1 I 224 | X VIN 10 400 -450 200 L 50 50 1 1 I 225 | X GND 11 400 -350 200 L 50 50 1 1 I 226 | ENDDRAW 227 | ENDDEF 228 | # 229 | # Thermistor 230 | # 231 | DEF Thermistor TH 0 0 N Y 1 F N 232 | F0 "TH" 100 50 50 V V C CNN 233 | F1 "Thermistor" -100 0 50 V V C BNN 234 | F2 "" 0 0 50 H I C CNN 235 | F3 "" 0 0 50 H I C CNN 236 | $FPLIST 237 | R_* 238 | SM0603 239 | SM0805 240 | $ENDFPLIST 241 | DRAW 242 | S -40 100 40 -100 0 1 8 N 243 | P 5 0 1 10 -75 125 -75 75 75 -75 75 -125 75 -125 N 244 | X ~ 1 0 200 100 D 50 50 1 1 P 245 | X ~ 2 0 -200 100 U 50 50 1 1 P 246 | ENDDRAW 247 | ENDDEF 248 | # 249 | # bq25895m 250 | # 251 | DEF bq25895m U 0 40 Y Y 1 F N 252 | F0 "U" 100 -600 60 H V C CNN 253 | F1 "bq25895m" 100 -750 60 H V C CNN 254 | F2 "" 0 0 60 H I C CNN 255 | F3 "" 0 0 60 H I C CNN 256 | DRAW 257 | S -450 -250 650 -1100 0 1 0 N 258 | X VBUS 1 -650 -450 200 R 50 50 1 1 I 259 | X D+ 2 -650 -550 200 R 50 50 1 1 I 260 | X D- 3 -650 -650 200 R 50 50 1 1 I 261 | X STAT 4 -650 -750 200 R 50 50 1 1 I 262 | X SCL 5 -650 -850 200 R 50 50 1 1 I 263 | X SDA 6 -650 -950 200 R 50 50 1 1 I 264 | X INT 7 -100 -1250 200 U 50 50 1 1 I 265 | X OTG 8 0 -1250 200 U 50 50 1 1 I 266 | X CE 9 100 -1250 200 U 50 50 1 1 I 267 | X ILIM 10 200 -1250 200 U 50 50 1 1 I 268 | X SW 20 300 -50 200 D 50 50 1 1 I 269 | X TS 11 300 -1250 200 U 50 50 1 1 I 270 | X BTST 21 200 -50 200 D 50 50 1 1 I 271 | X QON 12 400 -1250 200 U 50 50 1 1 I 272 | X REGN 22 100 -50 200 D 50 50 1 1 I 273 | X BAT 13 850 -950 200 L 50 50 1 1 I 274 | X PMID 23 0 -50 200 D 50 50 1 1 I 275 | X BAT 14 850 -850 200 L 50 50 1 1 I 276 | X DSEL 24 -100 -50 200 D 50 50 1 1 I 277 | X SYS 15 850 -750 200 L 50 50 1 1 I 278 | X PAD 25 -650 -350 200 R 50 50 1 1 I 279 | X SYS 16 850 -650 200 L 50 50 1 1 I 280 | X PGND 17 850 -550 200 L 50 50 1 1 I 281 | X PGND 18 850 -450 200 L 50 50 1 1 I 282 | X SW 19 400 -50 200 D 50 50 1 1 I 283 | ENDDRAW 284 | ENDDEF 285 | # 286 | # tlv62095 287 | # 288 | DEF tlv62095 U 0 40 Y Y 1 F N 289 | F0 "U" 450 -950 60 H V C CNN 290 | F1 "tlv62095" -450 -950 60 H V C CNN 291 | F2 "" 0 0 60 H I C CNN 292 | F3 "" 0 0 60 H I C CNN 293 | DRAW 294 | S -400 -250 350 -900 0 1 0 N 295 | X SW 1 -600 -450 200 R 50 50 1 1 I 296 | X SW 2 -600 -550 200 R 50 50 1 1 I 297 | X DEF 3 -600 -650 200 R 50 50 1 1 I 298 | X PG 4 -600 -750 200 R 50 50 1 1 I 299 | X FB 5 -150 -1100 200 U 50 50 1 1 I 300 | X AGND 6 -50 -1100 200 U 50 50 1 1 I 301 | X CP 7 50 -1100 200 U 50 50 1 1 I 302 | X CN 8 150 -1100 200 U 50 50 1 1 I 303 | X SS 9 550 -750 200 L 50 50 1 1 I 304 | X AVIN 10 550 -650 200 L 50 50 1 1 I 305 | X PVIN 11 550 -550 200 L 50 50 1 1 I 306 | X PVIN 12 550 -450 200 L 50 50 1 1 I 307 | X EN 13 150 -50 200 D 50 50 1 1 I 308 | X PGND 14 50 -50 200 D 50 50 1 1 I 309 | X PGND 15 -50 -50 200 D 50 50 1 1 I 310 | X VOS 16 -150 -50 200 D 50 50 1 1 I 311 | X PAD 17 -600 -350 200 R 50 50 1 1 I 312 | ENDDRAW 313 | ENDDEF 314 | # 315 | #End Library 316 | -------------------------------------------------------------------------------- /RVLPMS_FIRMWARE/dist/default/production/RVLPMS_FIRMWARE.production.hxl: -------------------------------------------------------------------------------- 1 | ### HEXMate logfile and output summary ### 2 | ### Memory Usage ### 3 | Unused memory ranges: 4 | 6h - 7h 5 | 1000h - 15FFh 6 | 1600h - 1639h 7 | 2000h - FFFFh 8 | 10000h - 1000Dh 9 | 10018h - 1003Fh 10 | 11 | dist/default/production\RVLPMS_FIRMWARE.production.hex ranges: 12 | 0h - 5h 13 | 8h - FFFh 14 | 163Ah - 1FFFh 15 | 1000Eh - 10017h 16 | 17 | ### Hex Memory Map ### 18 | Legend: 19 | - = Unused memory 20 | F = Filled ROM 21 | S = Stored serial code 22 | A = Stored ASCII string 23 | R = Reserved for checksum 24 | C = Stored checksum result 25 | T = Trailing code 26 | & = Find & replace opcode 27 | X = Find & delete opcode 28 | 1 = dist/default/production\RVLPMS_FIRMWARE.production.hex 29 | 00000000: 111111--11111111111111111111111111111111111111111111111111111111 30 | 00000040: 1111111111111111111111111111111111111111111111111111111111111111 31 | 00000080: 1111111111111111111111111111111111111111111111111111111111111111 32 | 000000C0: 1111111111111111111111111111111111111111111111111111111111111111 33 | 00000100: 1111111111111111111111111111111111111111111111111111111111111111 34 | 00000140: 1111111111111111111111111111111111111111111111111111111111111111 35 | 00000180: 1111111111111111111111111111111111111111111111111111111111111111 36 | 000001C0: 1111111111111111111111111111111111111111111111111111111111111111 37 | 00000200: 1111111111111111111111111111111111111111111111111111111111111111 38 | 00000240: 1111111111111111111111111111111111111111111111111111111111111111 39 | 00000280: 1111111111111111111111111111111111111111111111111111111111111111 40 | 000002C0: 1111111111111111111111111111111111111111111111111111111111111111 41 | 00000300: 1111111111111111111111111111111111111111111111111111111111111111 42 | 00000340: 1111111111111111111111111111111111111111111111111111111111111111 43 | 00000380: 1111111111111111111111111111111111111111111111111111111111111111 44 | 000003C0: 1111111111111111111111111111111111111111111111111111111111111111 45 | 00000400: 1111111111111111111111111111111111111111111111111111111111111111 46 | 00000440: 1111111111111111111111111111111111111111111111111111111111111111 47 | 00000480: 1111111111111111111111111111111111111111111111111111111111111111 48 | 000004C0: 1111111111111111111111111111111111111111111111111111111111111111 49 | 00000500: 1111111111111111111111111111111111111111111111111111111111111111 50 | 00000540: 1111111111111111111111111111111111111111111111111111111111111111 51 | 00000580: 1111111111111111111111111111111111111111111111111111111111111111 52 | 000005C0: 1111111111111111111111111111111111111111111111111111111111111111 53 | 00000600: 1111111111111111111111111111111111111111111111111111111111111111 54 | 00000640: 1111111111111111111111111111111111111111111111111111111111111111 55 | 00000680: 1111111111111111111111111111111111111111111111111111111111111111 56 | 000006C0: 1111111111111111111111111111111111111111111111111111111111111111 57 | 00000700: 1111111111111111111111111111111111111111111111111111111111111111 58 | 00000740: 1111111111111111111111111111111111111111111111111111111111111111 59 | 00000780: 1111111111111111111111111111111111111111111111111111111111111111 60 | 000007C0: 1111111111111111111111111111111111111111111111111111111111111111 61 | 00000800: 1111111111111111111111111111111111111111111111111111111111111111 62 | 00000840: 1111111111111111111111111111111111111111111111111111111111111111 63 | 00000880: 1111111111111111111111111111111111111111111111111111111111111111 64 | 000008C0: 1111111111111111111111111111111111111111111111111111111111111111 65 | 00000900: 1111111111111111111111111111111111111111111111111111111111111111 66 | 00000940: 1111111111111111111111111111111111111111111111111111111111111111 67 | 00000980: 1111111111111111111111111111111111111111111111111111111111111111 68 | 000009C0: 1111111111111111111111111111111111111111111111111111111111111111 69 | 00000A00: 1111111111111111111111111111111111111111111111111111111111111111 70 | 00000A40: 1111111111111111111111111111111111111111111111111111111111111111 71 | 00000A80: 1111111111111111111111111111111111111111111111111111111111111111 72 | 00000AC0: 1111111111111111111111111111111111111111111111111111111111111111 73 | 00000B00: 1111111111111111111111111111111111111111111111111111111111111111 74 | 00000B40: 1111111111111111111111111111111111111111111111111111111111111111 75 | 00000B80: 1111111111111111111111111111111111111111111111111111111111111111 76 | 00000BC0: 1111111111111111111111111111111111111111111111111111111111111111 77 | 00000C00: 1111111111111111111111111111111111111111111111111111111111111111 78 | 00000C40: 1111111111111111111111111111111111111111111111111111111111111111 79 | 00000C80: 1111111111111111111111111111111111111111111111111111111111111111 80 | 00000CC0: 1111111111111111111111111111111111111111111111111111111111111111 81 | 00000D00: 1111111111111111111111111111111111111111111111111111111111111111 82 | 00000D40: 1111111111111111111111111111111111111111111111111111111111111111 83 | 00000D80: 1111111111111111111111111111111111111111111111111111111111111111 84 | 00000DC0: 1111111111111111111111111111111111111111111111111111111111111111 85 | 00000E00: 1111111111111111111111111111111111111111111111111111111111111111 86 | 00000E40: 1111111111111111111111111111111111111111111111111111111111111111 87 | 00000E80: 1111111111111111111111111111111111111111111111111111111111111111 88 | 00000EC0: 1111111111111111111111111111111111111111111111111111111111111111 89 | 00000F00: 1111111111111111111111111111111111111111111111111111111111111111 90 | 00000F40: 1111111111111111111111111111111111111111111111111111111111111111 91 | 00000F80: 1111111111111111111111111111111111111111111111111111111111111111 92 | 00000FC0: 1111111111111111111111111111111111111111111111111111111111111111 93 | 00001600: ----------------------------------------------------------111111 94 | 00001640: 1111111111111111111111111111111111111111111111111111111111111111 95 | 00001680: 1111111111111111111111111111111111111111111111111111111111111111 96 | 000016C0: 1111111111111111111111111111111111111111111111111111111111111111 97 | 00001700: 1111111111111111111111111111111111111111111111111111111111111111 98 | 00001740: 1111111111111111111111111111111111111111111111111111111111111111 99 | 00001780: 1111111111111111111111111111111111111111111111111111111111111111 100 | 000017C0: 1111111111111111111111111111111111111111111111111111111111111111 101 | 00001800: 1111111111111111111111111111111111111111111111111111111111111111 102 | 00001840: 1111111111111111111111111111111111111111111111111111111111111111 103 | 00001880: 1111111111111111111111111111111111111111111111111111111111111111 104 | 000018C0: 1111111111111111111111111111111111111111111111111111111111111111 105 | 00001900: 1111111111111111111111111111111111111111111111111111111111111111 106 | 00001940: 1111111111111111111111111111111111111111111111111111111111111111 107 | 00001980: 1111111111111111111111111111111111111111111111111111111111111111 108 | 000019C0: 1111111111111111111111111111111111111111111111111111111111111111 109 | 00001A00: 1111111111111111111111111111111111111111111111111111111111111111 110 | 00001A40: 1111111111111111111111111111111111111111111111111111111111111111 111 | 00001A80: 1111111111111111111111111111111111111111111111111111111111111111 112 | 00001AC0: 1111111111111111111111111111111111111111111111111111111111111111 113 | 00001B00: 1111111111111111111111111111111111111111111111111111111111111111 114 | 00001B40: 1111111111111111111111111111111111111111111111111111111111111111 115 | 00001B80: 1111111111111111111111111111111111111111111111111111111111111111 116 | 00001BC0: 1111111111111111111111111111111111111111111111111111111111111111 117 | 00001C00: 1111111111111111111111111111111111111111111111111111111111111111 118 | 00001C40: 1111111111111111111111111111111111111111111111111111111111111111 119 | 00001C80: 1111111111111111111111111111111111111111111111111111111111111111 120 | 00001CC0: 1111111111111111111111111111111111111111111111111111111111111111 121 | 00001D00: 1111111111111111111111111111111111111111111111111111111111111111 122 | 00001D40: 1111111111111111111111111111111111111111111111111111111111111111 123 | 00001D80: 1111111111111111111111111111111111111111111111111111111111111111 124 | 00001DC0: 1111111111111111111111111111111111111111111111111111111111111111 125 | 00001E00: 1111111111111111111111111111111111111111111111111111111111111111 126 | 00001E40: 1111111111111111111111111111111111111111111111111111111111111111 127 | 00001E80: 1111111111111111111111111111111111111111111111111111111111111111 128 | 00001EC0: 1111111111111111111111111111111111111111111111111111111111111111 129 | 00001F00: 1111111111111111111111111111111111111111111111111111111111111111 130 | 00001F40: 1111111111111111111111111111111111111111111111111111111111111111 131 | 00001F80: 1111111111111111111111111111111111111111111111111111111111111111 132 | 00001FC0: 1111111111111111111111111111111111111111111111111111111111111111 133 | 00010000: --------------1111111111---------------------------------------- 134 | -------------------------------------------------------------------------------- /RVLPMS (OLD)/WiiPMS KiCAD files/Wii reg-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # Device_C 5 | # 6 | DEF Device_C C 0 10 N Y 1 F N 7 | F0 "C" 25 100 50 H V L CNN 8 | F1 "Device_C" 25 -100 50 H V L CNN 9 | F2 "" 38 -150 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | $FPLIST 12 | C_* 13 | $ENDFPLIST 14 | DRAW 15 | P 2 0 1 20 -80 -30 80 -30 N 16 | P 2 0 1 20 -80 30 80 30 N 17 | X ~ 1 0 150 110 D 50 50 1 1 P 18 | X ~ 2 0 -150 110 U 50 50 1 1 P 19 | ENDDRAW 20 | ENDDEF 21 | # 22 | # Device_L 23 | # 24 | DEF Device_L L 0 40 N N 1 F N 25 | F0 "L" -50 0 50 V V C CNN 26 | F1 "Device_L" 75 0 50 V V C CNN 27 | F2 "" 0 0 50 H I C CNN 28 | F3 "" 0 0 50 H I C CNN 29 | $FPLIST 30 | Choke_* 31 | *Coil* 32 | Inductor_* 33 | L_* 34 | $ENDFPLIST 35 | DRAW 36 | A 0 -75 25 -899 899 0 1 0 N 0 -100 0 -50 37 | A 0 -25 25 -899 899 0 1 0 N 0 -50 0 0 38 | A 0 25 25 -899 899 0 1 0 N 0 0 0 50 39 | A 0 75 25 -899 899 0 1 0 N 0 50 0 100 40 | X 1 1 0 150 50 D 50 50 1 1 P 41 | X 2 2 0 -150 50 U 50 50 1 1 P 42 | ENDDRAW 43 | ENDDEF 44 | # 45 | # Device_R 46 | # 47 | DEF Device_R R 0 0 N Y 1 F N 48 | F0 "R" 80 0 50 V V C CNN 49 | F1 "Device_R" 0 0 50 V V C CNN 50 | F2 "" -70 0 50 V I C CNN 51 | F3 "" 0 0 50 H I C CNN 52 | $FPLIST 53 | R_* 54 | $ENDFPLIST 55 | DRAW 56 | S -40 -100 40 100 0 1 10 N 57 | X ~ 1 0 150 50 D 50 50 1 1 P 58 | X ~ 2 0 -150 50 U 50 50 1 1 P 59 | ENDDRAW 60 | ENDDEF 61 | # 62 | # Device_R_Pack04 63 | # 64 | DEF Device_R_Pack04 RN 0 0 Y N 1 F N 65 | F0 "RN" -300 0 50 V V C CNN 66 | F1 "Device_R_Pack04" 200 0 50 V V C CNN 67 | F2 "" 275 0 50 V I C CNN 68 | F3 "" 0 0 50 H I C CNN 69 | $FPLIST 70 | DIP* 71 | SOIC* 72 | $ENDFPLIST 73 | DRAW 74 | S -250 -95 150 95 0 1 10 f 75 | S -225 75 -175 -75 0 1 10 N 76 | S -125 75 -75 -75 0 1 10 N 77 | S -25 75 25 -75 0 1 10 N 78 | S 75 75 125 -75 0 1 10 N 79 | P 2 0 1 0 -200 -100 -200 -75 N 80 | P 2 0 1 0 -200 75 -200 100 N 81 | P 2 0 1 0 -100 -100 -100 -75 N 82 | P 2 0 1 0 -100 75 -100 100 N 83 | P 2 0 1 0 0 -100 0 -75 N 84 | P 2 0 1 0 0 75 0 100 N 85 | P 2 0 1 0 100 -100 100 -75 N 86 | P 2 0 1 0 100 75 100 100 N 87 | X R1.1 1 -200 -200 100 U 50 50 1 1 P 88 | X R2.1 2 -100 -200 100 U 50 50 1 1 P 89 | X R3.1 3 0 -200 100 U 50 50 1 1 P 90 | X R4.1 4 100 -200 100 U 50 50 1 1 P 91 | X R4.2 5 100 200 100 D 50 50 1 1 P 92 | X R3.2 6 0 200 100 D 50 50 1 1 P 93 | X R2.2 7 -100 200 100 D 50 50 1 1 P 94 | X R1.2 8 -200 200 100 D 50 50 1 1 P 95 | ENDDRAW 96 | ENDDEF 97 | # 98 | # Device_Thermistor 99 | # 100 | DEF Device_Thermistor TH 0 0 N Y 1 F N 101 | F0 "TH" 100 50 50 V V C CNN 102 | F1 "Device_Thermistor" -100 0 50 V V C BNN 103 | F2 "" 0 0 50 H I C CNN 104 | F3 "" 0 0 50 H I C CNN 105 | $FPLIST 106 | R_* 107 | $ENDFPLIST 108 | DRAW 109 | S -40 100 40 -100 0 1 8 N 110 | P 5 0 1 10 -75 125 -75 75 75 -75 75 -125 75 -125 N 111 | X ~ 1 0 200 100 D 50 50 1 1 P 112 | X ~ 2 0 -200 100 U 50 50 1 1 P 113 | ENDDRAW 114 | ENDDEF 115 | # 116 | # Wii-reg-rescue_2N3904-transistors 117 | # 118 | DEF Wii-reg-rescue_2N3904-transistors Q 0 0 Y N 1 F N 119 | F0 "Q" 200 75 50 H V L CNN 120 | F1 "Wii-reg-rescue_2N3904-transistors" 200 0 50 H V L CNN 121 | F2 "TO_SOT_Packages_THT:TO-92_Molded_Narrow" 200 -75 50 H I L CIN 122 | F3 "" 0 0 50 H I L CNN 123 | $FPLIST 124 | TO?92* 125 | $ENDFPLIST 126 | DRAW 127 | C 50 0 111 0 1 10 N 128 | P 2 0 1 0 25 25 100 100 N 129 | P 3 0 1 0 25 -25 100 -100 100 -100 N 130 | P 3 0 1 20 25 75 25 -75 25 -75 N 131 | P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F 132 | X E 1 100 -200 100 U 50 50 1 1 P 133 | X B 2 -200 0 225 R 50 50 1 1 P 134 | X C 3 100 200 100 D 50 50 1 1 P 135 | ENDDRAW 136 | ENDDEF 137 | # 138 | # Wii-reg-rescue_Conn_01x05-conn 139 | # 140 | DEF Wii-reg-rescue_Conn_01x05-conn J 0 40 Y N 1 F N 141 | F0 "J" 0 300 50 H V C CNN 142 | F1 "Wii-reg-rescue_Conn_01x05-conn" 0 -300 50 H V C CNN 143 | F2 "" 0 0 50 H I C CNN 144 | F3 "" 0 0 50 H I C CNN 145 | $FPLIST 146 | Connector*:*_??x*mm* 147 | Connector*:*1x??x*mm* 148 | Pin?Header?Straight?1X* 149 | Pin?Header?Angled?1X* 150 | Socket?Strip?Straight?1X* 151 | Socket?Strip?Angled?1X* 152 | $ENDFPLIST 153 | DRAW 154 | S -50 -195 0 -205 1 1 6 N 155 | S -50 -95 0 -105 1 1 6 N 156 | S -50 5 0 -5 1 1 6 N 157 | S -50 105 0 95 1 1 6 N 158 | S -50 205 0 195 1 1 6 N 159 | S -50 250 50 -250 1 1 10 f 160 | X Pin_1 1 -200 200 150 R 50 50 1 1 P 161 | X Pin_2 2 -200 100 150 R 50 50 1 1 P 162 | X Pin_3 3 -200 0 150 R 50 50 1 1 P 163 | X Pin_4 4 -200 -100 150 R 50 50 1 1 P 164 | X Pin_5 5 -200 -200 150 R 50 50 1 1 P 165 | ENDDRAW 166 | ENDDEF 167 | # 168 | # Wii-reg-rescue_TEST_1P-conn 169 | # 170 | DEF Wii-reg-rescue_TEST_1P-conn J 0 30 N N 1 F N 171 | F0 "J" 0 270 50 H V C CNN 172 | F1 "Wii-reg-rescue_TEST_1P-conn" 0 200 50 H V C CNN 173 | F2 "" 200 0 50 H I C CNN 174 | F3 "" 200 0 50 H I C CNN 175 | DRAW 176 | C 0 130 30 0 1 0 N 177 | X 1 1 0 0 100 U 50 50 1 1 P 178 | ENDDRAW 179 | ENDDEF 180 | # 181 | # Wii-reg-rescue_TPS61230-tps61230 182 | # 183 | DEF Wii-reg-rescue_TPS61230-tps61230 U 0 40 Y Y 1 F N 184 | F0 "U" -50 -950 60 H V C CNN 185 | F1 "Wii-reg-rescue_TPS61230-tps61230" -50 -250 60 H V C CNN 186 | F2 "" 0 0 60 H I C CNN 187 | F3 "" 0 0 60 H I C CNN 188 | DRAW 189 | S -300 -300 200 -900 0 1 0 N 190 | X SW 1 -500 -450 200 R 50 50 1 1 I 191 | X VIN 10 400 -450 200 L 50 50 1 1 I 192 | X GND 11 400 -350 200 L 50 50 1 1 I 193 | X SW 2 -500 -550 200 R 50 50 1 1 I 194 | X VOUT 3 -500 -650 200 R 50 50 1 1 I 195 | X VOUT 4 -500 -750 200 R 50 50 1 1 I 196 | X PG 5 -500 -850 200 R 50 50 1 1 I 197 | X SS 6 400 -850 200 L 50 50 1 1 I 198 | X FB 7 400 -750 200 L 50 50 1 1 I 199 | X HSYS 8 400 -650 200 L 50 50 1 1 I 200 | X EN 9 400 -550 200 L 50 50 1 1 I 201 | ENDDRAW 202 | ENDDEF 203 | # 204 | # Wii-reg-rescue_bq25895m-bq25895m 205 | # 206 | DEF Wii-reg-rescue_bq25895m-bq25895m U 0 40 Y Y 1 F N 207 | F0 "U" 100 -600 60 H V C CNN 208 | F1 "Wii-reg-rescue_bq25895m-bq25895m" 100 -750 60 H V C CNN 209 | F2 "" 0 0 60 H I C CNN 210 | F3 "" 0 0 60 H I C CNN 211 | DRAW 212 | S -450 -250 650 -1100 0 1 0 N 213 | X VBUS 1 -650 -450 200 R 50 50 1 1 I 214 | X ILIM 10 200 -1250 200 U 50 50 1 1 I 215 | X TS 11 300 -1250 200 U 50 50 1 1 I 216 | X QON 12 400 -1250 200 U 50 50 1 1 I 217 | X BAT 13 850 -950 200 L 50 50 1 1 I 218 | X BAT 14 850 -850 200 L 50 50 1 1 I 219 | X SYS 15 850 -750 200 L 50 50 1 1 I 220 | X SYS 16 850 -650 200 L 50 50 1 1 I 221 | X PGND 17 850 -550 200 L 50 50 1 1 I 222 | X PGND 18 850 -450 200 L 50 50 1 1 I 223 | X SW 19 400 -50 200 D 50 50 1 1 I 224 | X D+ 2 -650 -550 200 R 50 50 1 1 I 225 | X SW 20 300 -50 200 D 50 50 1 1 I 226 | X BTST 21 200 -50 200 D 50 50 1 1 I 227 | X REGN 22 100 -50 200 D 50 50 1 1 I 228 | X PMID 23 0 -50 200 D 50 50 1 1 I 229 | X DSEL 24 -100 -50 200 D 50 50 1 1 I 230 | X PAD 25 -650 -350 200 R 50 50 1 1 I 231 | X D- 3 -650 -650 200 R 50 50 1 1 I 232 | X STAT 4 -650 -750 200 R 50 50 1 1 I 233 | X SCL 5 -650 -850 200 R 50 50 1 1 I 234 | X SDA 6 -650 -950 200 R 50 50 1 1 I 235 | X INT 7 -100 -1250 200 U 50 50 1 1 I 236 | X OTG 8 0 -1250 200 U 50 50 1 1 I 237 | X CE 9 100 -1250 200 U 50 50 1 1 I 238 | ENDDRAW 239 | ENDDEF 240 | # 241 | # Wii-reg-rescue_tlv62095-tlv62095 242 | # 243 | DEF Wii-reg-rescue_tlv62095-tlv62095 U 0 40 Y Y 1 F N 244 | F0 "U" 450 -950 60 H V C CNN 245 | F1 "Wii-reg-rescue_tlv62095-tlv62095" -450 -950 60 H V C CNN 246 | F2 "" 0 0 60 H I C CNN 247 | F3 "" 0 0 60 H I C CNN 248 | DRAW 249 | S -400 -250 350 -900 0 1 0 N 250 | X SW 1 -600 -450 200 R 50 50 1 1 I 251 | X AVIN 10 550 -650 200 L 50 50 1 1 I 252 | X PVIN 11 550 -550 200 L 50 50 1 1 I 253 | X PVIN 12 550 -450 200 L 50 50 1 1 I 254 | X EN 13 150 -50 200 D 50 50 1 1 I 255 | X PGND 14 50 -50 200 D 50 50 1 1 I 256 | X PGND 15 -50 -50 200 D 50 50 1 1 I 257 | X VOS 16 -150 -50 200 D 50 50 1 1 I 258 | X PAD 17 -600 -350 200 R 50 50 1 1 I 259 | X SW 2 -600 -550 200 R 50 50 1 1 I 260 | X DEF 3 -600 -650 200 R 50 50 1 1 I 261 | X PG 4 -600 -750 200 R 50 50 1 1 I 262 | X FB 5 -150 -1100 200 U 50 50 1 1 I 263 | X AGND 6 -50 -1100 200 U 50 50 1 1 I 264 | X CP 7 50 -1100 200 U 50 50 1 1 I 265 | X CN 8 150 -1100 200 U 50 50 1 1 I 266 | X SS 9 550 -750 200 L 50 50 1 1 I 267 | ENDDRAW 268 | ENDDEF 269 | # 270 | # pic16f15324_PIC16F15324 271 | # 272 | DEF pic16f15324_PIC16F15324 U 0 40 Y Y 1 F N 273 | F0 "U" 650 400 60 H V C CNN 274 | F1 "pic16f15324_PIC16F15324" 150 -100 60 H V C CNN 275 | F2 "" 0 550 60 H I C CNN 276 | F3 "" 0 550 60 H I C CNN 277 | DRAW 278 | S -450 450 750 -400 0 1 0 N 279 | X RA5 1 -650 200 200 R 50 50 1 1 I 280 | X RA2 10 950 0 200 L 50 50 1 1 I 281 | X RA1/ICSPCLK 11 950 100 200 L 50 50 1 1 I 282 | X RA0/ICSPDAT 12 950 200 200 L 50 50 1 1 I 283 | X VSS 13 250 650 200 D 50 50 1 1 I 284 | X NC 14 150 650 200 D 50 50 1 1 I 285 | X NC 15 50 650 200 D 50 50 1 1 I 286 | X VDD 16 -50 650 200 D 50 50 1 1 I 287 | X PAD 17 -150 650 200 D 50 50 1 1 I 288 | X RA4 2 -650 100 200 R 50 50 1 1 I 289 | X MCLR/RA3 3 -650 0 200 R 50 50 1 1 I 290 | X RC5 4 -650 -100 200 R 50 50 1 1 I 291 | X RC4 5 -50 -600 200 U 50 50 1 1 I 292 | X RC3 6 50 -600 200 U 50 50 1 1 I 293 | X RC2 7 150 -600 200 U 50 50 1 1 I 294 | X RC1 8 250 -600 200 U 50 50 1 1 I 295 | X RC0 9 950 -100 200 L 50 50 1 1 I 296 | ENDDRAW 297 | ENDDEF 298 | # 299 | # power_GND 300 | # 301 | DEF power_GND #PWR 0 0 Y Y 1 F P 302 | F0 "#PWR" 0 -250 50 H I C CNN 303 | F1 "power_GND" 0 -150 50 H V C CNN 304 | F2 "" 0 0 50 H I C CNN 305 | F3 "" 0 0 50 H I C CNN 306 | DRAW 307 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N 308 | X GND 1 0 0 0 D 50 50 1 1 W N 309 | ENDDRAW 310 | ENDDEF 311 | # 312 | #End Library 313 | --------------------------------------------------------------------------------