diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/components/codec/wm8524/fsl_wm8524.h')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/components/codec/wm8524/fsl_wm8524.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/components/codec/wm8524/fsl_wm8524.h b/lib/chibios-contrib/ext/mcux-sdk/components/codec/wm8524/fsl_wm8524.h new file mode 100644 index 000000000..01137c9b7 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/components/codec/wm8524/fsl_wm8524.h | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * Copyright 2017-2020 NXP | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | #ifndef _FSL_WM8524_H_ | ||
9 | #define _FSL_WM8524_H_ | ||
10 | |||
11 | #include "fsl_common.h" | ||
12 | |||
13 | /*! | ||
14 | * @addtogroup wm8524 | ||
15 | * @{ | ||
16 | */ | ||
17 | |||
18 | /******************************************************************************* | ||
19 | * Definitions | ||
20 | ******************************************************************************/ | ||
21 | /*! @name Driver version */ | ||
22 | /*@{*/ | ||
23 | /*! @brief WM8524 driver version 2.1.1. */ | ||
24 | #define FSL_WM8524_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) | ||
25 | /*@}*/ | ||
26 | |||
27 | /*!< mute control io function pointer */ | ||
28 | typedef void (*wm8524_setMuteIO)(uint32_t output); | ||
29 | /*!< format control io function pointer */ | ||
30 | typedef void (*wm8524_setProtocolIO)(uint32_t output); | ||
31 | |||
32 | /*! @brief The audio data transfer protocol. */ | ||
33 | typedef enum _wm8524_protocol | ||
34 | { | ||
35 | kWM8524_ProtocolLeftJustified = 0x0, /*!< Left justified mode */ | ||
36 | kWM8524_ProtocolI2S = 0x1, /*!< I2S mode */ | ||
37 | kWM8524_ProtocolRightJustified = 0x2, /*!< Right justified mode */ | ||
38 | } wm8524_protocol_t; | ||
39 | |||
40 | /*! @brief wm8524 mute operation */ | ||
41 | enum _wm8524_mute_control | ||
42 | { | ||
43 | kWM8524_Mute = 0U, /*!< mute left and right channel DAC */ | ||
44 | kWM8524_Unmute = 1U, /*!< unmute left and right channel DAC */ | ||
45 | }; | ||
46 | |||
47 | /*!< @brief WM8524 configurations */ | ||
48 | typedef struct _wm8524_config | ||
49 | { | ||
50 | wm8524_setMuteIO setMute; /*!< mute io control function pointer */ | ||
51 | wm8524_setProtocolIO setProtocol; /*!< format io control function pointer */ | ||
52 | wm8524_protocol_t protocol; /*!< Protocol of the codec */ | ||
53 | } wm8524_config_t; | ||
54 | |||
55 | /*!@brief WM8524 handler */ | ||
56 | typedef struct _wm8524_handle_t | ||
57 | { | ||
58 | wm8524_config_t *config; /*!< wm8524 config pointer */ | ||
59 | } wm8524_handle_t; | ||
60 | /******************************************************************************* | ||
61 | * API | ||
62 | ******************************************************************************/ | ||
63 | #if defined(__cplusplus) | ||
64 | extern "C" { | ||
65 | #endif | ||
66 | |||
67 | /*! | ||
68 | * @brief Initializes WM8524. | ||
69 | * | ||
70 | * @param handle WM8524 handle structure. | ||
71 | * @param config WM8524 configure structure. | ||
72 | * @return kStatus_Success. | ||
73 | */ | ||
74 | status_t WM8524_Init(wm8524_handle_t *handle, wm8524_config_t *config); | ||
75 | |||
76 | /*! | ||
77 | * @brief Configure WM8524 audio protocol. | ||
78 | * | ||
79 | * @param handle WM8524 handle structure. | ||
80 | * @param protocol WM8524 configuration structure. | ||
81 | */ | ||
82 | void WM8524_ConfigFormat(wm8524_handle_t *handle, wm8524_protocol_t protocol); | ||
83 | |||
84 | /*! | ||
85 | * @brief Sets the codec mute state. | ||
86 | * | ||
87 | * @param handle WM8524 handle structure. | ||
88 | * @param isMute true means mute, false means normal. | ||
89 | */ | ||
90 | void WM8524_SetMute(wm8524_handle_t *handle, bool isMute); | ||
91 | |||
92 | #if defined(__cplusplus) | ||
93 | } | ||
94 | #endif | ||
95 | |||
96 | /*! @} */ | ||
97 | #endif /* _FSL_WM8524_H_ */ | ||