reflow-oven-control-sw/stm-firmware/include/reflow-controller/digio.h

68 lines
1.8 KiB
C
Raw Normal View History

2020-02-15 22:09:55 +01:00
/* 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.
*
* GDSII-Converter 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/>.
*/
#ifndef __DIGIO_H__
#define __DIGIO_H__
#include <stdbool.h>
#include <stdint.h>
#include <helper-macros/helper-macros.h>
#define DIGIO_PORT GPIOB
#define DIGIO_RCC_MASK RCC_AHB1ENR_GPIOBEN
#define DIGIO_PINS 4,5,6,7
#ifdef DEBUGBUILD
#define DIGIO_INOUT_DEFAULT 0,0,0,0
#define DIGIO_ALTFUNC_DEFAULT 0,0,0,0
#else
#define DIGIO_INOUT_DEFAULT 0,0,2,2
#define DIGIO_ALTFUNC_DEFAULT 0,0,7,7
#endif
#define BEEPER_PORT GPIOB
#define BEEPER_RCC_MASK RCC_AHB1ENR_GPIOBEN
void digio_setup_default_all();
void digio_setup_pin(uint8_t num, uint8_t in_out, uint8_t alt_func);
void digio_set(uint8_t num, int val);
int digio_get(uint8_t num);
#define LED_PORT GPIOB
#define LED_RCC_MASK RCC_AHB1ENR_GPIOBEN
#define LED_PINS 2,3
void led_setup();
void led_set(uint8_t num, int val);
int led_get(uint8_t num);
#define LOUDSPEAKER_PORT GPIOB
#define LOUDSPEAKER_RCC_MASK RCC_AHB1ENR_GPIOBEN
#define LOUDSPEAKER_PIN 1
void loudspeaker_setup();
void loudspeaker_set(int val);
int loudspeaker_get();
#endif /* __DIGIO_H__ */