ads1115 only

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Jun 09 14:29:26 2015 +0100
Revision:
101:7cff1c4259d7
Child:
124:2241e3a39974
Release 101 of the mbed library

Changes:
- new platform: APPNEARME_MICRONFCBOARD, MTS_DRAGONFLY_F411RE, MAX32600MBED, WIZwiki_W7500
- Silabs memory optimization in gpio, pwm fixes
- SPI - ssel documentation fixes and its use

Who changed what in which revision?

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