#ifndef __BOARD_H #define __BOARD_H /* MACROs for SET, RESET or TOGGLE Output port */ #define GPIO_HIGH(a,b) a->ODR |= b #define GPIO_LOW(a,b) a->ODR &= ~b #define GPIO_TOGGLE(a,b) a->ODR ^= b /* LED AAA F B F B GGG E C E C DDD P */ #define LED_SEG1_PORT GPIOA #define LED_SEG1_PINS GPIO_PIN_3 #define LED_SEG_DP GPIO_PIN_3 #define LED_SEG3_PORT GPIOC #define LED_SEG3_PINS (GPIO_PIN_4 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_3 | GPIO_PIN_5) #define LED_SEG_A GPIO_PIN_3 #define LED_SEG_F GPIO_PIN_4 #define LED_SEG_B GPIO_PIN_5 #define LED_SEG_E GPIO_PIN_6 #define LED_SEG_G GPIO_PIN_7 #define LED_SEG2_PORT GPIOD #define LED_SEG2_PINS (GPIO_PIN_1 | GPIO_PIN_4) #define LED_SEG_C GPIO_PIN_1 #define LED_SEG_D GPIO_PIN_4 #define LED_OUT_OFF {LED_SEG1_PORT->ODR |= LED_SEG1_PINS; LED_SEG2_PORT->ODR |= LED_SEG2_PINS; LED_SEG3_PORT->ODR |= LED_SEG3_PINS;} #define LED_OUT_DP GPIOA->ODR &= ~LED_SEG_DP #define LED_OUT_MM GPIOC->ODR &= ~LED_SEG_G #define LED_OUT_0 GPIOC->ODR &= ~(LED_SEG_A|LED_SEG_B|LED_SEG_E|LED_SEG_F); GPIOD->ODR &= ~(LED_SEG2_PINS) #define LED_OUT_1 GPIOC->ODR &= ~(LED_SEG_B); GPIOD->ODR &= ~(LED_SEG_C) #define LED_OUT_2 GPIOC->ODR &= ~(LED_SEG_A|LED_SEG_B|LED_SEG_E|LED_SEG_G); GPIOD->ODR &= ~(LED_SEG_D) #define LED_OUT_3 GPIOC->ODR &= ~(LED_SEG_A|LED_SEG_B|LED_SEG_G); GPIOD->ODR &= ~(LED_SEG2_PINS) #define LED_OUT_4 GPIOC->ODR &= ~(LED_SEG_B|LED_SEG_F|LED_SEG_G); GPIOD->ODR &= ~(LED_SEG_C) #define LED_OUT_5 GPIOC->ODR &= ~(LED_SEG_A|LED_SEG_F|LED_SEG_G); GPIOD->ODR &= ~(LED_SEG2_PINS) #define LED_OUT_6 GPIOC->ODR &= ~(LED_SEG_A|LED_SEG_E|LED_SEG_F|LED_SEG_G); GPIOD->ODR &= ~(LED_SEG2_PINS) #define LED_OUT_7 GPIOC->ODR &= ~(LED_SEG_A|LED_SEG_B); GPIOD->ODR &= ~(LED_SEG_C) #define LED_OUT_8 GPIOC->ODR &= ~(LED_SEG3_PINS); GPIOD->ODR &= ~(LED_SEG2_PINS) #define LED_OUT_9 GPIOC->ODR &= ~(LED_SEG_A|LED_SEG_B|LED_SEG_F|LED_SEG_G); GPIOD->ODR &= ~(LED_SEG2_PINS) /* shift register control pins */ #define SPI_PORT GPIOA #define SPI_SCK GPIO_PIN_1 #define SPI_DATA GPIO_PIN_2 /* ADC */ #define ADC_PORT GPIOD #define ADC_PINU GPIO_PIN_2 #define ADC_CHNLU ADC1_CHANNEL_3 #define ADC_SCHTU ADC1_SCHMITTTRIG_CHANNEL3 #define ADC_PINI GPIO_PIN_3 #define ADC_CHNLI ADC1_CHANNEL_4 #define ADC_SCHTI ADC1_SCHMITTTRIG_CHANNEL4 #define ADC_SMPLS 64 // Supply voltage in mili volts #define ADC_VREF 3335 // Сопротивление резисторов ОУ усилителя сигнала шунта #define CURRENT_MULT_TOP 3600 #define CURRENT_MULT_BOT 680 // shunt resistance in mili Ohms #define ADC_SHUNT 50 #endif /* __BOARD_H */