119 lines
3.4 KiB
C
119 lines
3.4 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* @file : main.h
|
|
* @brief : Header for main.c file.
|
|
* This file contains the common defines of the application.
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
|
* All rights reserved.</center></h2>
|
|
*
|
|
* This software component is licensed by ST under BSD 3-Clause license,
|
|
* the "License"; You may not use this file except in compliance with the
|
|
* License. You may obtain a copy of the License at:
|
|
* opensource.org/licenses/BSD-3-Clause
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
/* USER CODE END Header */
|
|
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef __MAIN_H
|
|
#define __MAIN_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "stm32f1xx_hal.h"
|
|
|
|
/* Private includes ----------------------------------------------------------*/
|
|
/* USER CODE BEGIN Includes */
|
|
|
|
/* USER CODE END Includes */
|
|
|
|
/* Exported types ------------------------------------------------------------*/
|
|
/* USER CODE BEGIN ET */
|
|
struct ui_state {
|
|
uint8_t oldchannel;
|
|
enum {
|
|
UI_STATE_NORMAL = 0,
|
|
UI_STATE_MUTE,
|
|
UI_STATE_SHORT,
|
|
} state;
|
|
|
|
uint8_t gain;
|
|
uint8_t bboost, tboost;
|
|
uint8_t latt, ratt;
|
|
};
|
|
|
|
extern struct ui_state ui_state; // global ui state
|
|
/* USER CODE END ET */
|
|
|
|
/* Exported constants --------------------------------------------------------*/
|
|
/* USER CODE BEGIN EC */
|
|
|
|
/* USER CODE END EC */
|
|
|
|
/* Exported macro ------------------------------------------------------------*/
|
|
/* USER CODE BEGIN EM */
|
|
|
|
/* USER CODE END EM */
|
|
|
|
/* Exported functions prototypes ---------------------------------------------*/
|
|
void Error_Handler(void);
|
|
|
|
void set_input(uint8_t channel);
|
|
int get_input();
|
|
void set_attenuation(uint8_t left, uint8_t right);
|
|
void set_mute(uint8_t mute); //< tries to switch to muted ui state
|
|
int is_muted(); //< returns whether the ui is muted
|
|
void set_short(uint8_t shorted); //< tries to switch to shorted ui state
|
|
int is_shorted();
|
|
|
|
/* USER CODE BEGIN EFP */
|
|
|
|
/* USER CODE END EFP */
|
|
|
|
/* Private defines -----------------------------------------------------------*/
|
|
#define SW7_LED_Pin GPIO_PIN_1
|
|
#define SW7_LED_GPIO_Port GPIOA
|
|
#define SW7_Pin GPIO_PIN_2
|
|
#define SW7_GPIO_Port GPIOA
|
|
#define SW4_LED_Pin GPIO_PIN_3
|
|
#define SW4_LED_GPIO_Port GPIOA
|
|
#define SW4_Pin GPIO_PIN_4
|
|
#define SW4_GPIO_Port GPIOA
|
|
#define SW6_LED_Pin GPIO_PIN_5
|
|
#define SW6_LED_GPIO_Port GPIOA
|
|
#define SW6_Pin GPIO_PIN_6
|
|
#define SW6_GPIO_Port GPIOA
|
|
#define SW3_LED_Pin GPIO_PIN_7
|
|
#define SW3_LED_GPIO_Port GPIOA
|
|
#define SW5_Pin GPIO_PIN_0
|
|
#define SW5_GPIO_Port GPIOB
|
|
#define SW2_Pin GPIO_PIN_1
|
|
#define SW2_GPIO_Port GPIOB
|
|
#define SW2_LED_Pin GPIO_PIN_2
|
|
#define SW2_LED_GPIO_Port GPIOB
|
|
#define SW3_Pin GPIO_PIN_8
|
|
#define SW3_GPIO_Port GPIOA
|
|
#define SW5_LED_Pin GPIO_PIN_9
|
|
#define SW5_LED_GPIO_Port GPIOA
|
|
#define USER_LED_Pin GPIO_PIN_10
|
|
#define USER_LED_GPIO_Port GPIOA
|
|
/* USER CODE BEGIN Private defines */
|
|
|
|
/* USER CODE END Private defines */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __MAIN_H */
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|