1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #pragma once
- #ifndef LED_H
- #define LED_H
- // time to show one led digit, ms
- #define LED_ONE_PERIOD 2
- #define LED_DIGITS_NUM 8
- /* LED segments pins
- AAA
- F B
- F B
- GGG
- E C
- E C
- DDD P
- */
- /* 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
- typedef enum {
- led_A = 0xa,
- led_B = 0xb,
- led_C = 0xc,
- led_D = 0xd,
- led_E = 0xe,
- led_F = 0xf,
- led_H = 0x11,
- led_U = 0x12,
- led_Plus = 0x21,
- led_Minus = 0x22,
- led_O = 0x23, /* gradus */
- led_Off = 0xff
- } led_sym_t;
- extern uint8_t LedDigits[];
- extern uint8_t LedPoint[];
- void led_OutputValue(void);
- #endif // LED_H
|