/* 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 S:Saturation, 0~100
#define	DEFAULT_BRIGHTNESS		50		// 0 - 100 V:Value of lightness, 0~100

#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_RED_BLUE	//红蓝闪烁:8
};

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_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 */