Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stm32f10x.h>
- #ifndef DWLOS_CONFIG_H
- #define DWLOS_CONFIG_H
- //===============================================================================
- // MK Bus Speed
- //===============================================================================
- #define DWLOS_TIM_PRESCALER 72000
- #define PCLK1 36000000
- #define PCLK2 72000000
- //===============================================================================
- // Queue's size
- //===============================================================================
- #define Task_Turn_Size 30
- #define Timer_Turn_Size 30
- //===============================================================================
- // LOG Configuration
- //===============================================================================
- #define LOG_ACTIVE 1
- #define LOG_DL_INTERVAL 250
- #define LOG_ARR_SIZE 200
- //===============================================================================
- // USART1 Configuration
- //===============================================================================
- #define USART1_RX_BUFFER_SIZE 7
- #define USART1_TX_BUFFER_SIZE 40
- //===============================================================================
- // I2C Configuration
- //===============================================================================
- #define I2C1_STATUS 0
- #define I2C1_MODE I2C_MODE_FAST
- #define I2C1_SPEED 300000
- #define I2C1_MY_ADRESS 0x05
- #define I2C1_M_TX_BUFFER_SIZE 5
- #define I2C1_M_RX_BUFFER_SIZE 10
- #define I2C1_S_TX_BUFFER_SIZE 0
- #define I2C1_S_RX_BUFFER_SIZE 0
- #define I2C2_STATUS 0
- #define I2C2_MODE I2C_MODE_FAST
- #define I2C2_SPEED 400000
- #define I2C2_MY_ADRESS 0x00
- #define I2C2_M_TX_BUFFER_SIZE 0
- #define I2C2_M_RX_BUFFER_SIZE 0
- #define I2C2_S_TX_BUFFER_SIZE 0
- #define I2C2_S_RX_BUFFER_SIZE 0
- //===============================================================================
- // DWLOS Status
- //===============================================================================
- #define TASK_OVERFLOW '$'
- #define TIMER_OVERFLOW '#'
- #define IWG_RELOAD 'W'
- #define PROG_START 'O'
- #define RUN_OS 'S'
- #define STOP_OS 's'
- #define LCD_INIT_BEGIN 'w'
- #define LCD_INIT_END 'W'
- #define I2C_INTERRUPT 'I'
- #define I2C_TRANSMIT 'T'
- #define I2C_MEM_ADR_TRANSMIT 'M'
- #define I2C_FIRST_BYTE_TRANSMIT 'F'
- #define I2C_BYTE_TRANSMITTING 'B'
- #define I2C_BYTE_TRANSMITTED 'b'
- #define I2C_RECEIVE 'R'
- #define I2C_RECEIVE_BEGIN 'r'
- #define I2C_RECEIVE_BYTE 'c'
- #define I2C_RECEIVE_END 'q'
- #define I2C_ASC_OFF 'a'
- #define I2C_END 'X'
- #define I2C_ERROR 'V'
- #define I2C_DEFAULT 'd'
- #define DMA1_RX 'D'
- //===============================================================================
- // LED Pins
- //===============================================================================
- #define LED1_RCC RCC_APB2ENR_IOPBEN
- #define LED1_GPIO GPIOB -> CRL
- #define LED1_CNF GPIO_CRL_CNF0_1 | GPIO_CRL_CNF0_0
- #define LED1_MODE GPIO_CRL_MODE0_1 | GPIO_CRL_MODE0_0
- #define LED1_ON GPIOB -> BSRR |= GPIO_BSRR_BS0
- #define LED1_OFF GPIOB -> BSRR |= GPIO_BSRR_BR0
- #define LED2_RCC RCC_APB2ENR_IOPBEN
- #define LED2_GPIO GPIOB -> CRL
- #define LED2_CNF GPIO_CRL_CNF1_1 | GPIO_CRL_CNF1_0
- #define LED2_MODE GPIO_CRL_MODE1_1 | GPIO_CRL_MODE1_0
- #define LED2_ON GPIOB -> BSRR |= GPIO_BSRR_BS1
- #define LED2_OFF GPIOB -> BSRR |= GPIO_BSRR_BR1
- #define LED3_RCC RCC_APB2ENR_IOPCEN
- #define LED3_GPIO GPIOC -> CRL
- #define LED3_CNF GPIO_CRL_CNF5_1 | GPIO_CRL_CNF5_0
- #define LED3_MODE GPIO_CRL_MODE5_1 | GPIO_CRL_MODE5_0
- #define LED3_ON GPIOC -> BSRR |= GPIO_BSRR_BS5
- #define LED3_OFF GPIOC -> BSRR |= GPIO_BSRR_BR5
- #define LED4_RCC RCC_APB2ENR_IOPCEN
- #define LED4_GPIO GPIOC -> CRL
- #define LED4_CNF GPIO_CRL_CNF4_1 | GPIO_CRL_CNF4_0
- #define LED4_MODE GPIO_CRL_MODE4_1 | GPIO_CRL_MODE4_0
- #define LED4_ON GPIOC -> BSRR |= GPIO_BSRR_BS4
- #define LED4_OFF GPIOC -> BSRR |= GPIO_BSRR_BR4
- //===============================================================================
- // LCD WH1602 Pins
- //===============================================================================
- // pin 4 [RS]
- #define CMD_RS_GPIO GPIOC
- #define CMD_RS_CR CRL
- #define CMD_RS_RCC RCC_APB2ENR_IOPCEN
- #define CMD_RS_CNF GPIO_CRL_CNF0
- #define CMD_RS_MODE GPIO_CRL_MODE0_0
- #define CMD_RS_SET GPIO_BSRR_BS0
- #define CMD_RS_RESET GPIO_BSRR_BR0
- // pin 5 [RW]
- #define CMD_RW_GPIO GPIOC
- #define CMD_RW_CR CRL
- #define CMD_RW_RCC RCC_APB2ENR_IOPCEN
- #define CMD_RW_CNF GPIO_CRL_CNF1
- #define CMD_RW_MODE GPIO_CRL_MODE1_0
- #define CMD_RW_SET GPIO_BSRR_BS1
- #define CMD_RW_RESET GPIO_BSRR_BR1
- // pin 6 [EN]
- #define CMD_EN_GPIO GPIOC
- #define CMD_EN_CR CRL
- #define CMD_EN_RCC RCC_APB2ENR_IOPCEN
- #define CMD_EN_CNF GPIO_CRL_CNF2
- #define CMD_EN_MODE GPIO_CRL_MODE2_0
- #define CMD_EN_SET GPIO_BSRR_BS2
- #define CMD_EN_RESET GPIO_BSRR_BR2
- // pin 7 [DATA0]
- #define CMD_D0_GPIO GPIOB
- #define CMD_D0_CR CRH
- #define CMD_D0_RCC RCC_APB2ENR_IOPBEN
- #define CMD_D0_CNF GPIO_CRH_CNF12
- #define CMD_D0_MODE GPIO_CRH_MODE12_0
- #define CMD_D0_SET GPIO_BSRR_BS12
- #define CMD_D0_RESET GPIO_BSRR_BR12
- // pin 8 [DATA1]
- #define CMD_D1_GPIO GPIOB
- #define CMD_D1_CR CRH
- #define CMD_D1_RCC RCC_APB2ENR_IOPBEN
- #define CMD_D1_CNF GPIO_CRH_CNF14
- #define CMD_D1_MODE GPIO_CRH_MODE14_0
- #define CMD_D1_SET GPIO_BSRR_BS14
- #define CMD_D1_RESET GPIO_BSRR_BR14
- // pin 9 [DATA2]
- #define CMD_D2_GPIO GPIOC
- #define CMD_D2_CR CRL
- #define CMD_D2_RCC RCC_APB2ENR_IOPCEN
- #define CMD_D2_CNF GPIO_CRL_CNF6
- #define CMD_D2_MODE GPIO_CRL_MODE6_0
- #define CMD_D2_SET GPIO_BSRR_BS6
- #define CMD_D2_RESET GPIO_BSRR_BR6
- // pin 10 [DATA3]
- #define CMD_D3_GPIO GPIOC
- #define CMD_D3_CR CRH
- #define CMD_D3_RCC RCC_APB2ENR_IOPCEN
- #define CMD_D3_CNF GPIO_CRH_CNF8
- #define CMD_D3_MODE GPIO_CRH_MODE8_0
- #define CMD_D3_SET GPIO_BSRR_BS8
- #define CMD_D3_RESET GPIO_BSRR_BR8
- // pin 11 [DATA4]
- #define CMD_D4_GPIO GPIOC
- #define CMD_D4_CR CRH
- #define CMD_D4_RCC RCC_APB2ENR_IOPCEN
- #define CMD_D4_CNF GPIO_CRH_CNF9
- #define CMD_D4_MODE GPIO_CRH_MODE9_0
- #define CMD_D4_SET GPIO_BSRR_BS9
- #define CMD_D4_RESET GPIO_BSRR_BR9
- // pin 12 [DATA5]
- #define CMD_D5_GPIO GPIOC
- #define CMD_D5_CR CRL
- #define CMD_D5_RCC RCC_APB2ENR_IOPCEN
- #define CMD_D5_CNF GPIO_CRL_CNF7
- #define CMD_D5_MODE GPIO_CRL_MODE7_0
- #define CMD_D5_SET GPIO_BSRR_BS7
- #define CMD_D5_RESET GPIO_BSRR_BR7
- // pin 13 [DATA6]
- #define CMD_D6_GPIO GPIOB
- #define CMD_D6_CR CRH
- #define CMD_D6_RCC RCC_APB2ENR_IOPBEN
- #define CMD_D6_CNF GPIO_CRH_CNF15
- #define CMD_D6_MODE GPIO_CRH_MODE15_0
- #define CMD_D6_SET GPIO_BSRR_BS15
- #define CMD_D6_RESET GPIO_BSRR_BR15
- // pin 14 [DATA7]
- #define CMD_D7_GPIO GPIOB
- #define CMD_D7_CR CRH
- #define CMD_D7_RCC RCC_APB2ENR_IOPBEN
- #define CMD_D7_CNF GPIO_CRH_CNF13
- #define CMD_D7_MODE GPIO_CRH_MODE13_0
- #define CMD_D7_SET GPIO_BSRR_BS13
- #define CMD_D7_RESET GPIO_BSRR_BR13
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement