mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Committer:
be_bryan
Date:
Mon Dec 11 17:54:04 2017 +0000
Revision:
0:b74591d5ab33
motor ++

Who changed what in which revision?

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