48 lines
1022 B
C
48 lines
1022 B
C
#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__ */
|