Life is random and unfair!
Fork of mbed-dev by
Embed:
(wiki syntax)
Show/hide line numbers
port_api.h
00001 00002 /** \addtogroup hal */ 00003 /** @{*/ 00004 /* mbed Microcontroller Library 00005 * Copyright (c) 2006-2013 ARM Limited 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 */ 00019 #ifndef MBED_PORTMAP_H 00020 #define MBED_PORTMAP_H 00021 00022 #include "device.h" 00023 00024 #if DEVICE_PORTIN || DEVICE_PORTOUT 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 /** Port HAL structure. port_s is declared in the target's HAL 00031 */ 00032 typedef struct port_s port_t; 00033 00034 /** 00035 * \defgroup hal_port Port HAL functions 00036 * @{ 00037 */ 00038 00039 /** Get the pin name from the port's pin number 00040 * 00041 * @param port The port name 00042 * @param pin_n The pin number within the specified port 00043 * @return The pin name for the port's pin number 00044 */ 00045 PinName port_pin(PortName port, int pin_n); 00046 00047 /** Initilize the port 00048 * 00049 * @param obj The port object to initialize 00050 * @param port The port name 00051 * @param mask The bitmask to identify which bits in the port should be included (0 - ignore) 00052 * @param dir The port direction 00053 */ 00054 void port_init(port_t *obj, PortName port, int mask, PinDirection dir); 00055 00056 /** Set the input port mode 00057 * 00058 * @param obj The port object 00059 * @param mode THe port mode to be set 00060 */ 00061 void port_mode(port_t *obj, PinMode mode); 00062 00063 /** Set port direction (in/out) 00064 * 00065 * @param obj The port object 00066 * @param dir The port direction to be set 00067 */ 00068 void port_dir(port_t *obj, PinDirection dir); 00069 00070 /** Write value to the port 00071 * 00072 * @param obj The port object 00073 * @param value The value to be set 00074 */ 00075 void port_write(port_t *obj, int value); 00076 00077 /** Read the current value on the port 00078 * 00079 * @param obj The port object 00080 * @return An integer with each bit corresponding to an associated port pin setting 00081 */ 00082 int port_read(port_t *obj); 00083 00084 /**@}*/ 00085 00086 #ifdef __cplusplus 00087 } 00088 #endif 00089 #endif 00090 00091 #endif 00092 00093 /** @}*/
Generated on Tue Jul 12 2022 19:28:24 by 1.7.2