123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef __HARD_LED_H
- #define __HARD_LED_H
- #include "stm32f1xx_hal.h"
- #define Red 0
- #define Blue 2
- #define Green 1
- #define Purple 3
- #define Yellow 4
- #define Cyan 5
- #define White 6
- #define ON 0xff
- #define OFF 0x00
- // LEDs LED
- //
- /*
- red
- green
- blue
- purple
- yellow
- cyan
- white
- */
- //
- #define LEDRed_ON() HAL_GPIO_WritePin(GPIOB,LED_R_Pin,GPIO_PIN_SET)
- #define LEDRed_OFF() HAL_GPIO_WritePin(GPIOB,LED_R_Pin,GPIO_PIN_RESET)
- //
- #define LEDGreen_ON() HAL_GPIO_WritePin(GPIOB,LED_G_Pin,GPIO_PIN_SET)
- #define LEDGreen_OFF() HAL_GPIO_WritePin(GPIOB,LED_G_Pin,GPIO_PIN_RESET)
- //
- #define LEDBlue_ON() HAL_GPIO_WritePin(GPIOB,LED_B_Pin,GPIO_PIN_SET)
- #define LEDBlue_OFF() HAL_GPIO_WritePin(GPIOB,LED_B_Pin,GPIO_PIN_RESET)
- //
- #define LEDPurple_ON() HAL_GPIO_WritePin(GPIOB,LED_R_Pin | LED_B_Pin,GPIO_PIN_SET)
- #define LEDPurple_OFF() HAL_GPIO_WritePin(GPIOB,LED_R_Pin | LED_B_Pin,GPIO_PIN_RESET)
- //
- #define LEDYellow_ON() HAL_GPIO_WritePin(GPIOB,LED_R_Pin | LED_G_Pin,GPIO_PIN_SET)
- #define LEDYellow_OFF() HAL_GPIO_WritePin(GPIOB,LED_R_Pin | LED_G_Pin,GPIO_PIN_RESET)
- //
- #define LEDCyan_ON() HAL_GPIO_WritePin(GPIOB,LED_B_Pin | LED_G_Pin,GPIO_PIN_SET)
- #define LEDCyan_OFF() HAL_GPIO_WritePin(GPIOB,LED_B_Pin | LED_G_Pin,GPIO_PIN_RESET)
- //
- #define LEDWhite_ON() HAL_GPIO_WritePin(GPIOB,LED_B_Pin | LED_G_Pin | LED_R_Pin,GPIO_PIN_SET)
- #define LEDWhite_OFF() HAL_GPIO_WritePin(GPIOB,LED_B_Pin | LED_G_Pin | LED_R_Pin,GPIO_PIN_RESET)
- void led_set_blink( uint8_t, uint8_t, uint8_t, uint8_t );
- void led_blink_repeat( void );
- void Update_LED_Time( void );
- typedef struct
- {
- uint8_t status;
- uint32_t on_time_ms;
- uint32_t off_time_ms;
- uint32_t repeat;
- uint32_t time;
- } LED_Red, LED_Blue, LED_Green, LED_Purple, LED_Cyan, LED_Yellow, LED_White;
- extern LED_Red L_red;
- extern LED_Blue L_blue;
- extern LED_Green L_green;
- extern LED_Purple L_purple;
- extern LED_Cyan L_cyan;
- extern LED_Yellow L_yellow;
- extern LED_White L_white;
- #endif
|