You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
toaster-oven-bluepill/Core/Src/app_heater.h

52 lines
1.3 KiB

/**
* Heater PWM control & regulation + temp sensing loop
*/
#ifndef BLUEPILLTROUBA_APP_HEATER_H
#define BLUEPILLTROUBA_APP_HEATER_H
#include <stdbool.h>
#include "cmsis_os2.h"
#define MAX_TEMP 400
extern osThreadId_t heaterTskHandle;
void app_task_heater(void *argument);
/// Clear manual override, disable heater for normal mode.
void app_heater_manual_override_clear();
/// Set manual override PWM 0-100%.
/// Also disables heater in the normal mode.
void app_heater_manual_override(int percent);
/// Set heater regulator tuning.
/// Mutex is locked internally.
void app_heater_set_tuning(float p, float i, float d);
/// Get current tuning, passed out via pointers in arguments
void app_heater_get_tuning(float *p, float *i, float *d);
/// Save current tuning to EE
void app_heater_save_tuning();
/// Set heater on/off.
/// Mutex is locked internally.
void app_heater_enable(bool enable);
/// Set heater setpoint
/// Mutex is locked internally.
void app_heater_set_target(float target);
/// Shutdown the heater; This function does not use mutex and just disables the PWM via register access.
void app_heater_emergency_shutdown();
bool app_heater_get_state();
float app_heater_get_target();
float app_heater_get_percent();
#endif //BLUEPILLTROUBA_APP_HEATER_H