1

Committer:
valeyev
Date:
Tue Mar 13 07:17:50 2018 +0000
Revision:
0:e056ac8fecf8
looking for...

Who changed what in which revision?

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