Commit Graph

11 Commits

Author SHA1 Message Date
Ben V. Brown
1771aa1c6d re-negotiate PD post tip measurement 2025-07-17 19:37:49 +10:00
Arturo
9ea71bc4d2 USB-PD Support for Sequre S60P (#1883)
* Basic Init

* Rought implementation of fs2711 usb pd interface

* Rought implementation of fs2711 usb pd interface

* Still needs work overcurrent protection keeps getting tripped

* New pdo selection logic

* Update push.yml

* Update push.yml

* Update push.yml

* Update Makefile

* Adds PPS

* Removed unused define

* Adds PPS

* Apply suggestions from code review

Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com>

* Code review changes

* Added osDelay include

* New line alignment for S60 softwarei2c

* Code review

* Fixes code review stuff

* code review changes

* Change voltage limit to 20 as that's what the device is rated for

* Shortened wait time for usb pd

* Fixed issues that cuase S60P to restart constantly

* fixing minimal OLED brightness

With the current settings, the OLED turns off if the first level is selected.

* Adds protocol to s60p debug menu

* loosened fs2711 protocol selection timing

* Adds PDO register reading to negotiation logic

* Fixes FS2711 timeout issue and cleans up driver

* Adds FS2711 protocol negotiation to power loop

* Removed uneeded define

* Reverts changes to Font.h and adds clang-format comments

---------

Co-authored-by: Ben V. Brown <Ralim@Ralimtek.com>
Co-authored-by: discip <53649486+discip@users.noreply.github.com>
Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com>
2024-02-25 22:04:48 +11:00
Ivan Zorin
d95af7d1a0 clang-format implementation (#1740)
* Testing clang-format style check using github CI

* github/push: implement check-style for clang-format as a separate build step

* github/push: add missing packages for check-style/clang-format build step

* source/Makefile: check-style - reduce files of interest; update .clang-format to keep enums init

* source/Makefile: empty lines, spaces & tabs refactoring to unify style - part 1 out of N

* source/Makefile: fix formatting for multi-line variables

* source/Makefile: update formatting for multi-line variables

* source/Makefile: remove spaces on vars assignments to unify style

* source/Makefile: remove unused target style

* source/Makefile: implement exclude vars for clang-format related files

* source/Makefile: exclude configuration.h from clang-format check

* Dockerfile: add diffutils in a container to make check-style target using advanced version of diff to get more advanced output to parse & navigate log more easily

* source/Makefile: implement parser for clang-format inside check-style target to make output compatible with gcc-like error compilation format for compatibility with IDEs/editors for easy navigation over files to fix style errors

* source/Makefile: probably final touches on unifying style

* source/Makefile: implement check-style-list target to only list affected file names with wrong code style for debug purposes

* source/Makefile: fix missed spaces

* deploy.sh: add helper routine to deal with clang-format error output logging from makefile

* gitignore: add clang-format log explicitly

* Refactoring for clang-format compiance

* Dockerfile: add sed

* Dockerfile: false alarm - remove sed since busybox-sed seems fine

* source/Makefile: reduce calls of clang-format & make error log more clean, clear, and tidy

* deploy.sh:check_style() - add removal of DOS EOLs for generated log

* source/Makefile:check-style: add more empty lines between blocks with errors for readability when suggestion is too long & heavy

* source/Makefile: add STOP var to check-style for exit on first failed file

* source/Makefile: check-style: make log looks more like traditional diff/patch output

* source/Core/BSP/Pinecilv2/MemMang/heap_5.c: clang-format refactoring using reasonable advises ... and then disable it in Makefile from scanning by clang-format

* Return headers include order

* clang-format config: disable warnings about non-alphabetic include order

* clang-format refactoring

* clang-format refactoring, part 2

* clang-format refactoring, part 3

* settingsGUI.cpp: refactoring, part 1

* settingsGUI.cpp: refactoring, part 2

* settingsGUI.cpp: refactoring, part 3

* settingsGUI.cpp: refactoring, part 4

* clang-format should be happy now

* workflows/push: put readme check into separate build step & update style

* clang-format: giving SortIncludes option second chance by tweaking a couple of headers a bit

* source/Makefile: check-style: add homebrew parser to check for { } in conditional blocks

* homebrew-format: add { } for if/else, while, and for & unify some comments style; left two errors intentionally to debug & improve parser

* source/Makefile: homebrew-format: fix false negative trigger for multi-line condition in if-s

* Sleep.cpp: unify style & comments

* source/Makefile: remove unused debug target
2023-07-16 15:25:30 +10:00
Ben V. Brown
286afad919 S60 Support (#1692)
* Mock S60

* cleanup

* Start refactor of OLED init

* Setup timers roughly

* Set Vector table offset correctly

Update system_stm32f1xx.c

* Update OLED.cpp

* Update stm32f1xx_hal_msp.c

* Update configuration.h

* I2C init before GPIO

From Errata

Update stm32f1xx_hal_msp.c

Update Software_I2C.h

Allow no hardware I2C

* I2C BB run bus unlock at init

* cleanups

* Software I2C for now

* Mildly more graceful Interpolate

* Handle is powered by DC

Update Power.cpp

Update drawPowerSourceIcon.cpp

Update configuration.h

Update Setup.cpp

* Cleanup HomeScreen

* Segment remap oled at init

* Cleanup

* Update MOVThread.cpp

* Fix PWM Init

* Fix adc2 trigger

* Update configs

* Fixup warning

* Saner default config

* Update ThermoModel.cpp

* Util for current@voltage

* Hub238 warning

* Add hub238 handling in power mode

* Update USBPDDebug_FUSB.cpp

* HUSB238 debug

* Hook PSU Limit

* Use wrapping section of GRAM for scroll

Update OLED.hpp

* Update NTC table

* Fix HUB voltage picker

* Cleanup

* Larger tip filter

* Calibrate in a bunch closer

Update ThermoModel.cpp

* Update configuration.h

* Update HUB238.cpp

* Update configuration.h

* Movement Pin

* Update BSP.cpp

* tim2 irq

* Rough timer conversion (adc broken) but movement working

* Fix tim2 start

* Faster base PWM

* Ensure utils grabs config

* Add wattage limiter tolerance for device

* Speed up PWM and enable PWM current limiting

* tune for 12v

* Prevent start until PD done

* Update configuration.h

* Add HUB238 check for have re-negotiated

* Adjust timer to avoid noise when its possible
2023-06-03 20:05:31 +10:00
Ben V. Brown
1fbcdcdf98 Pinecil V2 (#1341)
* Add SDK

* fork

* massaging makefile

* Drop git module

* Bring in sdk as its broken

Far, Far to much crap to fix with regex now

* Remove bl706

* rf_para_flash_t is missing defs

* Remove crapton of junk

* Remove yet more

* Poking I2C

* Update peripheral_config.h

* Update pinmux_config.h

* Update preRTOS.cpp

* Update main.hpp

* Setup template

* Verbose boot

* I2C ish

* Update I2C_Wrapper.cpp

* Update main.cpp

* Turn off I2C reading for now

* Display running

* Roughing out scheduling timer0

* Starting ADC setup

* Working scheduling of ADC 🎉

* Format adc headers

* Update IRQ.cpp

* Buttons working

* Slow down I2C

* Poking IRQ

* Larger stack required

* Accel on

* Trying to chase down why __libc_init_array isnt working yet

* Working c++

* Cleanup

* Bump stacks

* I2C wake part workaround

* Cleanup

* Working PWM init

* qc draft

* Hookup PWM

* Stable enough ADC

* ADC timing faster + timer without HAL

* Silence

* Remove boot banner

* Tuning in ADC

* Wake PID after ADC

* Remove unused hal

* Draft flash settings

* Working settings save & restore

* Update to prod model

* Cleanup

* NTC thermistor

* Correct adc gain

* Rough tip resistance progress

* Scratch out resistance awareness of the tip

* better adc settings

* Tweaking ADC

* ADC tweaking

* Make adc range scalable

* Update Dockerfile

* Update configuration.h

* Can read same ADC twice in a row

* ADC Setup

* Update PIDThread.cpp

* Lesser adc backoff

* Update USBPD.h

* Add device ID

* Update BSP_Power.h

* Update BSP.cpp

* DrawHex dynamicLength

* Shorter ID padding

* Show validation code

* tip measurement

* Create access for w0w1

* Expose w0 w1

* Enable debug

* crc32

* Device validation

* wip starting epr

* Logic refactor

* Safer PWM Init

* PD cleanups

* Update bl702_pwm.c

* Update power.cpp

* Update usb-pd

* io

* EPR decode

* Better gui for showing pd specs

* Rough handler for capabilities

* EPR

* Fix > 25V input

* Perform pow step after PPS

* Update BSP.cpp

* Fix timer output

* QC3

* Add tip resistance view

* Hold PD negotiation until detection is done for tip res

* Get Thermal mass

* Tip res =0 protection

* Update PIDThread.cpp

* Update GUIThread.cpp

* Rewrite tip resistance measurement

* Update GUIThread.cpp

* Fix fallback

* Far better tip resistance measurement

* Fix QC 0.6V D-

* Convert the interpolator to int32

* Correct the NTC lookup

* Update BSP.cpp

* Update Setup.cpp

* .

Update configuration #defines

More backported functions

* Update usb-pd

* More missed updates

* Refactor BSP

Magic BSP -> PinecilV2
Pine64 BSP -> Pinecil

Update Makefile

* Add Pinecilv2 to CI

* Pinecil v2 multi-lang

Update push.yml

* Update HallSensor.md

* Update README.md

* Fix wrong prestartcheck default

* Fix logo mapping

* Update Makefile

* Remove unused font block

* Style

* Style

* Remove unused timer funcs

* More culling TS80P

* Revert "More culling TS80P"

This reverts commit 2078b89be7.

* Revert "Remove unused timer funcs"

This reverts commit 0c693a89cc.

* Make VBus check maskable

* Remove DMA half transfer

* Drop using brightness and invert icons and go back to text

Saves flash space

* Refactor settings UI drawing descriptions

* Shorten setting function names

* Store bin file assets

* Fix MHP prestart
2022-08-19 15:39:37 +10:00
Ben V. Brown
3594604efc Fixes for I2C on Pinecil + USB-PD stack (#1099)
* Remove unused includes

* Adding in submodule

* Move fusb functions to the BSP

* Remove old code

* Creating IronOS PD integration wrapper

* Redirect to wrapper

* pd lib updates

* fix Docker build

* Finish linking across

* Cleanup

* Update Makefile

* Update push.yml

* Update push.yml

* PD -> Compensate for different tick rates

* Update codeql-analysis.yml

* Fix PD #define for @Firebie

* Check irq low at start

* Update BSP.h

* Update main.cpp

* Closer delay

* Update OLED.cpp

* Bugfix trying to start QC too early

* Missing fusb shouldnt hang qc

* Update FreeRTOSConfig.h

* Update the GD drivers

* Update Pinecil IRQ setup

* Redirect printf() to uart

* Update Power.cpp

* Adding extras to PD state

* Update USBPD.cpp

* Delay in printf

* Iterate once before delay on start

* Update usb-pd

* master usb-pd now

* Format gd libs

* Update gd32vf103_bkp.c

* Guard with PD timeout

* Remove CodeQL

* Slow for testing, fix runt pulses at start

* Fix runt pulse in read size 1

* Cleaner probing setup

* Testing delay during stop gen in read 1

* Update I2C driver

* Update gd32vf103_i2c.c

* Cleaning up i2c wrapper a little, given up on dma for rx

* Update preRTOS.cpp

* Update Setup.cpp

* Update MOVThread.cpp

* Slow down UART to work with new clock config

* Better ack setup for 2 byte read

* Cleanup POW_PD so cant be lost in #includes

* tipResistance -> TIP_RESISTANCE

* handle NOP race on len==2

* Update configuration.h

* Dont use neg timeout to mask anymore

* Not required for MHP

* Fix up source display Miniware

* Fix race on PD init

* Update POWThread.cpp

* Update formatting

* MHP format

* Update push.yml

* Faster TS80P I2C

* Bugfix for IRQ handlers

* Correctly handle I2C race on PD access

* Fix CI error (unused var) and MHP IRQ

* Test Pinecil alt ADC mode
2021-10-02 14:48:58 +10:00
Ben V. Brown
22c5f6d361 Cleanup FUSB setup 2021-04-08 21:20:25 +10:00
Ben V. Brown
16ac45d74a Update POWThread.cpp 2021-04-05 15:04:59 +10:00
Ben V. Brown
d7e7469d3d Update POWThread.cpp 2021-04-05 13:09:11 +10:00
Ben V. Brown
f786901da0 Formatting the C/C++ files 2021-01-17 10:48:52 +11:00
Ben V. Brown
184b2c909f ./workspace/TS100 -> ./source/ 2021-01-17 09:43:55 +11:00