Files
kunlun/inc/driver/iot_led.h
2024-09-28 14:24:04 +08:00

169 lines
4.8 KiB
C
Executable File

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef _IOT_LED_H
#define _IOT_LED_H
#ifdef __cplusplus
extern "C" {
#endif
#include "iot_config.h"
#define LED_TARGET_SHADOW_ENA 1
#define LED_TARGET_SHADOW_DIS 0
#define LED_TARGET_INC 1
#define LED_TARGET_DEC 0
#define LED_CONF_SIGOUT_ENA 1
#define LED_CONF_SIGOUT_DIS 0
typedef enum {
IOT_LED_STS_UNUSE = 0,
IOT_LED_STS_BLINK = 1,
IOT_LED_STS_ON = 2,
IOT_LED_STS_OFF = 3,
IOT_LED_STS_UN_SUPPORT = 4,
} IOT_LED_STS;
typedef enum {
IOT_PLC_TX_LED = 0,
IOT_PLC_RX_LED = 1,
IOT_PLC_PHASE_A_LED = 2,
IOT_PLC_PHASE_B_LED = 3,
IOT_PLC_PHASE_C_LED = 4,
IOT_PWR_LED = 5,
IOT_RS485_LED = 6,
IOT_PLC_TR_LED = 7,
IOT_PLC_NET_LED = 8,
IOT_SIGNAL_LED = 9,
IOT_RF_LED = 10,
IOT_MAX_LED = 11,
IOT_LED_TYPE_INVALID = 0xff,
} IOT_LED_TYPE;
typedef enum {
IOT_TIMER_BLINK = 0,
IOT_TIMER_PHASE = 1,
IOT_TIMER_PWR = 2,
IOT_TIMER_3 = 3,
IOT_TIMER_MAX,
} IOT_TIMER_TYPE;
/**
* @brief iot_led_pwr_control_enable() - function used to enable power
* led control by app.
*/
void iot_led_pwr_control_enable();
/**
* @brief iot_led_blink() - function used to set led blink
* @param id: led number id
* @param cnt: blink count. led will blink muitple times.
*
* @return ERR_FAIL(11) - led number id is wrong
* @return ERR_OK(0) - set led blink successful
*
*/
uint32_t iot_led_blink(uint8_t id, uint8_t cnt);
/**
* @brief iot_led_on() - function used to set led on
* @param id: led number id
*
* @return ERR_FAIL(11) - led number id is wrong
* @return ERR_OK(0) - set led blink successful
*
*/
uint32_t iot_led_on(uint8_t id);
/**
* @brief iot_led_off() - function used to set led off
* @param id: led number id
*
* @return ERR_FAIL(11) - led number id is wrong
* @return ERR_OK(0) - set led blink successful
*
*/
uint32_t iot_led_off(uint8_t id);
/**
* @brief iot_led_set_blink_interval() - function used to set led blink interval
* @param interval: led blink interval. unit is 1ms.
*/
void iot_led_set_blink_interval(uint16_t interval);
/**
* @brief iot_led_enable_blink() - function used to enable/disable blink feature
* @param enable: 0 - disable, otherwise - enable
*/
void iot_led_enable_blink(uint8_t enable);
/**
* @brief iot_led_init() - function used to set led init
*
* @return ERR_OK(0) - set led blink successful
*
*/
uint32_t iot_led_init();
/**
* @brief iot_led_enable_hook_blink() - function used to disable/enable hook
* blink feature.
* @param enable: 0 - disable, otherwise - enable.
*/
void iot_led_enable_hook_blink(uint8_t enable);
/**
* @brief iot_led_blink_from_hook() - function used to set led blink.
* @param id: led number id
* @param cnt: blink count. led will blink muitple times.
*
* @return ERR_FAIL(11) - led number id is wrong
* @return ERR_OK(0) - set led blink successful
*/
uint32_t iot_led_blink_from_hook(uint8_t id, uint8_t cnt);
/**
* @brief iot_led_gpio_on() - function used to set gpio mtx outid.
* @param id: led number id
*
* @return ERR_FAIL(11) - led number id is wrong
* @return ERR_OK(0) - set set gpio mtx outid successful
*/
uint32_t iot_led_gpio_on(uint8_t id);
/**
* @brief iot_led_gpio_on() - function used to set gpio mtx default.
* @param id: led number id
*
* @return ERR_FAIL(11) - led number id is wrong
* @return ERR_OK(0) - set set gpio mtx default successful
*/
uint32_t iot_led_gpio_off(uint8_t id);
/**
* @brief iot_led_gpio_pin_select() - function used to set gpio function.
* @param pin: pin index
* @param func: gpio function
*
*/
void iot_led_gpio_pin_select(uint32_t pin, uint32_t func);
#ifdef __cplusplus
}
#endif
#endif //IOT_LED_H