123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #ifndef _BOARD_H_
- #define _BOARD_H_
- /* Includes */
- #include "main.h"
- /* Type Defs */
- typedef enum {
- Disable = 0,
- Emable = 1
- } dis_en_t;
- /* Defines */
- #define BTN_NUM 3
- #define SWITCH_NUM 5
- #define BTN_PORT GPIOA
- #define SWITCH_PORT GPIOA
- #define BTN1_PIN GPIO_IDR_0
- #define BTN2_PIN GPIO_IDR_1
- #define BTN3_PIN GPIO_IDR_4
- #define SW1_PIN GPIO_IDR_2
- #define SW2_PIN GPIO_IDR_3
- #define SW3_PIN GPIO_IDR_5
- #define SW4_PIN GPIO_IDR_7
- #define SW5_PIN GPIO_IDR_6
- /* Exported macros */
- #define BUZER_ON TIM1->CR1 |= TIM_CR1_CEN
- #define BUZER_OFF TIM1->CR1 &= ~TIM_CR1_CEN
- #define BTN1_STATE (BTN_PORT->IDR & BTN1_PIN)
- #define BTN2_STATE (BTN_PORT->IDR & BTN2_PIN)
- #define BTN3_STATE (BTN_PORT->IDR & BTN3_PIN)
- #define SW1_STATE (SWITCH_PORT->IDR & SW1_PIN)
- #define SW2_STATE (SWITCH_PORT->IDR & SW2_PIN)
- #define SW3_STATE (SWITCH_PORT->IDR & SW3_PIN)
- #define SW4_STATE (SWITCH_PORT->IDR & SW4_PIN)
- #define SW5_STATE (SWITCH_PORT->IDR & SW5_PIN)
- #define BTNS_STATE (BTN_PORT->IDR & (BTN1_PIN | BTN2_PIN | BTN3_PIN))
- #define SWS_STATE (SWITCH_PORT->IDR & (SW1_PIN | SW2_PIN | SW3_PIN | SW4_PIN | SW5_PIN))
- /* Display macros */
- #define HT1632C_CS_ON GPIOA->BRR = (1<<15)
- #define HT1632C_CS_OFF GPIOA->BSRR = (1<<15)
- #define HT1632C_WR_LOW GPIOB->BRR = (1<<3)
- #define HT1632C_WR_HGH GPIOB->BSRR = (1<<3)
- #define HT1632C_DATA_0 GPIOB->BRR = (1<<5)
- #define HT1632C_DATA_1 GPIOB->BSRR = (1<<5)
- /* Exported funcions */
- void Board_Init(void);
- void DMA1_Channel2_3_IRQHandler(void);
- void I2C1_IRQHandler(void);
- void GPIO_SPI_SW(void);
- void GPIO_SPI_HW(void);
- #endif /* _BOARD_H_ */
|