Pull out more QC hooks

This commit is contained in:
Ben V. Brown
2020-05-30 12:05:11 +10:00
parent 2bcebd473e
commit 5bb85a4a32
6 changed files with 739 additions and 782 deletions

View File

@@ -1,8 +1,8 @@
#include "Defines.h"
#include "stdint.h"
#include "UnitSettings.h"
#include "BSP_QC.h"
#include "BSP_Flash.h"
#include "BSP_QC.h"
#include "Defines.h"
#include "UnitSettings.h"
#include "stdint.h"
/*
* BSP.h -- Board Support
*
@@ -15,20 +15,20 @@
extern "C" {
#endif
//Called first thing in main() to init the hardware
// Called first thing in main() to init the hardware
void preRToSInit();
//Called once the RToS has started for any extra work
// Called once the RToS has started for any extra work
void postRToSInit();
// Called to reset the hardware watchdog unit
void resetWatchdog();
//Accepts a output level of 0.. to use to control the tip output PWM
// Accepts a output level of 0.. to use to control the tip output PWM
void setTipPWM(uint8_t pulse);
//Returns the Handle temp in C, X10
// Returns the Handle temp in C, X10
uint16_t getHandleTemperature();
//Returns the Tip temperature ADC reading in raw units
// Returns the Tip temperature ADC reading in raw units
uint16_t getTipRawTemp(uint8_t refresh);
//Returns the main DC input voltage, using the adjustable divisor + sample flag
// Returns the main DC input voltage, using the adjustable divisor + sample flag
uint16_t getInputVoltageX10(uint16_t divisor, uint8_t sample);
// Readers for the two buttons
@@ -40,11 +40,11 @@ uint8_t getButtonB();
// This should toggle the SCL line until SDA goes high to end the current transaction
void unstick_I2C();
//Reboot the IC when things go seriously wrong
// Reboot the IC when things go seriously wrong
void reboot();
//If the user has programmed in a bootup logo, draw it to the screen from flash
//Returns 1 if the logo was printed so that the unit waits for the timeout or button
// If the user has programmed in a bootup logo, draw it to the screen from flash
// Returns 1 if the logo was printed so that the unit waits for the timeout or button
uint8_t showBootLogoIfavailable();
void delay_ms(uint16_t count);

View File

@@ -32,6 +32,9 @@ void QC_Post_Probe_En();
// Check if DM was pulled down
// 1=Pulled down, 0 == pulled high
uint8_t QC_DM_PulledDown();
// Re-sync if required
void QC_resync();
#ifdef __cplusplus
}
#endif

View File

@@ -6,6 +6,8 @@
*/
#include "BSP.h"
#include "Pins.h"
#include "QC3.h"
#include "Settings.h"
#include "stm32f1xx_hal.h"
void QC_DPlusZero_Six() {
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET); // pull down D+
@@ -63,3 +65,10 @@ void QC_Post_Probe_En() {
}
uint8_t QC_DM_PulledDown() { return HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO_PIN_RESET ? 1 : 0; }
void QC_resync() {
#ifdef MODEL_TS80
seekQC((systemSettings.cutoutSetting) ? 120 : 90,
systemSettings.voltageDiv); // Run the QC seek again if we have drifted too much
#endif
}

View File

@@ -0,0 +1,23 @@
#include "BSP.h"
#include "FreeRTOS.h"
#include "QC3.h"
#include "Settings.h"
#include "cmsis_os.h"
#include "main.hpp"
#include "power.hpp"
#include "stdlib.h"
#include "task.h"
void postRToSInit() {
#ifdef MODEL_TS80
startQC(systemSettings.voltageDiv);
while (pidTaskNotification == 0) osDelay(30); // Wait for PID to start
seekQC((systemSettings.cutoutSetting) ? 120 : 90,
systemSettings.voltageDiv); // this will move the QC output to the preferred voltage to start with
#else
while (pidTaskNotification == 0) osDelay(30); // Wait for PID to start
osDelay(200); // wait for accelerometer to stabilize
#endif
}