Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
lpc43xx_scu.c
00001 /** 00002 * @file lpc43xx_scu.c 00003 * @brief 00004 * 00005 * DAPLink Interface Firmware 00006 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved 00007 * SPDX-License-Identifier: Apache-2.0 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00010 * not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00017 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 /* Includes ------------------------------------------------------------------- */ 00023 #include "LPC43xx.h" /* lpc43xx definitions */ 00024 #include "lpc_types.h" 00025 #include "lpc43xx_scu.h" 00026 00027 /* Pin modes 00028 * ========= 00029 * The EPUN and EPD bits in the SFS registers allow the selection of weak on-chip 00030 * pull-up or pull-down resistors with a typical value of 50 kOhm for each pin or the 00031 * selection of the repeater mode. 00032 * The possible on-chip resistor configurations are pull-up enabled, pull-down enabled, or no 00033 * pull-up/pull-down. The default value is pull-up enabled. 00034 * 00035 * The repeater mode enables the pull-up resistor if the pin is at a logic HIGH and enables 00036 * the pull-down resistor if the pin is at a logic LOW. This causes the pin to retain its last 00037 * known state if it is configured as an input and is not driven externally. Repeater mode may 00038 * typically be used to prevent a pin from floating (and potentially using significant power if it 00039 * floats to an indeterminate state) if it is temporarily not driven. 00040 * Repeater mode is enabled when both pull-up and pull-down are enabled. 00041 * 00042 * To be able to receive a digital signal, the input buffer must be enabled through bit EZI in 00043 * the pin configuration registers. By default, the input buffer is disabled. 00044 * For pads that support both a digital and an analog function, the input buffer must be 00045 * disabled before enabling the analog function. 00046 * 00047 * All digital pins support a programmable glitch filter (bit ZIF), which can be switched on or 00048 * off. By default, the glitch filter is on. The glitch filter should be disabled for 00049 * clocking signals with frequencies higher than 30 MHz. 00050 * 00051 * Normal-drive and high-speed pins support a programmable slew rate (bit EHS) to select 00052 * between lower noise and low speed or higher noise and high speed . The typical 00053 * frequencies supported are 50 MHz/80 MHz for normal-drive pins and 75 MHz/180 MHz for 00054 * high-speed pins. 00055 */ 00056 00057 /*********************************************************************//** 00058 * @brief Configure pin function 00059 * @param[in] port Port number, should be: 0..15 00060 * @param[in] pin Pin number, should be: 0..31 00061 * @param[in] mode Pin mode, should be: 00062 * - MD_PUP :Pull-up enabled 00063 * - MD_BUK :Plain input 00064 * - MD_PLN :Repeater mode 00065 * - MD_PDN :Pull-down enabled 00066 * - MD_EHS :Slew rate 00067 * - MD_EZI :Input buffer enable 00068 * - MD_ZI :Glitch filter enabled 00069 * - MD_EHD0 :High drive 8 mA 00070 * - MD_EHD1 :High drive 14 mA 00071 * - MD_EHD2 :High drive 20 mA 00072 * @param[in] func Function mode, should be: 00073 * - FUNC0 :Function 0 00074 * - FUNC1 :Function 1 00075 * - FUNC2 :Function 2 00076 * - FUNC3 :Function 3 00077 * - FUNC4 :Function 4 00078 * - FUNC5 :Function 5 00079 * - FUNC6 :Function 6 00080 * - FUNC7 :Function 7 00081 * @return None 00082 **********************************************************************/ 00083 void scu_pinmux(uint8_t port, uint8_t pin, uint8_t mode, uint8_t func) 00084 { 00085 uint32_t *scu_base = (uint32_t *)(LPC_SCU_BASE); 00086 scu_base[(PORT_OFFSET * port + PIN_OFFSET * pin) / 4] = mode + func; 00087 } /* scu_pinmux */
Generated on Tue Jul 12 2022 15:37:19 by
