Commit 3c9794c8 authored by dingmz's avatar dingmz

v1.0

parent c37921aa
Pipeline #484 failed with stages
<?xml version="1.0"?>
<configurator>
<domain name="General" spec="zcl-8.0-07-5123-08" certifiable="true">
<older spec="zcl-7.0-07-5123-07" certifiable="true"/>
<older spec="zcl6-errata-14-0129-15"/>
<older spec="zcl-6.0-15-02017-001"/>
<older spec="zcl-1.0-07-5123-03"/>
</domain>
<domain name="Lighting &amp; Occupancy" spec="l&amp;o-1.0-15-0014-04" certifiable="false"/>
<domain name="HA" spec="ha-1.2.1-05-3520-30" dependsOn="zcl-1.0-07-5123-03" certifiable="false">
<older spec="ha-1.2-05-3520-29" dependsOn="zcl-1.0-07-5123-03" certifiable="true"/>
<older spec="ha-1.1-05-3520-27" dependsOn="zcl-1.0-07-5123-03" certifiable="true"/>
</domain>
<cluster>
<name>OptTunnel</name>
<domain>General</domain>
<description>The private cluster of the Konke company is used for the extended use of the private protocol </description>
<code>0xFCC0</code>
<define>OPT_TUNNEL_CLUSTER</define>
<client tick="false" init="true">true</client>
<server tick="false" init="true">true</server>
<attribute side="server" code="0x0000" define="OPT_DATA" type="CHAR_STRING" length="254" writable="true" default="" optional="true" >OptData</attribute>
<attribute side="server" code="0x0001" define="TTS" type="CHAR_STRING" length="254" writable="true" default="" optional="true" >TTS</attribute>
<attribute side="server" code="0x0002" define="MTO_RR_RspRandom" type="INT16U" min="0x00" max="0xFFFF" writable="true" default="" optional="true" >MTO_RR_RspRandom</attribute>
<attribute side="server" code="0x0003" define="AssociatedAnnounce" type="CHAR_STRING" length="16" writable="true" default="" optional="true" >AssociatedAnnounce</attribute>
<attribute side="server" code="0x0010" define="CMEI" type="CHAR_STRING" length="32" writable="true" default="" optional="true" >CMEI</attribute>
<attribute side="server" code="0x0011" define="ISN" type="CHAR_STRING" length="32" writable="true" default="" optional="true" >ISN</attribute>
<attribute side="server" code="0x0012" define="InstallCode" type="CHAR_STRING" length="32" writable="false" default="" optional="true" >InstallCode</attribute>
<attribute side="server" code="0x0013" define="CHUNK_N1" type="CHAR_STRING" length="32" writable="true" default="" optional="true" >CHUNK_N1</attribute>
<attribute side="server" code="0x1000" define="ErrorCode" type="INT8U" min="0x00" max="0xFF" writable="false" default="0x00" optional="true" >ErrorCode</attribute>
<attribute side="server" code="0x1001" define="ChildLock" type="BOOLEAN" min="0x00" max="0x01" writable="true" default="0x00" optional="true" >ChildLock</attribute>
<attribute side="server" code="0x1002" define="DelayOff" type="INT8U" min="0x00" max="0xF0" writable="true" default="0x00" optional="true" >DelayOff</attribute>
<attribute side="server" code="0x1003" define="SwingMode" type="ENUM8" min="0x00" max="0xFF" writable="true" default="0x00" optional="true" >SwingMode</attribute>
<attribute side="server" code="0x1004" define="ScreenSaverTime" type="ENUM8" min="0x00" max="0xFF" writable="true" default="0x00" optional="true" >ScreenSaverTime</attribute>
<attribute side="server" code="0x1005" define="FilterCleanTime" type="INT16U" min="0x0000" max="0xFFFF" writable="true" default="0x0FA0" optional="true" >FilterCleanTime</attribute>
<attribute side="server" code="0x1006" define="SystemMode" type="ENUM8" min="0x00" max="0x09" writable="true" default="0x00" optional="true" >SystemMode</attribute>
<attribute side="server" code="0x1007" define="TargetTemperature" type="INT16S" min="0x0000" max="0xFFFF" writable="true" default="0x0000" optional="true" >TargetTemperature</attribute>
<attribute side="server" code="0x1008" define="CurrentTemperature" type="INT16S" min="0x0000" max="0xFFFF" writable="true" default="0x0000" optional="true" >CurrentTemperature</attribute>
<attribute side="server" code="0x1009" define="CalibrationTemperature" type="INT8S" min="0x00" max="0xFF" writable="true" default="0x00" optional="true" >CalibrationTemperature</attribute>
<attribute side="server" code="0x100a" define="FanMode" type="ENUM8" min="0x00" max="0x09" writable="true" default="0x00" optional="true" >FanMode</attribute>
<attribute side="server" code="0x100b" define="OnOff" type="BOOLEAN" min="0x00" max="0x01" writable="true" default="0x00" optional="true" >OnOff</attribute>
<attribute side="server" code="0x100c" define="NoDisturbMode" type="BOOLEAN" min="0x00" max="0x01" writable="true" default="0x00" optional="true" >NoDisturbMode</attribute>
<attribute side="server" code="0x100d" define="RunMode" type="INT8U" min="0x00" max="0x03" writable="true" default="0x00" optional="true" >RunMode</attribute>
<attribute side="server" code="0x100e" define="Level" type="INT8U" min="0x00" max="0x64" writable="true" default="0x00" optional="true" >Level</attribute>
<attribute side="server" code="0x100f" define="ColorTemperature" type="INT16U" min="0x7D0" max="0x1F4" writable="true" default="0x7D0" optional="true" >ColorTemperature</attribute>
<attribute side="server" code="0x1010" define="Hue" type="INT8U" min="0x00" max="0x64" writable="true" default="0x00" optional="true" >Hue</attribute>
<attribute side="server" code="0x1011" define="Saturation" type="INT8U" min="0x00" max="0x64" writable="true" default="0x00" optional="true" >Saturation</attribute>
<attribute side="server" code="0x1012" define="RGB" type="INT32U" min="0x00" max="0xFFFFFF" writable="true" default="0x00" optional="true" >RGB</attribute>
</cluster>
</configurator>
#ifndef __Ikk_COMMANDER_HANDLER____
#define __Ikk_COMMANDER_HANDLER____
#endif
\ No newline at end of file
#ifndef __IKONKE_MODULE_BATTERY_H_______________________________
#define __IKONKE_MODULE_BATTERY_H_______________________________
#include "app/framework/include/af.h"
#define ADC_UNKNOW_ID 0 // Valid[1,254]
#define ADC_CHANNEL_MAX_NUM 4 //adc scan max number, can not more than 4
#define USE_EFR32MG21_CHIP true
#if USE_EFR32MG21_CHIP
//#include EMBER_AF_API_BATTERY_MONITOR
#include EMBER_AF_API_GENERIC_INTERRUPT_CONTROL
#include "em_cmu.h"
#include "em_adc.h"
#include "em_prs.h"
#include "em_iadc.h"
#else
#include "em_adc.h"
#endif
typedef struct {
uint8_t adcId;//only number
bool directSampleGpio; //find adc channel by gpio, otherwise direct use PosSel
GPIO_Port_TypeDef port;
unsigned int pin;
uint32_t posSel; //directSampleGpio is false, use it
float dividerValue; //may be With divider resistor
uint16_t maxSampleVoltageMV; //max voltage value, ready to write to attribute
uint32_t referenceVoltageMV;
}AdcConfSt;
typedef void (*pBatteryVoltageGetCallback)(uint16_t battery_voltage_mv);
float kGetTemperatureByAdcId(uint8_t id);
/* DESP: adc sample init
* Auth: maozj.20200905
* */
void kAdcModuleInit(AdcConfSt conf_list[], uint8_t adc_num, uint32_t referenceVoltage);
//unit:mv
/* DESP: This function will sample the ADC according to flag whether need to write to attribute
* Auth: maozj.20200325.
* limit_voltage_mv:make sure write battery voltage is normal about actual battery.
* */
uint16_t kGetVoltageValueById(uint8_t adc_id, uint8_t endpoint, bool immediately, bool bIsWriteAttr, uint16_t diffrence);
uint32_t kGetAdcSampleValueById(uint8_t id);
uint8_t kkGetBatteryPowerPercent(uint16_t currentVoltageMilliV, uint16_t minVoltageMilliV, uint16_t maxVoltageMilliV, bool bIsWriteAttr);
#endif
#ifndef __IKONKE_MODULE_BUTTON_H_______________________________
#define __IKONKE_MODULE_BUTTON_H_______________________________
#include "app/framework/include/af.h"
#include "../general/ikk-module-def.h"
#include "../general/ikk-debug.h"
// Maximum number of buttons supported!
#define BTN_SUPPORT_MAXN 8
#define BTN_UNKNOW_ID 0 // Valid[1,254], 255 for Operate all at the same time!
#define BTN_ALLOPT_ID 255 // Valid[1,254], 255 for Operate all at the same time!
typedef enum { EBP_LOW = 0, EBP_HIGH, EBP_BOTH }BtnPolarityEnum;
typedef enum { EBA_IDLE = 0, EBA_CLICK, EBA_DCLICK, EBA_LONGPRESS, EBA_PRESSED, EBA_RELEASED}BtnActionEnum;
typedef void (*pBtnActionCallback)(unsigned char btnIndex, BtnActionEnum action );
typedef struct tag_button_configeration {
unsigned char u8ButtonId;
GPIO_Port_TypeDef port;
unsigned int pin;
BtnPolarityEnum eActionPolarity;
bool bSupportDClick;
bool bSupportPressedSend; //true:key always long pressed will send pressed message interval 1 second.used to sensor
unsigned int u32LongPressDuration; // MS
}BtnConfSt;
/* DESP: Assign an unused interrupt number.
* Auth: dingmz_frc.20191108.
* */
uint8_t kBtnAssignIRQNO(uint8_t btn_index, unsigned int pin );
/* DESP:Get usefull assign irq index for other interrupt gpio include button
* Auth: maozj.20200325.
* */
uint8_t kBtnGetAssignUsefullIndex(void);
/* DESP: single Button instance register interface.
* Auth: dingmz_frc.20191108. modify by maozj 20200326
* */
kk_err_t kBtnRegister(uint8_t id, GPIO_Port_TypeDef port, unsigned int pin, BtnPolarityEnum ePolarity, \
bool bSupportDClick, bool bSupportPressedSend, uint32_t u32LongPressDuration );
/* DESP: button module Initialize configuration interface.
* Note: Button initialization interface supports one-time registration of multiple buttons!
* Auth: dingmz_frc.20191107.
* */
kk_err_t kBtnModuleInit(BtnConfSt *btnlist, unsigned char btn_number, pBtnActionCallback pBtnActionCallback );
/* DESP: get button information by button id
* Auth: maozj.20191123.
* */
kk_err_t kBtnGetInfoByButtonId(uint8_t id, BtnConfSt *btnConf);
#endif
#ifndef __IKONKE_MODULE_LED_H_______________________________
#define __IKONKE_MODULE_LED_H_______________________________
#include "app/framework/include/af.h"
#include "../general/ikk-module-def.h"
#define LED_OBJS_SUPPORT_MAXN 8
// the number of physical gpios that can be mapped for a single LED control instance!
#define LED_GPIO_MAPPING_MAXN 4
#define LED_UNKNOW_ID 0 // Valid[1,254], 255 for Operate all at the same time!
#define LED_ALLOPT_ID 255 // Valid[1,254], 255 for Operate all at the same time!
#define BLINK_DEAD 0xffffffff
#define BLINK_NONE 0x0
// LED STATUS
typedef enum { LED_OFF = 0, LED_ON = 1, LED_TOGGLE, LED_IGNORE = 2 }LedOptEnum;
typedef enum { ELP_LOW = 0/* low to on */, ELP_HIGH/* high to on */ }LedPolarityEnum;
typedef struct {
GPIO_Port_TypeDef port;
unsigned int pin;
unsigned int pwmId; //0 :not use pwm
}LedGpioListSt;
// led configuration struct
typedef struct tag_led_config_st {
unsigned char u8LedId; // 0 ~ 254
unsigned char u8GpioMappNum;
LedGpioListSt gpios[LED_GPIO_MAPPING_MAXN];
LedPolarityEnum eActionPolarity;
//uint8_t pwmIds[LED_GPIO_MAPPING_MAXN]; //band pwm id
}LedConfSt;
typedef void (*pLedActionDoneCallback)(unsigned char id);
/* DESP: Indicator lamp behavior control interface.
Auth: dingmz_frc.20191108.
*/
void kLedOptTrigger(uint8_t id, uint32_t duration_on_ms, uint32_t duration_off_ms, uint32_t times, LedOptEnum start, LedOptEnum end );
/* DESP: Toggle LED
Auth: maozj.20200226.
*/
void kLedOptToggle(uint8_t id);
// Turn ON
#define LED_OPT_ON(id) do { \
kLedOptTrigger(id, 0, 0, 0, LED_ON, LED_IGNORE); \
}while(0)
// Turn OFF
#define LED_OPT_OFF(id) do { \
kLedOptTrigger(id, 0, 0, 0, LED_OFF, LED_IGNORE); \
}while(0)
// Turn TOGGLE add by maozj 20200226
#define LED_OPT_TOGGLE(id) do { \
kLedOptToggle(id); \
}while(0)
/* DESP: Check if the specified led indicator is bliking.
* Auth: dingmz_frc.20191108.
* */
bool kLedIsBlinking(uint8_t led_id );
/* DESP: single LED instance register interface.
* Auth: dingmz_frc.20191108.
* */
kk_err_t kLedRegister(uint8_t id, uint8_t gpio_num, LedGpioListSt gpio_list[], LedPolarityEnum ePolarity);
/* DESP: led control module Initialize configuration interface.
* Note: Led initialization interface supports one-time registration of multiple LEDs!
* Auth: dingmz_frc.20191108.
* */
kk_err_t kLedModuleInit(LedConfSt *ledlist, unsigned char led_number, pLedActionDoneCallback pCallback);
/* DESP: led control module Initialize modify by led id.
* Note: Led initialization interface
* Auth: maozj.20191226.
* */
kk_err_t kLedModuleInfoModifyGpioById(uint8_t id, LedConfSt ledconf);
#endif
#ifndef __IKONKE_MODULE_PWM_H_______________________________
#define __IKONKE_MODULE_PWM_H_______________________________
#include "app/framework/include/af.h"
#include "../general/ikk-module-def.h"
#include "em_timer.h"
#define PWM_OBJS_SUPPORT_MAXN 6
#define PWM_UNKNOW_ID 0 // Valid[1,254], 255 for Operate all at the same time!
#define PWM_ALLOPT_ID 255 // Valid[1,254], 255 for Operate all at the same time!
#define PWM_TIMER_MAX_DUTY_CYCLE_NUM 16000
#define PWM_TIMER_MID_DUTY_CYCLE_NUM 500
#define PWM_TIMER_MIN_DUTY_CYCLE_NUM 0
typedef enum {ELP_MIN = 0, ELP_MID,ELP_ANY, ELP_MAX, ELP_TO_BRIGHT/* min to max */, ELP_TO_DARKEN/* max to min */, ELP_OPT_DEFAULT=0xff }PwmGradientDirectionEnum;
typedef enum {KK_TIMER_CC0=0, KK_TIMER_CC1, KK_TIMER_CC2, KK_TIMER_CC3}PwmTimerChannelEnum;
typedef enum {KTIMER0=0, KTIMER1, KTIMER2, KTIMER3}TIMER_ENUM;
typedef struct {
GPIO_Port_TypeDef port;
unsigned int pin;
TIMER_ENUM pwmTimer;
// TIMER_TypeDef *pwmTimer;
PwmTimerChannelEnum pwmChannel;
uint32_t timerChannalLocation; //just for EFR32MG13 chip, need check datasheet,search "location"
GPIO_Mode_TypeDef mode;
uint16_t frequency_hz;
}PwmGpioListSt;
// led configuration struct
typedef struct tag_pwm_config_st {
unsigned char u8PwmId; // 0 ~ 254
PwmGpioListSt gpioInfo;
//TIMER_TypeDef timer;
//uint8_t pwmChannel;
}PwmConfSt;
extern TIMER_TypeDef *ktimer[];
extern CMU_Clock_TypeDef kclock[];
//funtion callback when pwm duty cycle is changed to max or min
typedef void (*pPwmActionDoneCallback)(unsigned char id, PwmGradientDirectionEnum opt);
/* DESP: get the pwm index by led_id.
* Auth: maozj.20200211.
* */
uint8_t kPwmGetIndexByID(uint8_t pwm_id );
/* DESP: Check whether all pwm have stopped action detection.
* Auth: maozj.20200211.
* */
bool kPwmGradientChangeIsGoing(void);
/* DESP: Check if the specified pwm is changing.
* Auth: maozj.20200211.
* */
bool kPwmIsChanging(uint8_t pwm_id );
/* DESP: registration the system pwm driver processing function interface.
Auth: maozj.20200211.
*/
void kPwmDriverhandler(uint8_t pwm_index, PwmGradientDirectionEnum st, uint16_t value);
/* DESP: pwm frequence init interface.
* Auth: maozj.20200212.
* */
void kPwmFrequencySetInit(uint16_t frequency_hz, uint16_t init_duty_cycle, PwmGpioListSt gpioInfo);
/* DESP: pwm control module Initialize configuration interface.
* Note: pwm initialization interface supports one-time registration of multiple pwm channel!
* Auth: maozj.20200219.
* */
kk_err_t kPwmModuleInit(PwmConfSt pwmlist[], unsigned char pwm_number, pPwmActionDoneCallback pCallback);
/* DESP: Indicator pwm trigger behavior control interface.
Auth: maozj.20200211.
*/
void kPwmOptTrigger(uint8_t id, uint32_t start_value, uint32_t end_value, uint32_t duration_time );
/* DESP: clear pwm gradient counter interface by pwm id.
* Auth: maozj.20200212.
* */
bool kPwmClearGradientCounterById(uint8_t pwm_id);
uint16_t kPwmGetDutyCycleValue(uint8_t pwm_id);
uint16_t kPwmGetEndValue(uint8_t pwm_id);
typedef enum{
LIGHT_DOWN=0,
LIGHT_UP,
}LIGHT_OPTYPE;
void kPwmFrequencySetInit_1(uint16_t frequency_hz, uint16_t init_duty_cycle, PwmGpioListSt gpioInfo);
void initTimer(void);
void ChangeTimerFreq(uint16_t frequency_hz);
void initTimer2(void);
void kPwmSetFrequency(uint16_t frequency_hz, PwmGpioListSt gpioInfo);
#endif
#ifndef __IKONKE_MODULE_ZERO_ACCESS_H_______________________________
#define __IKONKE_MODULE_ZERO_ACCESS_H_______________________________
#include "app/framework/include/af.h"
#include "../general/ikk-module-def.h"
#define RELAY_OBJS_SUPPORT_MAXN 8
// the number of physical gpios that can be mapped for a single Zero-Access channel instance!
#define RELAY_GPIO_MAPPING_MAXN 4
#define RELAY_CHNN_UNKNOW_ID 0 // Valid[1,254], 255 for Operate all at the same time!
#define RELAY_CHNN_ALLOPT_ID 255 // Valid[1,254], 255 for Operate all at the same time!
typedef enum { EZAO_OFF = 0, EZAO_ON = 1 , EZAO_DEFAULT = 0xFF}RelayOptEnum;
// Zero-Access channel status
typedef enum { EZAP_LOW = 0/* low to on */, EZAP_HIGH/* high to on */ }RelayPolarityEnum;
typedef struct {
GPIO_Port_TypeDef port;
unsigned int pin;
}RelayGpioListSt;
// ZA channel configuration struct
typedef struct tag_relay_config_st {
unsigned char u8RelayChannelId; // 0 ~ 254
unsigned char u8GpioMappNum; //relay numbers
RelayGpioListSt gpios[RELAY_OBJS_SUPPORT_MAXN]; //relay gpio buffer
RelayPolarityEnum eActionPolarity;
}RelayChannelConfSt;
typedef struct {
unsigned char u8RelayChannelId; // 0 ~ 254
RelayOptEnum opt;
}RelayStatusSt;
//user led control callback when relay on off
typedef void (*pRelayOptLedCallback)(RelayStatusSt stRelayStatus);
/* DESP: Zero-Access channel operate interface.
Auth: dingmz_frc.20191115.
*/
void kRelayChannelOpt(uint8_t channel_id, RelayOptEnum opt );
/* DESP: Relay control module Initialize configuration interface.alse zero gpio is not necessary
* PARAM[port]: the GPIO port for Zero-Access detection.
* PARAM[pin]: the GPIO pin for Zero-Access detection.
* PARAM[zero_on_time]: relay delay on time when get zero interrupt
* PARAM[zero_off_time]: relay delay off time when get zero interrupt
* PARAM[ePolarity]: the Zero GPIO pin interrupt edge
* PARAM[list]: the config list of all relay dection
* PARAM[channel_num]: total group number of relay.
* PARAM[callback]: callback function after relay operate done
* Auth: maozj.20191115.
* */
kk_err_t kRelayModuleInit(GPIO_Port_TypeDef port, uint8_t pin, uint32_t zero_on_time, uint32_t zero_off_time \
, RelayPolarityEnum ePolarity, RelayChannelConfSt *list, uint8_t channel_num, pRelayOptLedCallback callback);
#endif
#ifndef __IKONKE_MODULE_TIMER_H_______________________________
#define __IKONKE_MODULE_TIMER_H_______________________________
#include "app/framework/include/af.h"
//#include "../general/ikk-module-def.h"
#include "em_timer.h"
#include "ikk-pwm.h"
#if 0
#if defined(RTCC_PRESENT) && (RTCC_COUNT == 1)
#define RTCDRV_USE_RTCC
#else
#define RTCDRV_USE_RTC
#endif
#if defined(RTCDRV_USE_RTCC)
#include "em_rtcc.h"
#else
#include "em_rtc.h"
#endif
#endif
//#include "rtcdriver.h"
typedef void (*pTimerPollCallback)(void);
//??1y??2a?1?
void kTimerInit(TIMER_ENUM timer, bool bIsOneShot, uint32_t time_us);
//do not use timer0
void kTimerStart(TIMER_ENUM timer, bool bIsOneShot, uint32_t time_us, pTimerPollCallback start_callback, pTimerPollCallback stop_callback);
void kTimerStop(TIMER_ENUM timer);
bool kTimerIsGoing(TIMER_ENUM timer);
#endif
#ifndef __IKONKE_MODULE_SEQ_H_______________________
#define __IKONKE_MODULE_SEQ_H_______________________
#include "app/framework/include/af.h"
#include "app/framework/util/af-main.h"
#define UNKNOW_NODEID 0xFFFF
#define UNKNOW_SEQUENCE 0xFF
#define DELAY_CLEAR_SEQUENCE_TIME_MS (10 * 1000)
uint8_t kSequenceFindByNodeidAndEp(EmberNodeId nodeId, uint8_t endpoint, uint8_t *index);
void kSequenceAdd(EmberNodeId nodeId, uint8_t endpoint, uint8_t sequence);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- This file was generated by Simplicity Studio from the following template:
app/esf_common/template/efr32/efr32.eww
Please do not edit it directly.
-->
<workspace>
<project>
<path>$WS_DIR$\Z3RGBW_LightControler.ewp</path>
</project>
<batchBuild/>
</workspace>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0"?>
<Project>
<WindowStorage />
</Project>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment