5.2.1 - Updated I2C files

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Committer:
jacobjohnson
Date:
Mon Feb 27 17:45:05 2017 +0000
Revision:
1:f30bdcd2b33b
Parent:
0:098463de4c5d
changed the inputscale from 1 to 7 in analogin_api.c.  This will need to be changed later, and accessed from the main level, but for now this allows the  adc to read a value from 0 to 3.7V, instead of just up to 1V.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-onsemi 0:098463de4c5d 1
group-onsemi 0:098463de4c5d 2 /** \addtogroup hal */
group-onsemi 0:098463de4c5d 3 /** @{*/
group-onsemi 0:098463de4c5d 4 /* mbed Microcontroller Library
group-onsemi 0:098463de4c5d 5 * Copyright (c) 2006-2013 ARM Limited
group-onsemi 0:098463de4c5d 6 *
group-onsemi 0:098463de4c5d 7 * Licensed under the Apache License, Version 2.0 (the "License");
group-onsemi 0:098463de4c5d 8 * you may not use this file except in compliance with the License.
group-onsemi 0:098463de4c5d 9 * You may obtain a copy of the License at
group-onsemi 0:098463de4c5d 10 *
group-onsemi 0:098463de4c5d 11 * http://www.apache.org/licenses/LICENSE-2.0
group-onsemi 0:098463de4c5d 12 *
group-onsemi 0:098463de4c5d 13 * Unless required by applicable law or agreed to in writing, software
group-onsemi 0:098463de4c5d 14 * distributed under the License is distributed on an "AS IS" BASIS,
group-onsemi 0:098463de4c5d 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
group-onsemi 0:098463de4c5d 16 * See the License for the specific language governing permissions and
group-onsemi 0:098463de4c5d 17 * limitations under the License.
group-onsemi 0:098463de4c5d 18 */
group-onsemi 0:098463de4c5d 19 #ifndef MBED_GPIO_API_H
group-onsemi 0:098463de4c5d 20 #define MBED_GPIO_API_H
group-onsemi 0:098463de4c5d 21
group-onsemi 0:098463de4c5d 22 #include <stdint.h>
group-onsemi 0:098463de4c5d 23 #include "device.h"
group-onsemi 0:098463de4c5d 24
group-onsemi 0:098463de4c5d 25 #ifdef __cplusplus
group-onsemi 0:098463de4c5d 26 extern "C" {
group-onsemi 0:098463de4c5d 27 #endif
group-onsemi 0:098463de4c5d 28
group-onsemi 0:098463de4c5d 29 /**
group-onsemi 0:098463de4c5d 30 * \defgroup hal_gpio GPIO HAL functions
group-onsemi 0:098463de4c5d 31 * @{
group-onsemi 0:098463de4c5d 32 */
group-onsemi 0:098463de4c5d 33
group-onsemi 0:098463de4c5d 34 /** Set the given pin as GPIO
group-onsemi 0:098463de4c5d 35 *
group-onsemi 0:098463de4c5d 36 * @param pin The pin to be set as GPIO
group-onsemi 0:098463de4c5d 37 * @return The GPIO port mask for this pin
group-onsemi 0:098463de4c5d 38 **/
group-onsemi 0:098463de4c5d 39 uint32_t gpio_set(PinName pin);
group-onsemi 0:098463de4c5d 40 /* Checks if gpio object is connected (pin was not initialized with NC)
group-onsemi 0:098463de4c5d 41 * @param pin The pin to be set as GPIO
group-onsemi 0:098463de4c5d 42 * @return 0 if port is initialized with NC
group-onsemi 0:098463de4c5d 43 **/
group-onsemi 0:098463de4c5d 44 int gpio_is_connected(const gpio_t *obj);
group-onsemi 0:098463de4c5d 45
group-onsemi 0:098463de4c5d 46 /** Initialize the GPIO pin
group-onsemi 0:098463de4c5d 47 *
group-onsemi 0:098463de4c5d 48 * @param obj The GPIO object to initialize
group-onsemi 0:098463de4c5d 49 * @param pin The GPIO pin to initialize
group-onsemi 0:098463de4c5d 50 */
group-onsemi 0:098463de4c5d 51 void gpio_init(gpio_t *obj, PinName pin);
group-onsemi 0:098463de4c5d 52
group-onsemi 0:098463de4c5d 53 /** Set the input pin mode
group-onsemi 0:098463de4c5d 54 *
group-onsemi 0:098463de4c5d 55 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 56 * @param mode The pin mode to be set
group-onsemi 0:098463de4c5d 57 */
group-onsemi 0:098463de4c5d 58 void gpio_mode(gpio_t *obj, PinMode mode);
group-onsemi 0:098463de4c5d 59
group-onsemi 0:098463de4c5d 60 /** Set the pin direction
group-onsemi 0:098463de4c5d 61 *
group-onsemi 0:098463de4c5d 62 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 63 * @param direction The pin direction to be set
group-onsemi 0:098463de4c5d 64 */
group-onsemi 0:098463de4c5d 65 void gpio_dir(gpio_t *obj, PinDirection direction);
group-onsemi 0:098463de4c5d 66
group-onsemi 0:098463de4c5d 67 /** Set the output value
group-onsemi 0:098463de4c5d 68 *
group-onsemi 0:098463de4c5d 69 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 70 * @param value The value to be set
group-onsemi 0:098463de4c5d 71 */
group-onsemi 0:098463de4c5d 72 void gpio_write(gpio_t *obj, int value);
group-onsemi 0:098463de4c5d 73
group-onsemi 0:098463de4c5d 74 /** Read the input value
group-onsemi 0:098463de4c5d 75 *
group-onsemi 0:098463de4c5d 76 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 77 * @return An integer value 1 or 0
group-onsemi 0:098463de4c5d 78 */
group-onsemi 0:098463de4c5d 79 int gpio_read(gpio_t *obj);
group-onsemi 0:098463de4c5d 80
group-onsemi 0:098463de4c5d 81 // the following functions are generic and implemented in the common gpio.c file
group-onsemi 0:098463de4c5d 82 // TODO: fix, will be moved to the common gpio header file
group-onsemi 0:098463de4c5d 83
group-onsemi 0:098463de4c5d 84 /** Init the input pin and set mode to PullDefault
group-onsemi 0:098463de4c5d 85 *
group-onsemi 0:098463de4c5d 86 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 87 * @param pin The pin name
group-onsemi 0:098463de4c5d 88 */
group-onsemi 0:098463de4c5d 89 void gpio_init_in(gpio_t* gpio, PinName pin);
group-onsemi 0:098463de4c5d 90
group-onsemi 0:098463de4c5d 91 /** Init the input pin and set the mode
group-onsemi 0:098463de4c5d 92 *
group-onsemi 0:098463de4c5d 93 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 94 * @param pin The pin name
group-onsemi 0:098463de4c5d 95 * @param mode The pin mode to be set
group-onsemi 0:098463de4c5d 96 */
group-onsemi 0:098463de4c5d 97 void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode);
group-onsemi 0:098463de4c5d 98
group-onsemi 0:098463de4c5d 99 /** Init the output pin as an output, with predefined output value 0
group-onsemi 0:098463de4c5d 100 *
group-onsemi 0:098463de4c5d 101 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 102 * @param pin The pin name
group-onsemi 0:098463de4c5d 103 * @return An integer value 1 or 0
group-onsemi 0:098463de4c5d 104 */
group-onsemi 0:098463de4c5d 105 void gpio_init_out(gpio_t* gpio, PinName pin);
group-onsemi 0:098463de4c5d 106
group-onsemi 0:098463de4c5d 107 /** Init the pin as an output and set the output value
group-onsemi 0:098463de4c5d 108 *
group-onsemi 0:098463de4c5d 109 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 110 * @param pin The pin name
group-onsemi 0:098463de4c5d 111 * @param value The value to be set
group-onsemi 0:098463de4c5d 112 */
group-onsemi 0:098463de4c5d 113 void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value);
group-onsemi 0:098463de4c5d 114
group-onsemi 0:098463de4c5d 115 /** Init the pin to be in/out
group-onsemi 0:098463de4c5d 116 *
group-onsemi 0:098463de4c5d 117 * @param obj The GPIO object
group-onsemi 0:098463de4c5d 118 * @param pin The pin name
group-onsemi 0:098463de4c5d 119 * @param direction The pin direction to be set
group-onsemi 0:098463de4c5d 120 * @param mode The pin mode to be set
group-onsemi 0:098463de4c5d 121 * @param value The value to be set for an output pin
group-onsemi 0:098463de4c5d 122 */
group-onsemi 0:098463de4c5d 123 void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value);
group-onsemi 0:098463de4c5d 124
group-onsemi 0:098463de4c5d 125 /**@}*/
group-onsemi 0:098463de4c5d 126
group-onsemi 0:098463de4c5d 127 #ifdef __cplusplus
group-onsemi 0:098463de4c5d 128 }
group-onsemi 0:098463de4c5d 129 #endif
group-onsemi 0:098463de4c5d 130
group-onsemi 0:098463de4c5d 131 #endif
group-onsemi 0:098463de4c5d 132
group-onsemi 0:098463de4c5d 133 /** @}*/