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
This commit is contained in:
Ben V. Brown
2021-10-02 14:48:58 +10:00
committed by GitHub
parent 04ad5a3bfc
commit 3594604efc
114 changed files with 3099 additions and 6434 deletions

View File

@@ -23,7 +23,7 @@ static void settings_displayInputMinVRange(void);
#ifdef POW_QC
static void settings_displayQCInputV(void);
#endif
#ifdef POW_PD
#if POW_PD
static void settings_displayPDNegTimeout(void);
#endif
#ifndef NO_SLEEP_MODE
@@ -159,7 +159,7 @@ const menuitem powerMenu[] = {
#ifdef POW_QC
{SETTINGS_DESC(SettingsItemIndex::QCMaxVoltage), nullptr, settings_displayQCInputV, nullptr, SettingsOptions::QCIdealVoltage}, /*Voltage input*/
#endif
#ifdef POW_PD
#if POW_PD
{SETTINGS_DESC(SettingsItemIndex::PDNegTimeout), nullptr, settings_displayPDNegTimeout, nullptr, SettingsOptions::PDNegTimeout}, /*PD timeout setup*/
#endif
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE
@@ -336,7 +336,7 @@ static void settings_displayQCInputV(void) {
#endif
#ifdef POW_PD
#if POW_PD
static void settings_displayPDNegTimeout(void) {
printShortDescription(SettingsItemIndex::PDNegTimeout, 5);

View File

@@ -48,7 +48,7 @@ int main(void) {
osThreadStaticDef(PIDTask, startPIDTask, osPriorityRealtime, 0, PIDTaskStackSize, PIDTaskBuffer, &PIDTaskControlBlock);
PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL);
/* definition and creation of POWTask - Power management for QC */
/* definition and creation of POWTask - Power management for QC / PD */
osThreadStaticDef(POWTask, startPOWTask, osPriorityAboveNormal, 0, POWTaskStackSize, POWTaskBuffer, &POWTaskControlBlock);
POWTaskHandle = osThreadCreate(osThread(POWTask), NULL);

View File

@@ -49,7 +49,7 @@ uint32_t availableW10(uint8_t sample) {
// R = R*10
// P therefore is in V^2*100/R*10 = W*10.
uint32_t v = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), sample); // 100 = 10v
uint32_t availableWattsX10 = (v * v) / tipResistance;
uint32_t availableWattsX10 = (v * v) / TIP_RESISTANCE;
// However, 100% duty cycle is not possible as there is a dead time while the ADC takes a reading
// Therefore need to scale available milliwats by this