/* Reflow Oven Controller * * Copyright (C) 2021 Mario Hüttel * * This file is part of the Reflow Oven Controller Project. * * The reflow oven controller is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * The Reflow Oven Control Firmware is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the reflow oven controller project. * If not, see . */ /** * @addtogroup hw-version-detect * @{ */ #ifndef _HW_VERSION_DETECT_H_ #define _HW_VERSION_DETECT_H_ #include /** * @brief GPIO Port used for hardware version detection */ #define HW_REV_DETECT_GPIO GPIOE /** * @brief RCC Clock register mask used to enable @ref HW_REV_DETECT_GPIO GPIO Port */ #define HW_REV_DETECT_RCC_FIELD RCC_AHB1ENR_GPIOEEN /** * @brief Lowest pin on @ref HW_REV_DETECT_GPIO GPIO Port that shall be used to read in the hardware version */ #define HW_REV_DETECT_PIN_LOW (8U) /** * @brief Highest pin on @ref HW_REV_DETECT_GPIO GPIO Port that shall be used to read in the hardware version */ #define HW_REV_DETECT_PIN_HIGH (15U) /** * @brief PCB/Hardware Revision Type */ enum hw_revision { HW_REV_NOT_DETECTED = 0, /**< @brief The hardware has'nt been detected (yet) */ HW_REV_ERROR = 1, /**< @brief The hardware revision could not be detected due to an internal error */ HW_REV_V1_2 = 120, /**< @brief Hardware Revision v1.2 */ HW_REV_V1_3 = 130, /**< @brief Hardware Revision v1.3 */ }; /** * @brief This function returns the hardware version of the PCB. * * This is used to * determine the feature set of the hardware. So this firmware can be used on all hardwares. * * The first hardware revision supported, is: v1.2 * * The function returns the HW revision as an enum hw_revision. * For v1.2 the return value is 120 (HW_REV_V1_2). * For v1.3 the return value is 130 (HW_REV_V1_3). * * Other return values are not defined yet. * * @return Harware revision */ enum hw_revision get_pcb_hardware_version(void); #endif /* _HW_VERSION_DETECT_H_ */ /** @} */