ads1115 only

Fork of mbed by mbed official

Committer:
kaoshen
Date:
Tue Jan 17 23:27:32 2017 +0000
Revision:
135:fce8a9387ed1
Parent:
129:0ab6a29f35bf
333 ADS1115 ADC1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 129:0ab6a29f35bf 1 /*******************************************************************************
<> 129:0ab6a29f35bf 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
<> 129:0ab6a29f35bf 3 *
<> 129:0ab6a29f35bf 4 * Permission is hereby granted, free of charge, to any person obtaining a
<> 129:0ab6a29f35bf 5 * copy of this software and associated documentation files (the "Software"),
<> 129:0ab6a29f35bf 6 * to deal in the Software without restriction, including without limitation
<> 129:0ab6a29f35bf 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
<> 129:0ab6a29f35bf 8 * and/or sell copies of the Software, and to permit persons to whom the
<> 129:0ab6a29f35bf 9 * Software is furnished to do so, subject to the following conditions:
<> 129:0ab6a29f35bf 10 *
<> 129:0ab6a29f35bf 11 * The above copyright notice and this permission notice shall be included
<> 129:0ab6a29f35bf 12 * in all copies or substantial portions of the Software.
<> 129:0ab6a29f35bf 13 *
<> 129:0ab6a29f35bf 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<> 129:0ab6a29f35bf 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<> 129:0ab6a29f35bf 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
<> 129:0ab6a29f35bf 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
<> 129:0ab6a29f35bf 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
<> 129:0ab6a29f35bf 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
<> 129:0ab6a29f35bf 20 * OTHER DEALINGS IN THE SOFTWARE.
<> 129:0ab6a29f35bf 21 *
<> 129:0ab6a29f35bf 22 * Except as contained in this notice, the name of Maxim Integrated
<> 129:0ab6a29f35bf 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
<> 129:0ab6a29f35bf 24 * Products, Inc. Branding Policy.
<> 129:0ab6a29f35bf 25 *
<> 129:0ab6a29f35bf 26 * The mere transfer of this software does not imply any licenses
<> 129:0ab6a29f35bf 27 * of trade secrets, proprietary technology, copyrights, patents,
<> 129:0ab6a29f35bf 28 * trademarks, maskwork rights, or any other form of intellectual
<> 129:0ab6a29f35bf 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
<> 129:0ab6a29f35bf 30 * ownership rights.
<> 129:0ab6a29f35bf 31 *******************************************************************************
<> 129:0ab6a29f35bf 32 */
<> 129:0ab6a29f35bf 33
<> 129:0ab6a29f35bf 34 #ifndef MBED_OBJECTS_H
<> 129:0ab6a29f35bf 35 #define MBED_OBJECTS_H
<> 129:0ab6a29f35bf 36
<> 129:0ab6a29f35bf 37 #include "cmsis.h"
<> 129:0ab6a29f35bf 38 #include "PortNames.h"
<> 129:0ab6a29f35bf 39 #include "PeripheralNames.h"
<> 129:0ab6a29f35bf 40 #include "PinNames.h"
<> 129:0ab6a29f35bf 41 #include "gpio_object.h"
<> 129:0ab6a29f35bf 42 #include "gpio_regs.h"
<> 129:0ab6a29f35bf 43 #include "uart_regs.h"
<> 129:0ab6a29f35bf 44 #include "i2cm_regs.h"
<> 129:0ab6a29f35bf 45 #include "spim_regs.h"
<> 129:0ab6a29f35bf 46 #include "pt_regs.h"
<> 129:0ab6a29f35bf 47 #include "adc_regs.h"
<> 129:0ab6a29f35bf 48 #include "uart.h"
<> 129:0ab6a29f35bf 49 #include "adc.h"
<> 129:0ab6a29f35bf 50
<> 129:0ab6a29f35bf 51 #ifdef __cplusplus
<> 129:0ab6a29f35bf 52 extern "C" {
<> 129:0ab6a29f35bf 53 #endif
<> 129:0ab6a29f35bf 54
<> 129:0ab6a29f35bf 55 struct port_s {
<> 129:0ab6a29f35bf 56 PortName port;
<> 129:0ab6a29f35bf 57 uint32_t mask;
<> 129:0ab6a29f35bf 58 __IO uint32_t *reg_out;
<> 129:0ab6a29f35bf 59 __I uint32_t *reg_in;
<> 129:0ab6a29f35bf 60 PinMode mode;
<> 129:0ab6a29f35bf 61 };
<> 129:0ab6a29f35bf 62
<> 129:0ab6a29f35bf 63 struct gpio_irq_s {
<> 129:0ab6a29f35bf 64 uint8_t port;
<> 129:0ab6a29f35bf 65 uint8_t pin;
<> 129:0ab6a29f35bf 66 uint8_t rise_en;
<> 129:0ab6a29f35bf 67 uint8_t fall_en;
<> 129:0ab6a29f35bf 68 uint32_t id;
<> 129:0ab6a29f35bf 69 };
<> 129:0ab6a29f35bf 70
<> 129:0ab6a29f35bf 71 struct serial_s {
<> 129:0ab6a29f35bf 72 int index;
<> 129:0ab6a29f35bf 73 mxc_uart_regs_t *uart;
<> 129:0ab6a29f35bf 74 mxc_uart_fifo_regs_t *fifo;
<> 129:0ab6a29f35bf 75 uint32_t id;
<> 129:0ab6a29f35bf 76 uart_cfg_t cfg;
<> 129:0ab6a29f35bf 77 sys_cfg_uart_t sys_cfg;
<> 129:0ab6a29f35bf 78 PinName tx;
<> 129:0ab6a29f35bf 79 PinName rx;
<> 129:0ab6a29f35bf 80 };
<> 129:0ab6a29f35bf 81
<> 129:0ab6a29f35bf 82 struct i2c_s {
<> 129:0ab6a29f35bf 83 mxc_i2cm_regs_t *i2c;
<> 129:0ab6a29f35bf 84 mxc_i2cm_fifo_regs_t *fifo;
<> 129:0ab6a29f35bf 85 int start_pending;
<> 129:0ab6a29f35bf 86 };
<> 129:0ab6a29f35bf 87
<> 129:0ab6a29f35bf 88 struct spi_s {
<> 129:0ab6a29f35bf 89 int index;
<> 129:0ab6a29f35bf 90 mxc_spim_regs_t *spi;
<> 129:0ab6a29f35bf 91 };
<> 129:0ab6a29f35bf 92
<> 129:0ab6a29f35bf 93 struct pwmout_s {
<> 129:0ab6a29f35bf 94 mxc_pt_regs_t *pwm;
<> 129:0ab6a29f35bf 95 int period;
<> 129:0ab6a29f35bf 96 int pulse_width;
<> 129:0ab6a29f35bf 97 };
<> 129:0ab6a29f35bf 98
<> 129:0ab6a29f35bf 99 struct analogin_s {
<> 129:0ab6a29f35bf 100 mxc_adc_regs_t *adc;
<> 129:0ab6a29f35bf 101 mxc_adc_chsel_t channel;
<> 129:0ab6a29f35bf 102 };
<> 129:0ab6a29f35bf 103
<> 129:0ab6a29f35bf 104 typedef struct {
<> 129:0ab6a29f35bf 105 volatile uint32_t *reg_req;
<> 129:0ab6a29f35bf 106 volatile uint32_t *reg_ack;
<> 129:0ab6a29f35bf 107 uint32_t req_val;
<> 129:0ab6a29f35bf 108 uint32_t ack_mask;
<> 129:0ab6a29f35bf 109 } pin_function_t;
<> 129:0ab6a29f35bf 110
<> 129:0ab6a29f35bf 111 #ifdef __cplusplus
<> 129:0ab6a29f35bf 112 }
<> 129:0ab6a29f35bf 113 #endif
<> 129:0ab6a29f35bf 114
<> 129:0ab6a29f35bf 115 #endif
<> 129:0ab6a29f35bf 116