ads1115 only

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Mar 19 18:28:32 2014 +0000
Revision:
81:7d30d6019079
Release 81 of the mbed library

Main changes:

- Updates and fixes for many targets
- LPC1768: serial interface code fixes
- nRF51822 targets now output a .hex file
- More exporters
- More flexible GPIO API

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 81:7d30d6019079 1 /* mbed Microcontroller Library
bogdanm 81:7d30d6019079 2 * Copyright (c) 2006-2013 ARM Limited
bogdanm 81:7d30d6019079 3 *
bogdanm 81:7d30d6019079 4 * Licensed under the Apache License, Version 2.0 (the "License");
bogdanm 81:7d30d6019079 5 * you may not use this file except in compliance with the License.
bogdanm 81:7d30d6019079 6 * You may obtain a copy of the License at
bogdanm 81:7d30d6019079 7 *
bogdanm 81:7d30d6019079 8 * http://www.apache.org/licenses/LICENSE-2.0
bogdanm 81:7d30d6019079 9 *
bogdanm 81:7d30d6019079 10 * Unless required by applicable law or agreed to in writing, software
bogdanm 81:7d30d6019079 11 * distributed under the License is distributed on an "AS IS" BASIS,
bogdanm 81:7d30d6019079 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bogdanm 81:7d30d6019079 13 * See the License for the specific language governing permissions and
bogdanm 81:7d30d6019079 14 * limitations under the License.
bogdanm 81:7d30d6019079 15 */
bogdanm 81:7d30d6019079 16 #ifndef MBED_GPIO_OBJECT_H
bogdanm 81:7d30d6019079 17 #define MBED_GPIO_OBJECT_H
bogdanm 81:7d30d6019079 18
bogdanm 81:7d30d6019079 19 #ifdef __cplusplus
bogdanm 81:7d30d6019079 20 extern "C" {
bogdanm 81:7d30d6019079 21 #endif
bogdanm 81:7d30d6019079 22
bogdanm 81:7d30d6019079 23 typedef struct {
bogdanm 81:7d30d6019079 24 PinName pin;
bogdanm 81:7d30d6019079 25 uint32_t mask;
bogdanm 81:7d30d6019079 26
bogdanm 81:7d30d6019079 27 __IO uint32_t *reg_dir;
bogdanm 81:7d30d6019079 28 __IO uint32_t *reg_set;
bogdanm 81:7d30d6019079 29 __IO uint32_t *reg_clr;
bogdanm 81:7d30d6019079 30 __I uint32_t *reg_in;
bogdanm 81:7d30d6019079 31 } gpio_t;
bogdanm 81:7d30d6019079 32
bogdanm 81:7d30d6019079 33 static inline void gpio_write(gpio_t *obj, int value) {
bogdanm 81:7d30d6019079 34 if (value)
bogdanm 81:7d30d6019079 35 *obj->reg_set = obj->mask;
bogdanm 81:7d30d6019079 36 else
bogdanm 81:7d30d6019079 37 *obj->reg_clr = obj->mask;
bogdanm 81:7d30d6019079 38 }
bogdanm 81:7d30d6019079 39
bogdanm 81:7d30d6019079 40 static inline int gpio_read(gpio_t *obj) {
bogdanm 81:7d30d6019079 41 return ((*obj->reg_in & obj->mask) ? 1 : 0);
bogdanm 81:7d30d6019079 42 }
bogdanm 81:7d30d6019079 43
bogdanm 81:7d30d6019079 44 #ifdef __cplusplus
bogdanm 81:7d30d6019079 45 }
bogdanm 81:7d30d6019079 46 #endif
bogdanm 81:7d30d6019079 47
bogdanm 81:7d30d6019079 48 #endif