TUKS MCU Introductory course / TUKS-COURSE-TIMER
Committer:
elmot
Date:
Sat Feb 25 00:23:53 2017 +0000
Revision:
2:5acdd8565d02
Parent:
1:d0dfbce63a89
Ready to show

Who changed what in which revision?

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