/** * \file * * * \brief thermo hardware-specific control functions. * * \author Francesco Sacchi * */ #ifndef HW_THERMO_H #define HW_THERMO_H #include "hw/thermo_map.h" #include #include INLINE ticks_t thermo_hw_timeout(ThermoDev dev) { (void)dev; return 0; } /** * This function should return the temperature set tolerance. */ INLINE deg_t thermo_hw_tolerance(ThermoDev dev) { (void)dev; return 0; } /** * Read the temperature of the hw device \a dev. */ INLINE deg_t thermo_hw_read(ThermoDev dev) { ASSERT(dev < THERMO_CNT); /* Put here the code to read current temperature */ return 0; } /** * Turns off a specific device. * This function is usefull to handle errors. */ INLINE void thermo_hw_off(ThermoDev dev) { ASSERT(dev < THERMO_CNT); /* Put here the code to turn off the thermo device */ } /** * Based on the current temperature \a cur_temp and the target temperature \a target, * this function turns on and off specific thermo device. * It may use also PID control for thermo-regolations. */ INLINE void thermo_hw_set(ThermoDev dev, deg_t target, deg_t cur_temp) { ASSERT(dev < THERMO_CNT); if (target - cur_temp > 0) { /* * We are leveaving the target temperature, so * turn on the thermo device! */ } else { /* * Ok, we are near the target temperature, so * turn off the thermo device! */ } } #define THERMO_HW_INIT _thermo_hw_init() /** * Init hw associated with thermo-control. */ INLINE void _thermo_hw_init(void) { /* Init your devices here! */ } #endif /* HW_THERMO_H */