From fa42e0a9a06d26b0e1ff1c80700bc033303bffc5 Mon Sep 17 00:00:00 2001 From: Yilin Sun Date: Thu, 25 May 2023 18:10:06 +0800 Subject: [PATCH] Added ADC and DAC pins. Signed-off-by: Yilin Sun --- LPC804.mex | 56 ++++++++++++++++++++++++++++++++++++++++++++ board/pin_mux.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ board/pin_mux.h | 12 ++++++++++ 3 files changed, 130 insertions(+) diff --git a/LPC804.mex b/LPC804.mex index 548bae8..64f48c0 100644 --- a/LPC804.mex +++ b/LPC804.mex @@ -103,6 +103,62 @@ + + Configures pin routing and optionally pin electrical features. + + true + core0 + true + + + + + true + + + + + true + + + + + true + + + + + + + + + Configures pin routing and optionally pin electrical features. + + true + core0 + true + + + + + true + + + + + true + + + + + true + + + + + + + diff --git a/board/pin_mux.c b/board/pin_mux.c index 34f22d1..f9b6a30 100644 --- a/board/pin_mux.c +++ b/board/pin_mux.c @@ -34,6 +34,8 @@ pin_labels: void BOARD_InitBootPins(void) { BOARD_InitLEDPins(); + BOARD_InitADCPins(); + BOARD_InitDACPins(); } /* clang-format off */ @@ -142,6 +144,66 @@ void BOARD_InitLEDPins(void) /* Disable clock for switch matrix. */ CLOCK_DisableClock(kCLOCK_Swm); } + +/* clang-format off */ +/* + * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +BOARD_InitADCPins: +- options: {callFromInitBoot: 'true', coreID: core0, enableClock: 'true'} +- pin_list: + - {pin_num: '25', peripheral: ADC0, signal: 'CH, 2', pin_signal: PIO0_14/ACMP_I3/ADC_2} + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** + */ +/* clang-format on */ + +/* FUNCTION ************************************************************************************************************ + * + * Function Name : BOARD_InitADCPins + * Description : Configures pin routing and optionally pin electrical features. + * + * END ****************************************************************************************************************/ +/* Function assigned for the Cortex-M0P */ +void BOARD_InitADCPins(void) +{ + /* Enables clock for switch matrix.: enable */ + CLOCK_EnableClock(kCLOCK_Swm); + + /* ADC_CHN2 connect to P0_14 */ + SWM_SetFixedPinSelect(SWM0, kSWM_ADC_CHN2, true); + + /* Disable clock for switch matrix. */ + CLOCK_DisableClock(kCLOCK_Swm); +} + +/* clang-format off */ +/* + * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +BOARD_InitDACPins: +- options: {callFromInitBoot: 'true', coreID: core0, enableClock: 'true'} +- pin_list: + - {pin_num: '26', peripheral: DAC0, signal: DACOUT0, pin_signal: PIO0_19/DACOUT} + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** + */ +/* clang-format on */ + +/* FUNCTION ************************************************************************************************************ + * + * Function Name : BOARD_InitDACPins + * Description : Configures pin routing and optionally pin electrical features. + * + * END ****************************************************************************************************************/ +/* Function assigned for the Cortex-M0P */ +void BOARD_InitDACPins(void) +{ + /* Enables clock for switch matrix.: enable */ + CLOCK_EnableClock(kCLOCK_Swm); + + /* DAC_OUT0 connect to P0_19 */ + SWM_SetFixedPinSelect(SWM0, kSWM_DAC_OUT0, true); + + /* Disable clock for switch matrix. */ + CLOCK_DisableClock(kCLOCK_Swm); +} /*********************************************************************************************************************** * EOF **********************************************************************************************************************/ diff --git a/board/pin_mux.h b/board/pin_mux.h index 84d5b1e..b68c333 100644 --- a/board/pin_mux.h +++ b/board/pin_mux.h @@ -80,6 +80,18 @@ void BOARD_InitDbgUARTPins(void); /* Function assigned for the Cortex-M0P */ */ void BOARD_InitLEDPins(void); /* Function assigned for the Cortex-M0P */ +/*! + * @brief Configures pin routing and optionally pin electrical features. + * + */ +void BOARD_InitADCPins(void); /* Function assigned for the Cortex-M0P */ + +/*! + * @brief Configures pin routing and optionally pin electrical features. + * + */ +void BOARD_InitDACPins(void); /* Function assigned for the Cortex-M0P */ + #if defined(__cplusplus) } #endif