/* 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 DEFAULT_LUMINANCE_LEVEL				(30)
#define STS_Status_Door_Close                (0)		//Normal Close NC:Open		**2024-07-15 changed
#define STS_Status_Door_Open                 (1)		//Normal Close NC:Close		**2024-07-15 changed
#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, Code 0x00
	STS_GREEN,		//绿:1 0 1 0 code 0x01 0b0000 0001
	STS_RED,		//红:2 1 0 0 code 0x02 0b0000 0010
	STS_BLUE,		//蓝:3 0 0 1 code 0x03 0b0000 0011
	STS_YELLOW,		//黄:4 1 1 0 code 0x04 0b0000 0100
	STS_PINK,		//紫:5 1 0 1 code 0x05 0b0000 0101
	STS_CYAN,		//青:6 0 1 1 code 0x06 0b0000 0110
	STS_WHITE,		//白:7 1 1 1 code 0x07 0b0000 0111
	STS_COLOR_MAX,	//8: MAX NUM OF COLORS 0x08 0b0000 1000

	STS_GREEN_DARK=0x10, 	//0b0001 0000 GREEN DARK
	STS_RED_DARK=0x20, 		//0b0010 0000,
	STS_BLUE_DARK=0x30, 	//0b0011 0000 BLUE DARK
	STS_RED_BLUE=0x23 		//0b0010 0011  RED BLUE FLASH
};

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_UNI_MODE,				// 5    DUAL_MODE + FALL DETECTION
	STS_REMOTE_REED_RSS_MODE,  	// 6	REMOTE REED SWITCH + RSS MODE	2023-05-04
	STS_DUAL_RSS_MODE,			// 7    RSS_1 + RSS_2 IN TWO UNITS
	STS_TOF_RSS_MODE,			// 8	TOF + RSS MODE
	STS_TOF_DISTANCE_MODE,		// 9	TOF DISTANCE
	STS_TOF_PRESENCE_MODE,		// A 	TOF PRESENCE OCCUPANCY
	STS_TOF_IN_OUT_MODE,		// B    TOF IN OUT COUNT


	STS_OTHER_MODE				// ?    OTHER MODE
};
#if	defined(STS_O7)||defined(STS_O6)
#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 */