Official Sheffield ARMBand micro:bit program

Committer:
MrBedfordVan
Date:
Mon Oct 17 12:41:20 2016 +0000
Revision:
0:b9164b348919
Official Sheffield ARMBand Micro:bit program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MrBedfordVan 0:b9164b348919 1 /* mbed Microcontroller Library
MrBedfordVan 0:b9164b348919 2 * Copyright (c) 2006-2013 ARM Limited
MrBedfordVan 0:b9164b348919 3 *
MrBedfordVan 0:b9164b348919 4 * Licensed under the Apache License, Version 2.0 (the "License");
MrBedfordVan 0:b9164b348919 5 * you may not use this file except in compliance with the License.
MrBedfordVan 0:b9164b348919 6 * You may obtain a copy of the License at
MrBedfordVan 0:b9164b348919 7 *
MrBedfordVan 0:b9164b348919 8 * http://www.apache.org/licenses/LICENSE-2.0
MrBedfordVan 0:b9164b348919 9 *
MrBedfordVan 0:b9164b348919 10 * Unless required by applicable law or agreed to in writing, software
MrBedfordVan 0:b9164b348919 11 * distributed under the License is distributed on an "AS IS" BASIS,
MrBedfordVan 0:b9164b348919 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MrBedfordVan 0:b9164b348919 13 * See the License for the specific language governing permissions and
MrBedfordVan 0:b9164b348919 14 * limitations under the License.
MrBedfordVan 0:b9164b348919 15 */
MrBedfordVan 0:b9164b348919 16 #ifndef MBED_GPIO_API_H
MrBedfordVan 0:b9164b348919 17 #define MBED_GPIO_API_H
MrBedfordVan 0:b9164b348919 18
MrBedfordVan 0:b9164b348919 19 #include "device.h"
MrBedfordVan 0:b9164b348919 20
MrBedfordVan 0:b9164b348919 21 #ifdef __cplusplus
MrBedfordVan 0:b9164b348919 22 extern "C" {
MrBedfordVan 0:b9164b348919 23 #endif
MrBedfordVan 0:b9164b348919 24
MrBedfordVan 0:b9164b348919 25 /* Set the given pin as GPIO
MrBedfordVan 0:b9164b348919 26 * @param pin The pin to be set as GPIO
MrBedfordVan 0:b9164b348919 27 * @return The GPIO port mask for this pin
MrBedfordVan 0:b9164b348919 28 **/
MrBedfordVan 0:b9164b348919 29 uint32_t gpio_set(PinName pin);
MrBedfordVan 0:b9164b348919 30
MrBedfordVan 0:b9164b348919 31 /* Checks if gpio object is connected (pin was not initialized with NC)
MrBedfordVan 0:b9164b348919 32 * @param pin The pin to be set as GPIO
MrBedfordVan 0:b9164b348919 33 * @return 0 if port is initialized with NC
MrBedfordVan 0:b9164b348919 34 **/
MrBedfordVan 0:b9164b348919 35 int gpio_is_connected(const gpio_t *obj);
MrBedfordVan 0:b9164b348919 36
MrBedfordVan 0:b9164b348919 37 /* GPIO object */
MrBedfordVan 0:b9164b348919 38 void gpio_init(gpio_t *obj, PinName pin);
MrBedfordVan 0:b9164b348919 39
MrBedfordVan 0:b9164b348919 40 void gpio_mode (gpio_t *obj, PinMode mode);
MrBedfordVan 0:b9164b348919 41 void gpio_dir (gpio_t *obj, PinDirection direction);
MrBedfordVan 0:b9164b348919 42
MrBedfordVan 0:b9164b348919 43 void gpio_write(gpio_t *obj, int value);
MrBedfordVan 0:b9164b348919 44 int gpio_read (gpio_t *obj);
MrBedfordVan 0:b9164b348919 45
MrBedfordVan 0:b9164b348919 46 // the following set of functions are generic and are implemented in the common gpio.c file
MrBedfordVan 0:b9164b348919 47 void gpio_init_in(gpio_t* gpio, PinName pin);
MrBedfordVan 0:b9164b348919 48 void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode);
MrBedfordVan 0:b9164b348919 49 void gpio_init_out(gpio_t* gpio, PinName pin);
MrBedfordVan 0:b9164b348919 50 void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value);
MrBedfordVan 0:b9164b348919 51 void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value);
MrBedfordVan 0:b9164b348919 52
MrBedfordVan 0:b9164b348919 53 #ifdef __cplusplus
MrBedfordVan 0:b9164b348919 54 }
MrBedfordVan 0:b9164b348919 55 #endif
MrBedfordVan 0:b9164b348919 56
MrBedfordVan 0:b9164b348919 57 #endif