Filter returned WFE
This commit is contained in:
@@ -8,7 +8,7 @@ bool FUSB302_present = false;
|
|||||||
void power_probe() {
|
void power_probe() {
|
||||||
// If TS80 probe for QC
|
// If TS80 probe for QC
|
||||||
// If TS100 - noop
|
// If TS100 - noop
|
||||||
#ifdef defined(MODEL_TS80)+defined(MODEL_TS80P)>0
|
#if defined(MODEL_TS80)+defined(MODEL_TS80P)>0
|
||||||
|
|
||||||
startQC(systemSettings.voltageDiv);
|
startQC(systemSettings.voltageDiv);
|
||||||
seekQC((systemSettings.cutoutSetting) ? 120 : 90,
|
seekQC((systemSettings.cutoutSetting) ? 120 : 90,
|
||||||
@@ -18,31 +18,27 @@ void power_probe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void power_check() {
|
void power_check() {
|
||||||
#ifdef defined(MODEL_TS80)+defined(MODEL_TS80P)>0
|
#if defined(MODEL_TS80)+defined(MODEL_TS80P)>0
|
||||||
QC_resync();
|
QC_resync();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
uint8_t usb_pd_detect() {
|
uint8_t usb_pd_detect() {
|
||||||
#ifdef MODEL_TS80P
|
#ifdef MODEL_TS80P
|
||||||
FUSB302_present = fusb302_detect();
|
FUSB302_present = fusb302_detect();
|
||||||
if (FUSB302_present) {
|
GPIO_InitTypeDef GPIO_InitStruct;
|
||||||
GPIO_InitTypeDef GPIO_InitStruct;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
||||||
}
|
|
||||||
return FUSB302_present;
|
return FUSB302_present;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint8_t pd_irq_read() {
|
uint8_t pd_irq_read() {
|
||||||
#ifdef MODEL_TS80P
|
#ifdef MODEL_TS80P
|
||||||
if (FUSB302_present) {
|
return HAL_GPIO_ReadPin(INT_PD_GPIO_Port, INT_PD_Pin) == GPIO_PIN_SET ?
|
||||||
return HAL_GPIO_ReadPin(INT_PD_GPIO_Port, INT_PD_Pin) == GPIO_PIN_SET ?
|
1 : 0;
|
||||||
1 : 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ ResetHandler::hardrst_state ResetHandler::hardrst_reset_layer() {
|
|||||||
|
|
||||||
/* Reset the Protocol RX machine */
|
/* Reset the Protocol RX machine */
|
||||||
ProtocolReceive::notify( PDB_EVT_PRLRX_RESET);
|
ProtocolReceive::notify( PDB_EVT_PRLRX_RESET);
|
||||||
taskYIELD();
|
osDelay(1);
|
||||||
|
|
||||||
/* Reset the Protocol TX machine */
|
/* Reset the Protocol TX machine */
|
||||||
ProtocolTransmit::notify(PDB_EVT_PRLTX_RESET);
|
ProtocolTransmit::notify(PDB_EVT_PRLTX_RESET);
|
||||||
taskYIELD();
|
osDelay(1);
|
||||||
|
|
||||||
/* Continue the process based on what event started the reset. */
|
/* Continue the process based on what event started the reset. */
|
||||||
if (evt & PDB_EVT_HARDRST_RESET) {
|
if (evt & PDB_EVT_HARDRST_RESET) {
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ void InterruptHandler::Thread(const void *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
osDelay(1);
|
||||||
}
|
}
|
||||||
osDelay(1);
|
osDelay(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,7 +278,7 @@
|
|||||||
#define PD_T_PS_TRANSITION (500)
|
#define PD_T_PS_TRANSITION (500)
|
||||||
#define PD_T_SENDER_RESPONSE (27)
|
#define PD_T_SENDER_RESPONSE (27)
|
||||||
#define PD_T_SINK_REQUEST (100)
|
#define PD_T_SINK_REQUEST (100)
|
||||||
#define PD_T_TYPEC_SINK_WAIT_CAP (465+100)
|
#define PD_T_TYPEC_SINK_WAIT_CAP (465)
|
||||||
#define PD_T_PD_DEBOUNCE (15)
|
#define PD_T_PD_DEBOUNCE (15)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ void PolicyEngine::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PolicyEngine::notify(uint32_t notification) {
|
void PolicyEngine::notify(uint32_t notification) {
|
||||||
xTaskNotify(TaskHandle, notification,
|
xTaskNotify(TaskHandle, notification, eNotifyAction::eSetBits);
|
||||||
eNotifyAction::eSetBits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolicyEngine::pe_task(const void *arg) {
|
void PolicyEngine::pe_task(const void *arg) {
|
||||||
@@ -242,6 +241,8 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_eval_cap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PolicyEngine::policy_engine_state PolicyEngine::pe_sink_select_cap() {
|
PolicyEngine::policy_engine_state PolicyEngine::pe_sink_select_cap() {
|
||||||
|
waitForEvent(
|
||||||
|
PDB_EVT_PE_TX_DONE | PDB_EVT_PE_TX_ERR | PDB_EVT_PE_RESET, 0);
|
||||||
/* Transmit the request */
|
/* Transmit the request */
|
||||||
ProtocolTransmit::pushMessage(&_last_dpm_request);
|
ProtocolTransmit::pushMessage(&_last_dpm_request);
|
||||||
//Send indication that there is a message pending
|
//Send indication that there is a message pending
|
||||||
@@ -785,7 +786,7 @@ bool PolicyEngine::heatingAllowed() {
|
|||||||
uint32_t PolicyEngine::waitForEvent(uint32_t mask, uint32_t ticksToWait) {
|
uint32_t PolicyEngine::waitForEvent(uint32_t mask, uint32_t ticksToWait) {
|
||||||
uint32_t pulNotificationValue;
|
uint32_t pulNotificationValue;
|
||||||
xTaskNotifyWait(0x00, mask, &pulNotificationValue, ticksToWait);
|
xTaskNotifyWait(0x00, mask, &pulNotificationValue, ticksToWait);
|
||||||
return pulNotificationValue;
|
return pulNotificationValue & mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PolicyEngine::isPD3_0() {
|
bool PolicyEngine::isPD3_0() {
|
||||||
|
|||||||
@@ -98,9 +98,11 @@ ProtocolReceive::protocol_rx_state ProtocolReceive::protocol_rx_check_messageid(
|
|||||||
|
|
||||||
/* Otherwise, there's either no stored ID or this message has an ID we
|
/* Otherwise, there's either no stored ID or this message has an ID we
|
||||||
* haven't just seen. Transition to the Store_MessageID state. */
|
* haven't just seen. Transition to the Store_MessageID state. */
|
||||||
if (PD_MESSAGEID_GET(&tempMessage) == _rx_messageid) {
|
/*if (PD_MESSAGEID_GET(&tempMessage) == _rx_messageid) {
|
||||||
return PRLRxWaitPHY;
|
return PRLRxWaitPHY;
|
||||||
} else {
|
} else*/
|
||||||
|
|
||||||
|
{
|
||||||
return PRLRxStoreMessageID;
|
return PRLRxStoreMessageID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,16 +254,15 @@ void ProtocolTransmit::thread(const void *args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolTransmit::notify(uint32_t notification) {
|
void ProtocolTransmit::notify(uint32_t notification) {
|
||||||
xTaskNotify(TaskHandle, notification,
|
xTaskNotify(TaskHandle, notification, eNotifyAction::eSetBits);
|
||||||
eNotifyAction::eSetBits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolTransmit::init() {
|
void ProtocolTransmit::init() {
|
||||||
messagesWaiting = xQueueCreateStatic(PDB_MSG_POOL_SIZE,
|
messagesWaiting = xQueueCreateStatic(PDB_MSG_POOL_SIZE,
|
||||||
sizeof(union pd_msg), ucQueueStorageArea, &xStaticQueue);
|
sizeof(union pd_msg), ucQueueStorageArea, &xStaticQueue);
|
||||||
|
|
||||||
osThreadStaticDef(pd_txTask, thread,osPriorityAboveNormal, 0, TaskStackSize,
|
osThreadStaticDef(pd_txTask, thread, PDB_PRIO_PRL, 0,
|
||||||
TaskBuffer, &TaskControlBlock);
|
TaskStackSize, TaskBuffer, &TaskControlBlock);
|
||||||
TaskHandle = osThreadCreate(osThread(pd_txTask), NULL);
|
TaskHandle = osThreadCreate(osThread(pd_txTask), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,5 +282,5 @@ void ProtocolTransmit::getMessage() {
|
|||||||
uint32_t ProtocolTransmit::waitForEvent(uint32_t mask, uint32_t ticksToWait) {
|
uint32_t ProtocolTransmit::waitForEvent(uint32_t mask, uint32_t ticksToWait) {
|
||||||
uint32_t pulNotificationValue;
|
uint32_t pulNotificationValue;
|
||||||
xTaskNotifyWait(0x00, mask, &pulNotificationValue, ticksToWait);
|
xTaskNotifyWait(0x00, mask, &pulNotificationValue, ticksToWait);
|
||||||
return pulNotificationValue;
|
return pulNotificationValue & mask;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ int main(void) {
|
|||||||
usb_pd_available = usb_pd_detect();
|
usb_pd_available = usb_pd_detect();
|
||||||
resetWatchdog();
|
resetWatchdog();
|
||||||
settingsWereReset = restoreSettings(); // load the settings from flash
|
settingsWereReset = restoreSettings(); // load the settings from flash
|
||||||
if (MMA8652FC::detect()) {
|
/*if (MMA8652FC::detect()) {
|
||||||
PCBVersion = 1;
|
PCBVersion = 1;
|
||||||
MMA8652FC::initalize(); // this sets up the I2C registers
|
MMA8652FC::initalize(); // this sets up the I2C registers
|
||||||
} else if (LIS2DH12::detect()) {
|
} else if (LIS2DH12::detect()) {
|
||||||
PCBVersion = 2;
|
PCBVersion = 2;
|
||||||
// Setup the ST Accelerometer
|
// Setup the ST Accelerometer
|
||||||
LIS2DH12::initalize(); // startup the accelerometer
|
LIS2DH12::initalize(); // startup the accelerometer
|
||||||
} else {
|
} else*/{
|
||||||
PCBVersion = 3;
|
PCBVersion = 3;
|
||||||
systemSettings.SleepTime = 0;
|
systemSettings.SleepTime = 0;
|
||||||
systemSettings.ShutdownTime = 0; // No accel -> disable sleep
|
systemSettings.ShutdownTime = 0; // No accel -> disable sleep
|
||||||
|
|||||||
Reference in New Issue
Block a user