O7/Core/Inc/sts_lamp_bar.h

110 lines
3.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : sts_lamp_bar.h
* @brief : Header for sts_lamp_bar.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STS_LAMP_BAR_H
#define __STS_LAMP_BAR_H
#ifdef __cplusplus
extern "C" {
#endif
#include "main.h"
#define DEFAULT_SATURATION 50 // 0 - 100 SSaturation, 0~100
#define DEFAULT_BRIGHTNESS 50 // 0 - 100 VValue of lightness, 0~100
#define DEFAULT_LUMINANCE_LEVEL (30)
#define STS_Status_Door_Close (0) //Normal Close NC:Open
#define STS_Status_Door_Open (1) //Normal Close NC:Close
#define STS_Status_SOS_Pushdown (0) //Normal Open NO:Open
#define STS_Status_SOS_Release (1) //Normal Open NO:Close
enum sts_lamp_color {
STS_DARK = 0, //灭0
STS_GREEN, //绿1 0 1 0
STS_RED, //红2 1 0 0
STS_BLUE, //蓝3 0 0 1
STS_YELLOW, //黄4 1 1 0
STS_PINK, //紫5 1 0 1
STS_CYAN, //青6 0 1 1
STS_WHITE, //白7 1 1 1
STS_COLOR_MAX,
STS_RED_BLUE=0x23, //红蓝闪烁8
STS_RED_DARK=0x20 //RD: 9 1 0 0 RED Flash
// MAX NUM OF COLORS
};
enum sts_oo_work_mode {
STS_NETWORK_MODE = 0, // 0 NETWORK MODE
STS_WIRED_MODE, // 1 WIRED MODE === WATER LEAKAGE, SOAP CAPACITY SENSOR MODE
STS_REEDSWITCH_MODE, // 2 REED SWITCH ONLY
STS_RSS_MODE, // 3 RSS ONLY
STS_DUAL_MODE, // 4 RSS + REED SWITCH IN ONE UNIT
STS_REMOTE_REED_RSS_MODE, // 5 REMOTE REED SWITCH + RSS MODE 2023-05-04
STS_DUAL_RSS_MODE, // 6 RSS_1 + RSS_2 IN TWO UNITS
STS_TOF_RSS_MODE, // 7 TOF + RSS MODE
STS_TOF_DISTANCE_MODE, // 8 TOF DISTANCE
STS_TOF_PRESENCE_MODE, // 9 TOF PRESENCE OCCUPANCY
STS_TOF_IN_OUT_MODE, // A TOF IN OUT COUNT
STS_FALL_DETECTION_MODE, // B DUAL_MODE + FALL DETECTION
STS_OTHER_MODE // ? OTHER MODE
};
#ifdef STS_O7
#define STS_Reed_Hall_State HALL1_STATE
#define STS_Emergency_Button_State HALL2_STATE
#else
#define STS_Reed_Hall_State HAL_GPIO_ReadPin(BUT1_GPIO_Port, BUT1_Pin)
#endif
//void STS_Lamp_Bar_All(uint8_t lamp_color, uint8_t luminance_level);
void STS_Lamp_Bar_Set_Color(uint8_t red, uint8_t green, uint8_t blue );
void STS_Lamp_Bar_Set_RGB(uint8_t red, uint8_t green, uint8_t blue);
void STS_Lamp_Bar_Set_RGB_Color(uint8_t red, uint8_t green, uint8_t blue);
void STS_Lamp_Bar_Init(void);
void STS_Lamp_Bar_Full_Color_Gradient(void);
void STS_WS2812B_Refresh(void);
void STS_WS2812B_Set_RGB(uint8_t R, uint8_t G, uint8_t B, uint8_t idx);
void STS_Reed_Hall_Working(void);
void STS_Lamp_Bar_Self_Test_Simple(void);
void STS_Lamp_Bar_Self_Test(void);
void STS_Lamp_Bar_Set_Dark(void);
void sts_rgb_unit_test(void);
void STS_Reed_Hall_Presence_Detection(void);
void STS_RSS_Smart_Presence_Detection(void);
void STS_RSS_Smart_Presence(void);
void STS_Combined_Status_Processing(void);
// Before Join LoRa-WAN Network
void STS_Lamp_Bar_Scoller(uint8_t color, uint8_t luminance_level);
// Occupancy Status, Set Color to STS_RED
// Vacant Status, Set Color to STS_GREEN
void STS_Lamp_Bar_Set_STS_RGB_Color(uint8_t sts_lamp_color, uint8_t luminance_level);
void STS_Lamp_Bar_Refresh(void);
#ifdef __cplusplus
}
#endif
#endif /* _STS_LAMP_BAR_H */