123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- #ifndef __MAIN_H
- #define __MAIN_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "stm32g0xx_ll_dma.h"
- #include "stm32g0xx.h"
- #include "stm32g0xx_ll_i2c.h"
- #include "stm32g0xx_ll_rcc.h"
- #include "stm32g0xx_ll_bus.h"
- #include "stm32g0xx_ll_system.h"
- #include "stm32g0xx_ll_exti.h"
- #include "stm32g0xx_ll_cortex.h"
- #include "stm32g0xx_ll_utils.h"
- #include "stm32g0xx_ll_pwr.h"
- #include "stm32g0xx_ll_spi.h"
- #include "stm32g0xx_ll_tim.h"
- #include "stm32g0xx_ll_gpio.h"
- #if defined(USE_FULL_ASSERT)
- #include "stm32_assert.h"
- #endif
- #include "gpio.h"
- #include "ds3231.h"
- #include "bme280.h"
- #include "rtos.h"
- typedef enum {
- DOWN = 0,
- UP = 1
- } updown_t;
- typedef enum {
- OFF = 0,
- ON = 1
- } onoff_t;
- volatile struct {
- uint32_t RTC_IRQ: 1;
- uint32_t SPI_TX_End: 1;
- uint32_t I2C_TX_End: 1;
- uint32_t I2C_RX_End: 1;
- uint32_t I2C_TX_Err: 1;
- uint32_t I2C_RX_Err: 1;
- uint32_t BME280: 1;
- uint32_t _reserv: 25;
- } Flag;
- typedef union {
- uint16_t u16;
- int16_t i16;
- struct {
- #ifdef LITTLE_ENDIAN
- uint8_t u8L;
- uint8_t u8H;
- #else
- uint8_t u8H;
- uint8_t u8L;
- #endif
- } s16;
- } nt16;
- typedef union {
- uint32_t u32;
- int32_t i32;
- struct {
- #ifdef LITTLE_ENDIAN
- uint16_t u16L;
- uint16_t u16H;
- #else
- uint16_t u16H;
- uint16_t u16L;
- #endif
- } s32;
- } nt32;
- #define I2C_RET_OK (int8_t)0
- #define I2C_RET_NACK (int8_t)-1
- #define I2C_RET_TOUT (int8_t)-2
- #define I2C_SHT_ADDR 0x80
- #define SHT_SOFT_RST 0xFE
- #define SHT_STRT_HUMD 0xF5
- #define SHT_STRT_TEMP 0xF3
- #define SHT_DATA_LEN 3
- #define LATCH_DOWN GPIOA->BRR = 0x8000
- #define LATCH_UP GPIOA->BSRR = 0x8000
- #define TUBE_PWR_ON GPIOA->BRR = 0x10
- #define TUBE_PWR_OFF GPIOA->BSRR = 0x10
- #define IN15_P GPIOA->BSRR = 0x1
- #define IN15_Plus GPIOA->BSRR = 0x2
- #define IN15_Minus GPIOA->BSRR = 0x4
- #define IN15_Percent GPIOA->BSRR = 0x8
- #define IN15_OFF GPIOA->BRR = 0xF
- #define COLOR_R(x) TIM3->CCR1 = x
- #define COLOR_B(x) TIM3->CCR2 = x
- #define COLOR_G(x) TIM3->CCR3 = x
- #define COLOR_RGB(r, g, b) TIM3->CCR1 = r; TIM3->CCR3 = g; TIM3->CCR2 = b
- void Error_Handler(void);
- #define LC0_Pin LL_GPIO_PIN_0
- #define LC0_GPIO_Port GPIOA
- #define LC1_Pin LL_GPIO_PIN_1
- #define LC1_GPIO_Port GPIOA
- #define LC2_Pin LL_GPIO_PIN_2
- #define LC2_GPIO_Port GPIOA
- #define LC3_Pin LL_GPIO_PIN_3
- #define LC3_GPIO_Port GPIOA
- #define SHDN_Pin LL_GPIO_PIN_4
- #define SHDN_GPIO_Port GPIOA
- #define PWM_R_Pin LL_GPIO_PIN_6
- #define PWM_R_GPIO_Port GPIOA
- #define PWM_G_Pin LL_GPIO_PIN_7
- #define PWM_G_GPIO_Port GPIOA
- #define PWM_B_Pin LL_GPIO_PIN_0
- #define PWM_B_GPIO_Port GPIOB
- #define PWM_T_Pin LL_GPIO_PIN_1
- #define PWM_T_GPIO_Port GPIOB
- #define BTN1_Pin LL_GPIO_PIN_8
- #define BTN1_GPIO_Port GPIOA
- #define BTN2_Pin LL_GPIO_PIN_9
- #define BTN2_GPIO_Port GPIOA
- #define BTN3_Pin LL_GPIO_PIN_10
- #define BTN3_GPIO_Port GPIOA
- #define BTN4_Pin LL_GPIO_PIN_11
- #define BTN4_GPIO_Port GPIOA
- #define Latch_Pin LL_GPIO_PIN_15
- #define Latch_GPIO_Port GPIOA
- #define IRQ_Pin LL_GPIO_PIN_8
- #define IRQ_GPIO_Port GPIOB
- #define IRQ_EXTI_IRQn EXTI4_15_IRQn
- #define USE_FULL_LL_DRIVER 1
- #ifdef __cplusplus
- }
- #endif
- #endif
|