/* Reflow Oven Controller
*
* Copyright (C) 2020  Mario Hüttel <mario.huettel@gmx.net>
*
* 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 <http://www.gnu.org/licenses/>.
*/

/**
 * @file oven-driver-hwcfg.h
 * @brief hardware configuration for oven PWM driver
 */

#ifndef __OVEN_DRIVER_HWCFG_H__
#define __OVEN_DRIVER_HWCFG_H__

#include <stm32/stm32f4xx.h>

/**
 * @brief Timer to use to generate PWM for oven
 */
#define OVEN_CONTROLLER_PWM_TIMER TIM3

/**
 * @brief Port the oven control output is connected to
 */
#define OVEN_CONTROLLER_PORT GPIOB

/**
 * @brief The Pin number the oven control output is located at
 */
#define OVEN_CONTROLLER_PIN (0)

/**
 * @brief The AHB1ENR Bitmask to enable the clock to the output port #OVEN_CONTROLLER_PORT
 */
#define OVEN_CONTROLLER_PORT_RCC_MASK RCC_AHB1ENR_GPIOBEN

/**
 * @brief The APB1ENR bitmask to enable the #OVEN_CONTROLLER_PWM_TIMER
 */
#define OVEN_CONTROLLER_TIM_RCC_MASK RCC_APB1ENR_TIM3EN

/**
 * @brief The alternate function #OVEN_CONTROLLER_PWM_TIMER's pwm output is located on #OVEN_CONTROLLER_PORT
 */
#define OVEN_CONTROLLER_PIN_ALTFUNC (2)

/**
 * @brief GPIO Port for the safety enable line used by PCB versions > v1.3
 */
#define SSR_SAFETY_EN_PORT GPIOA

#define SSR_SAFETY_EN_PIN (3)

#define SSR_SAFETY_EN_PORT_RCC_MASK RCC_AHB1ENR_GPIOAEN

#endif /* __OVEN_DRIVER_HWCFG_H__ */
