mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Moving PD framework + big thread cleanup
This commit is contained in:
@@ -51,6 +51,8 @@ uint8_t showBootLogoIfavailable();
|
||||
void delay_ms(uint16_t count);
|
||||
//Used to allow knowledge of if usb_pd is being used
|
||||
uint8_t usb_pd_detect();
|
||||
//Returns 0 when the irq line is pulled down
|
||||
uint8_t pd_irq_read();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
#define SCL2_GPIO_Port GPIOA
|
||||
#define SDA2_Pin GPIO_PIN_1
|
||||
#define SDA2_GPIO_Port GPIOA
|
||||
#define INT_PD_Pin GPIO_PIN_9
|
||||
#define INT_PD_GPIO_Port GPIOA
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#include "BSP_Power.h"
|
||||
#include "QC3.h"
|
||||
#include "Settings.h"
|
||||
#include "FUSB302.h"
|
||||
#include "Pins.h"
|
||||
#include "fusbpd.h"
|
||||
bool FUSB302_present = false;
|
||||
void power_probe() {
|
||||
// If TS80 probe for QC
|
||||
@@ -20,13 +21,6 @@ void power_probe() {
|
||||
void power_check() {
|
||||
#ifdef MODEL_TS80
|
||||
QC_resync();
|
||||
if (FUSB302_present) {
|
||||
pd_run_state_machine();
|
||||
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_9) == GPIO_PIN_RESET) {
|
||||
tcpc_alert();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
uint8_t usb_pd_detect() {
|
||||
@@ -44,3 +38,10 @@ uint8_t usb_pd_detect() {
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
uint8_t pd_irq_read() {
|
||||
#ifdef MODEL_TS80
|
||||
return HAL_GPIO_ReadPin(INT_PD_GPIO_Port, INT_PD_Pin) == GPIO_PIN_SET ?
|
||||
1 : 0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,8 @@
|
||||
#include "stdlib.h"
|
||||
#include "task.h"
|
||||
#include "I2C_Wrapper.hpp"
|
||||
#include "USBC_TCPM/tcpm.h"
|
||||
|
||||
void postRToSInit() {
|
||||
// Any after RTos setup
|
||||
FRToSI2C::FRToSInit();
|
||||
#ifdef MODEL_TS80
|
||||
tcpm_init();
|
||||
osDelay(50);
|
||||
pd_init();
|
||||
osDelay(50);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "Setup.h"
|
||||
#include "Pins.h"
|
||||
#include "I2CBB.hpp"
|
||||
#include "fusbpd.h"
|
||||
void preRToSInit() {
|
||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick.
|
||||
*/
|
||||
@@ -19,5 +20,9 @@ void preRToSInit() {
|
||||
HAL_Delay(50);
|
||||
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
|
||||
HAL_Delay(50);
|
||||
#ifdef MODEL_TS80
|
||||
I2CBB::init();
|
||||
//Spawn all of the USB-C processors
|
||||
fusb302_start_processing();
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user