1 // Copyright (C) 2022 Beken Corporation 2 // 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 #pragma once 16 17 #include <common/bk_include.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 /** 24 * @brief ADC defines 25 * @defgroup bk_api_adc_defs macos 26 * @ingroup bk_api_adc 27 * @{ 28 */ 29 #define BK_ERR_ADC_NOT_INIT (BK_ERR_ADC_BASE - 1) /**< ADC driver not init */ 30 #define BK_ERR_ADC_INVALID_CHAN (BK_ERR_ADC_BASE - 2) /**< ADC chan number is invalid */ 31 #define BK_ERR_ADC_BUSY (BK_ERR_ADC_BASE - 3) /**< ADC channel is busy */ 32 #define BK_ERR_ADC_INVALID_MODE (BK_ERR_ADC_BASE - 4) /**< ADC invalid mode */ 33 #define BK_ERR_ADC_CHAN_NOT_INIT (BK_ERR_ADC_BASE - 5) /**< ADC chan not init */ 34 #define BK_ERR_ADC_INVALID_SCLK_MODE (BK_ERR_ADC_BASE - 6) /**< ADC no such source clock */ 35 #define BK_ERR_ADC_INIT_MUTEX (BK_ERR_ADC_BASE - 7) /**< ADC mutex lock */ 36 #define BK_ERR_ADC_GET_READ_SEMA (BK_ERR_ADC_BASE - 8) /**< ADC get semaphore error */ 37 #define BK_ERR_ADC_INIT_READ_SEMA (BK_ERR_ADC_BASE - 9) /**< ADC read data error */ 38 #define BK_ERR_ADC_SIZE_TOO_BIG (BK_ERR_ADC_BASE - 10) /**< ADC read size is bigger than adc driver buffer size */ 39 40 #ifndef CONFIG_ADC_BUF_SIZE 41 #define CONFIG_ADC_BUF_SIZE 32 42 #endif 43 44 /** 45 * @brief ADC interrupt service routine 46 */ 47 typedef void (*adc_isr_t)(uint32_t param); 48 49 50 /** 51 * @} 52 */ 53 54 55 /** 56 * @} 57 */ 58 59 #ifdef __cplusplus 60 } 61 #endif 62 63