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

101 lines
2.6 KiB
C

/****************************************************************************
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 _LEDC_H_
#define _LEDC_H_
#include "os_types.h"
#include "iot_led.h"
#include "iot_config.h"
#include "iot_config_api.h"
#include "iot_board_api.h"
#ifdef __cplusplus
extern "C" {
#endif
#define LED_SOFT_WHOLE_PERIOD 64
typedef struct _ledc_sts {
uint8_t status[IOT_MAX_LED];
uint8_t blink_cnt[IOT_MAX_LED];
uint8_t remain[IOT_MAX_LED];
uint8_t led_id[IOT_MAX_LED];
uint8_t blink_suc[IOT_MAX_LED];
uint8_t gpio[IOT_MAX_LED];
uint8_t led_cnt;
uint8_t blink_allow;
uint8_t hook_blink_en;
uint16_t half_period;
uint16_t whole_period;
uint32_t (*led_on)(uint8_t id);
uint32_t (*led_off)(uint8_t id);
} ledc_sts_t;
typedef enum {
IOT_LED_ID_0 = 0,
IOT_LED_ID_1,
IOT_LED_ID_2,
IOT_LED_ID_3,
IOT_LED_ID_4,
IOT_LED_ID_5,
IOT_LED_ID_6,
IOT_LED_ID_7
} IOT_LED_SIG_OUT;
extern ledc_sts_t g_led_sts;
void ledc_ena_rst();
void ledc_set_l2h_val(uint8_t port, uint32_t value);
void ledc_timer_cfg(uint8_t port, uint8_t tick, uint8_t init,
uint8_t pause, uint32_t div, uint8_t uplim);
void ledc_target_cfg(uint8_t port, uint8_t shadow, uint8_t inc,
uint32_t num, uint32_t cycle, uint32_t scope);
void ledc_target_value(uint8_t port, uint32_t value);
void ledc_cfg(uint8_t port, uint8_t idle_val, uint8_t ena, uint8_t timer_sel);
void ledc_out_ref(uint8_t port, uint8_t ena);
uint32_t led_blink(uint8_t id, uint8_t cnt);
uint32_t led_on(uint8_t id);
uint32_t led_off(uint8_t id);
void led_set_blink_interval(uint16_t interval);
void led_enable_blink(uint8_t enable);
uint32_t led_init();
uint32_t led_timer_ena(uint8_t timer);
uint32_t led_duty_conf(uint8_t target, uint8_t id,
uint8_t idle, uint8_t ena);
#ifdef __cplusplus
}
#endif
#endif /* _LEDC_H_ */