This commit is contained in:
Ben V. Brown
2022-04-19 18:10:16 +10:00
parent 5853261ddf
commit 2ab5c83e52
3 changed files with 10 additions and 9 deletions

View File

@@ -17,9 +17,7 @@ extern "C" {
SemaphoreHandle_t FRToSI2C::I2CSemaphore = nullptr;
StaticSemaphore_t FRToSI2C::xSemaphoreBuffer;
#define I2C_TIME_OUT (uint16_t)(12000)
void FRToSI2C::CpltCallback() {
// TODO
}
void FRToSI2C::CpltCallback() {} // Not used
bool FRToSI2C::I2C_RegisterWrite(uint8_t address, uint8_t reg, uint8_t data) { return Mem_Write(address, reg, &data, 1); }

View File

@@ -173,7 +173,7 @@ void setTipPWM(const uint8_t pulse, const bool shouldUseFastModePWM) {
// disabled if the PID task is not scheduled often enough.
pendingPWM = pulse;
fastPWM = shouldUseFastModePWM;
MSG((char *)"PWM Output %d, %d\r\n", pulse, (int)shouldUseFastModePWM);
// MSG((char *)"PWM Output %d, %d\r\n", pulse, (int)shouldUseFastModePWM);
}
extern osThreadId POWTaskHandle;
@@ -213,10 +213,14 @@ bool getFUS302IRQLow() {
return false;
// return (RESET == gpio_input_bit_get(FUSB302_IRQ_GPIO_Port, FUSB302_IRQ_Pin));
}
uint16_t rescaleADC(const uint16_t value) {
uint32_t temp = value * 33;
uint16_t res = temp / 32;
return res;
}
uint16_t getADCHandleTemp(uint8_t sample) { return rescaleADC(ADC_Temp.average() >> 1); }
uint16_t getADCHandleTemp(uint8_t sample) { return ADC_Temp.average() >> 1; }
uint16_t getADCVin(uint8_t sample) { return ADC_Vin.average() >> 1; }
uint16_t getADCVin(uint8_t sample) { return rescaleADC(ADC_Vin.average() >> 1); }
// Returns either average or instant value. When sample is set the samples from the injected ADC are copied to the filter and then the raw reading is returned
uint16_t getTipRawTemp(uint8_t sample) { return ADC_Tip.average() >> 2; }
uint16_t getTipRawTemp(uint8_t sample) { return rescaleADC(ADC_Tip.average() >> 2); }

View File

@@ -34,7 +34,6 @@ void startPOWTask(void const *argument __unused) {
#endif
BaseType_t res;
for (;;) {
MSG((char *)"POW Spin\r\n");
res = pdFALSE;
// While the interrupt is low, dont delay
/*This is due to a possible race condition, where: