1 /* 2 * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef __APP_PWL_H__ 16 #define __APP_PWL_H__ 17 18 #include "tgt_hardware.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 enum APP_PWL_ID_T { 25 APP_PWL_ID_0 = 0, 26 APP_PWL_ID_1 = 1, 27 28 #if (CFG_HW_PWL_NUM == 1) 29 APP_PWL_ID_QTY = 1, 30 #elif (CFG_HW_PWL_NUM == 2) 31 APP_PWL_ID_QTY = 2, 32 #else 33 APP_PWL_ID_QTY = 0, 34 #endif 35 }; 36 37 struct APP_PWL_CFG_T { 38 struct PWL_CYCLE_ONCE { 39 uint8_t level; 40 uint32_t time; 41 }part[10]; 42 uint8_t parttotal; 43 uint8_t startlevel; 44 bool periodic; 45 }; 46 47 int app_pwl_open(void); 48 49 int app_pwl_start(enum APP_PWL_ID_T id); 50 51 int app_pwl_setup(enum APP_PWL_ID_T id, struct APP_PWL_CFG_T *cfg); 52 53 int app_pwl_stop(enum APP_PWL_ID_T id); 54 55 int app_pwl_close(void); 56 57 #ifdef __cplusplus 58 } 59 #endif 60 61 #endif 62 63