mirror of
https://github.com/Ralim/IronOS.git
synced 2025-07-23 12:23:06 +02:00
* Mock S60 * cleanup * Start refactor of OLED init * Setup timers roughly * Set Vector table offset correctly Update system_stm32f1xx.c * Update OLED.cpp * Update stm32f1xx_hal_msp.c * Update configuration.h * I2C init before GPIO From Errata Update stm32f1xx_hal_msp.c Update Software_I2C.h Allow no hardware I2C * I2C BB run bus unlock at init * cleanups * Software I2C for now * Mildly more graceful Interpolate * Handle is powered by DC Update Power.cpp Update drawPowerSourceIcon.cpp Update configuration.h Update Setup.cpp * Cleanup HomeScreen * Segment remap oled at init * Cleanup * Update MOVThread.cpp * Fix PWM Init * Fix adc2 trigger * Update configs * Fixup warning * Saner default config * Update ThermoModel.cpp * Util for current@voltage * Hub238 warning * Add hub238 handling in power mode * Update USBPDDebug_FUSB.cpp * HUSB238 debug * Hook PSU Limit * Use wrapping section of GRAM for scroll Update OLED.hpp * Update NTC table * Fix HUB voltage picker * Cleanup * Larger tip filter * Calibrate in a bunch closer Update ThermoModel.cpp * Update configuration.h * Update HUB238.cpp * Update configuration.h * Movement Pin * Update BSP.cpp * tim2 irq * Rough timer conversion (adc broken) but movement working * Fix tim2 start * Faster base PWM * Ensure utils grabs config * Add wattage limiter tolerance for device * Speed up PWM and enable PWM current limiting * tune for 12v * Prevent start until PD done * Update configuration.h * Add HUB238 check for have re-negotiated * Adjust timer to avoid noise when its possible
59 lines
2.1 KiB
C++
59 lines
2.1 KiB
C++
/*
|
|
* IRQ.c
|
|
*
|
|
* Created on: 30 May 2020
|
|
* Author: Ralim
|
|
*/
|
|
|
|
#include "IRQ.h"
|
|
#include "Pins.h"
|
|
#include "configuration.h"
|
|
|
|
/*
|
|
* Catch the IRQ that says that the conversion is done on the temperature
|
|
* readings coming in Once these have come in we can unblock the PID so that it
|
|
* runs again
|
|
*/
|
|
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc) {
|
|
static uint8_t counter = 0;
|
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
|
if (hadc == &hadc1) {
|
|
counter++;
|
|
if (counter % 32 == 0) { // 64 = 128ms, 32 = 64ms
|
|
if (pidTaskNotification) {
|
|
vTaskNotifyGiveFromISR(pidTaskNotification, &xHigherPriorityTaskWoken);
|
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
|
|
void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
|
|
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
|
|
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
|
|
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
|
|
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) { FRToSI2C::CpltCallback(); }
|
|
|
|
extern osThreadId POWTaskHandle;
|
|
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
|
(void)GPIO_Pin;
|
|
// Notify POW thread that an irq occured
|
|
if (POWTaskHandle != nullptr) {
|
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
|
xTaskNotifyFromISR(POWTaskHandle, 1, eSetBits, &xHigherPriorityTaskWoken);
|
|
/* Force a context switch if xHigherPriorityTaskWoken is now set to pdTRUE.
|
|
The macro used to do this is dependent on the port and may be called
|
|
portEND_SWITCHING_ISR. */
|
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
|
}
|
|
}
|
|
|
|
bool getFUS302IRQLow() {
|
|
#ifdef POW_PD
|
|
// Return true if the IRQ line is still held low
|
|
return HAL_GPIO_ReadPin(INT_PD_GPIO_Port, INT_PD_Pin) == GPIO_PIN_RESET;
|
|
#else
|
|
return false;
|
|
#endif
|
|
}
|