guiguitant théo / greenhouse1

Dependencies:   mbed

Committer:
guiguitt
Date:
Thu Mar 28 09:26:33 2019 +0000
Revision:
0:3fc4a1072bca
programme LoRaWan

Who changed what in which revision?

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