this hurts

Dependencies:   FFT

Committer:
annieluo2
Date:
Wed Dec 02 18:02:03 2020 +0000
Revision:
0:d6c9b09b4042
boo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
annieluo2 0:d6c9b09b4042 1
annieluo2 0:d6c9b09b4042 2 /** \addtogroup hal */
annieluo2 0:d6c9b09b4042 3 /** @{*/
annieluo2 0:d6c9b09b4042 4 /* mbed Microcontroller Library
annieluo2 0:d6c9b09b4042 5 * Copyright (c) 2006-2013 ARM Limited
annieluo2 0:d6c9b09b4042 6 *
annieluo2 0:d6c9b09b4042 7 * Licensed under the Apache License, Version 2.0 (the "License");
annieluo2 0:d6c9b09b4042 8 * you may not use this file except in compliance with the License.
annieluo2 0:d6c9b09b4042 9 * You may obtain a copy of the License at
annieluo2 0:d6c9b09b4042 10 *
annieluo2 0:d6c9b09b4042 11 * http://www.apache.org/licenses/LICENSE-2.0
annieluo2 0:d6c9b09b4042 12 *
annieluo2 0:d6c9b09b4042 13 * Unless required by applicable law or agreed to in writing, software
annieluo2 0:d6c9b09b4042 14 * distributed under the License is distributed on an "AS IS" BASIS,
annieluo2 0:d6c9b09b4042 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
annieluo2 0:d6c9b09b4042 16 * See the License for the specific language governing permissions and
annieluo2 0:d6c9b09b4042 17 * limitations under the License.
annieluo2 0:d6c9b09b4042 18 */
annieluo2 0:d6c9b09b4042 19 #ifndef MBED_PORTMAP_H
annieluo2 0:d6c9b09b4042 20 #define MBED_PORTMAP_H
annieluo2 0:d6c9b09b4042 21
annieluo2 0:d6c9b09b4042 22 #include "device.h"
annieluo2 0:d6c9b09b4042 23
annieluo2 0:d6c9b09b4042 24 #if DEVICE_PORTIN || DEVICE_PORTOUT
annieluo2 0:d6c9b09b4042 25
annieluo2 0:d6c9b09b4042 26 #ifdef __cplusplus
annieluo2 0:d6c9b09b4042 27 extern "C" {
annieluo2 0:d6c9b09b4042 28 #endif
annieluo2 0:d6c9b09b4042 29
annieluo2 0:d6c9b09b4042 30 /** Port HAL structure. port_s is declared in the target's HAL
annieluo2 0:d6c9b09b4042 31 */
annieluo2 0:d6c9b09b4042 32 typedef struct port_s port_t;
annieluo2 0:d6c9b09b4042 33
annieluo2 0:d6c9b09b4042 34 /**
annieluo2 0:d6c9b09b4042 35 * \defgroup hal_port Port HAL functions
annieluo2 0:d6c9b09b4042 36 * @{
annieluo2 0:d6c9b09b4042 37 */
annieluo2 0:d6c9b09b4042 38
annieluo2 0:d6c9b09b4042 39 /** Get the pin name from the port's pin number
annieluo2 0:d6c9b09b4042 40 *
annieluo2 0:d6c9b09b4042 41 * @param port The port name
annieluo2 0:d6c9b09b4042 42 * @param pin_n The pin number within the specified port
annieluo2 0:d6c9b09b4042 43 * @return The pin name for the port's pin number
annieluo2 0:d6c9b09b4042 44 */
annieluo2 0:d6c9b09b4042 45 PinName port_pin(PortName port, int pin_n);
annieluo2 0:d6c9b09b4042 46
annieluo2 0:d6c9b09b4042 47 /** Initilize the port
annieluo2 0:d6c9b09b4042 48 *
annieluo2 0:d6c9b09b4042 49 * @param obj The port object to initialize
annieluo2 0:d6c9b09b4042 50 * @param port The port name
annieluo2 0:d6c9b09b4042 51 * @param mask The bitmask to identify which bits in the port should be included (0 - ignore)
annieluo2 0:d6c9b09b4042 52 * @param dir The port direction
annieluo2 0:d6c9b09b4042 53 */
annieluo2 0:d6c9b09b4042 54 void port_init(port_t *obj, PortName port, int mask, PinDirection dir);
annieluo2 0:d6c9b09b4042 55
annieluo2 0:d6c9b09b4042 56 /** Set the input port mode
annieluo2 0:d6c9b09b4042 57 *
annieluo2 0:d6c9b09b4042 58 * @param obj The port object
annieluo2 0:d6c9b09b4042 59 * @param mode THe port mode to be set
annieluo2 0:d6c9b09b4042 60 */
annieluo2 0:d6c9b09b4042 61 void port_mode(port_t *obj, PinMode mode);
annieluo2 0:d6c9b09b4042 62
annieluo2 0:d6c9b09b4042 63 /** Set port direction (in/out)
annieluo2 0:d6c9b09b4042 64 *
annieluo2 0:d6c9b09b4042 65 * @param obj The port object
annieluo2 0:d6c9b09b4042 66 * @param dir The port direction to be set
annieluo2 0:d6c9b09b4042 67 */
annieluo2 0:d6c9b09b4042 68 void port_dir(port_t *obj, PinDirection dir);
annieluo2 0:d6c9b09b4042 69
annieluo2 0:d6c9b09b4042 70 /** Write value to the port
annieluo2 0:d6c9b09b4042 71 *
annieluo2 0:d6c9b09b4042 72 * @param obj The port object
annieluo2 0:d6c9b09b4042 73 * @param value The value to be set
annieluo2 0:d6c9b09b4042 74 */
annieluo2 0:d6c9b09b4042 75 void port_write(port_t *obj, int value);
annieluo2 0:d6c9b09b4042 76
annieluo2 0:d6c9b09b4042 77 /** Read the current value on the port
annieluo2 0:d6c9b09b4042 78 *
annieluo2 0:d6c9b09b4042 79 * @param obj The port object
annieluo2 0:d6c9b09b4042 80 * @return An integer with each bit corresponding to an associated port pin setting
annieluo2 0:d6c9b09b4042 81 */
annieluo2 0:d6c9b09b4042 82 int port_read(port_t *obj);
annieluo2 0:d6c9b09b4042 83
annieluo2 0:d6c9b09b4042 84 /**@}*/
annieluo2 0:d6c9b09b4042 85
annieluo2 0:d6c9b09b4042 86 #ifdef __cplusplus
annieluo2 0:d6c9b09b4042 87 }
annieluo2 0:d6c9b09b4042 88 #endif
annieluo2 0:d6c9b09b4042 89 #endif
annieluo2 0:d6c9b09b4042 90
annieluo2 0:d6c9b09b4042 91 #endif
annieluo2 0:d6c9b09b4042 92
annieluo2 0:d6c9b09b4042 93 /** @}*/