ads1115 only
Fork of mbed by
TARGET_MAX32620HSP/TARGET_Maxim/TARGET_MAX32620/objects.h@135:fce8a9387ed1, 2017-01-17 (annotated)
- Committer:
- kaoshen
- Date:
- Tue Jan 17 23:27:32 2017 +0000
- Revision:
- 135:fce8a9387ed1
- Parent:
- 125:2e9cc70d1897
333 ADS1115 ADC1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 125:2e9cc70d1897 | 1 | /******************************************************************************* |
AnnaBridge | 125:2e9cc70d1897 | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
AnnaBridge | 125:2e9cc70d1897 | 3 | * |
AnnaBridge | 125:2e9cc70d1897 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
AnnaBridge | 125:2e9cc70d1897 | 5 | * copy of this software and associated documentation files (the "Software"), |
AnnaBridge | 125:2e9cc70d1897 | 6 | * to deal in the Software without restriction, including without limitation |
AnnaBridge | 125:2e9cc70d1897 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
AnnaBridge | 125:2e9cc70d1897 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
AnnaBridge | 125:2e9cc70d1897 | 9 | * Software is furnished to do so, subject to the following conditions: |
AnnaBridge | 125:2e9cc70d1897 | 10 | * |
AnnaBridge | 125:2e9cc70d1897 | 11 | * The above copyright notice and this permission notice shall be included |
AnnaBridge | 125:2e9cc70d1897 | 12 | * in all copies or substantial portions of the Software. |
AnnaBridge | 125:2e9cc70d1897 | 13 | * |
AnnaBridge | 125:2e9cc70d1897 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
AnnaBridge | 125:2e9cc70d1897 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
AnnaBridge | 125:2e9cc70d1897 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
AnnaBridge | 125:2e9cc70d1897 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
AnnaBridge | 125:2e9cc70d1897 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
AnnaBridge | 125:2e9cc70d1897 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
AnnaBridge | 125:2e9cc70d1897 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
AnnaBridge | 125:2e9cc70d1897 | 21 | * |
AnnaBridge | 125:2e9cc70d1897 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
AnnaBridge | 125:2e9cc70d1897 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
AnnaBridge | 125:2e9cc70d1897 | 24 | * Products, Inc. Branding Policy. |
AnnaBridge | 125:2e9cc70d1897 | 25 | * |
AnnaBridge | 125:2e9cc70d1897 | 26 | * The mere transfer of this software does not imply any licenses |
AnnaBridge | 125:2e9cc70d1897 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
AnnaBridge | 125:2e9cc70d1897 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
AnnaBridge | 125:2e9cc70d1897 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
AnnaBridge | 125:2e9cc70d1897 | 30 | * ownership rights. |
AnnaBridge | 125:2e9cc70d1897 | 31 | ******************************************************************************* |
AnnaBridge | 125:2e9cc70d1897 | 32 | */ |
AnnaBridge | 125:2e9cc70d1897 | 33 | |
AnnaBridge | 125:2e9cc70d1897 | 34 | #ifndef MBED_OBJECTS_H |
AnnaBridge | 125:2e9cc70d1897 | 35 | #define MBED_OBJECTS_H |
AnnaBridge | 125:2e9cc70d1897 | 36 | |
AnnaBridge | 125:2e9cc70d1897 | 37 | #include "cmsis.h" |
AnnaBridge | 125:2e9cc70d1897 | 38 | #include "PortNames.h" |
AnnaBridge | 125:2e9cc70d1897 | 39 | #include "PeripheralNames.h" |
AnnaBridge | 125:2e9cc70d1897 | 40 | #include "PinNames.h" |
AnnaBridge | 125:2e9cc70d1897 | 41 | #include "gpio_object.h" |
AnnaBridge | 125:2e9cc70d1897 | 42 | #include "gpio_regs.h" |
AnnaBridge | 125:2e9cc70d1897 | 43 | #include "uart_regs.h" |
AnnaBridge | 125:2e9cc70d1897 | 44 | #include "i2cm_regs.h" |
AnnaBridge | 125:2e9cc70d1897 | 45 | #include "spi_regs.h" |
AnnaBridge | 125:2e9cc70d1897 | 46 | #include "pt_regs.h" |
AnnaBridge | 125:2e9cc70d1897 | 47 | #include "adc_regs.h" |
AnnaBridge | 125:2e9cc70d1897 | 48 | |
AnnaBridge | 125:2e9cc70d1897 | 49 | #ifdef __cplusplus |
AnnaBridge | 125:2e9cc70d1897 | 50 | extern "C" { |
AnnaBridge | 125:2e9cc70d1897 | 51 | #endif |
AnnaBridge | 125:2e9cc70d1897 | 52 | |
AnnaBridge | 125:2e9cc70d1897 | 53 | struct port_s { |
AnnaBridge | 125:2e9cc70d1897 | 54 | PortName port; |
AnnaBridge | 125:2e9cc70d1897 | 55 | uint32_t mask; |
AnnaBridge | 125:2e9cc70d1897 | 56 | __IO uint32_t *reg_out; |
AnnaBridge | 125:2e9cc70d1897 | 57 | __I uint32_t *reg_in; |
AnnaBridge | 125:2e9cc70d1897 | 58 | }; |
AnnaBridge | 125:2e9cc70d1897 | 59 | |
AnnaBridge | 125:2e9cc70d1897 | 60 | struct gpio_irq_s { |
AnnaBridge | 125:2e9cc70d1897 | 61 | uint8_t port; |
AnnaBridge | 125:2e9cc70d1897 | 62 | uint8_t pin; |
AnnaBridge | 125:2e9cc70d1897 | 63 | uint8_t rise_en; |
AnnaBridge | 125:2e9cc70d1897 | 64 | uint8_t fall_en; |
AnnaBridge | 125:2e9cc70d1897 | 65 | uint32_t id; |
AnnaBridge | 125:2e9cc70d1897 | 66 | }; |
AnnaBridge | 125:2e9cc70d1897 | 67 | |
AnnaBridge | 125:2e9cc70d1897 | 68 | struct serial_s { |
AnnaBridge | 125:2e9cc70d1897 | 69 | int index; |
AnnaBridge | 125:2e9cc70d1897 | 70 | mxc_uart_regs_t *uart; |
AnnaBridge | 125:2e9cc70d1897 | 71 | mxc_uart_fifo_regs_t *fifo; |
AnnaBridge | 125:2e9cc70d1897 | 72 | }; |
AnnaBridge | 125:2e9cc70d1897 | 73 | |
AnnaBridge | 125:2e9cc70d1897 | 74 | struct i2c_s { |
AnnaBridge | 125:2e9cc70d1897 | 75 | int index; |
AnnaBridge | 125:2e9cc70d1897 | 76 | mxc_i2cm_regs_t *i2c; |
AnnaBridge | 125:2e9cc70d1897 | 77 | mxc_i2cm_fifo_regs_t *fifos; |
AnnaBridge | 125:2e9cc70d1897 | 78 | int start_pending; |
AnnaBridge | 125:2e9cc70d1897 | 79 | int stop_pending; |
AnnaBridge | 125:2e9cc70d1897 | 80 | }; |
AnnaBridge | 125:2e9cc70d1897 | 81 | |
AnnaBridge | 125:2e9cc70d1897 | 82 | struct spi_s { |
AnnaBridge | 125:2e9cc70d1897 | 83 | int index; |
AnnaBridge | 125:2e9cc70d1897 | 84 | mxc_spi_regs_t *spi; |
AnnaBridge | 125:2e9cc70d1897 | 85 | mxc_spi_fifo_regs_t *fifo; |
AnnaBridge | 125:2e9cc70d1897 | 86 | int bits; |
AnnaBridge | 125:2e9cc70d1897 | 87 | int ssel; |
AnnaBridge | 125:2e9cc70d1897 | 88 | uint32_t width; // SPI data width (number of data lines to use) |
AnnaBridge | 125:2e9cc70d1897 | 89 | PinName sclk; // PinName saved to use in Quad SPI pin mapping table |
AnnaBridge | 125:2e9cc70d1897 | 90 | #if DEVICE_SPI_ASYNCH |
AnnaBridge | 125:2e9cc70d1897 | 91 | // Async transaction state |
AnnaBridge | 125:2e9cc70d1897 | 92 | const uint8_t *tx_data; // TX buffer |
AnnaBridge | 125:2e9cc70d1897 | 93 | uint8_t *rx_data; // RX buffer |
AnnaBridge | 125:2e9cc70d1897 | 94 | unsigned len; // Number of bytes to send |
AnnaBridge | 125:2e9cc70d1897 | 95 | unsigned read_num; // Number of bytes read |
AnnaBridge | 125:2e9cc70d1897 | 96 | unsigned write_num; // Number of bytes written |
AnnaBridge | 125:2e9cc70d1897 | 97 | void (*callback)(); // Callback for asynchronous request |
AnnaBridge | 125:2e9cc70d1897 | 98 | unsigned head_rem; // Remaining count for current header |
AnnaBridge | 125:2e9cc70d1897 | 99 | uint32_t event; // Callback response events |
AnnaBridge | 125:2e9cc70d1897 | 100 | #endif |
AnnaBridge | 125:2e9cc70d1897 | 101 | }; |
AnnaBridge | 125:2e9cc70d1897 | 102 | |
AnnaBridge | 125:2e9cc70d1897 | 103 | struct pwmout_s { |
AnnaBridge | 125:2e9cc70d1897 | 104 | mxc_pt_regs_t *pwm; |
AnnaBridge | 125:2e9cc70d1897 | 105 | int period; |
AnnaBridge | 125:2e9cc70d1897 | 106 | int pulse_width; |
AnnaBridge | 125:2e9cc70d1897 | 107 | }; |
AnnaBridge | 125:2e9cc70d1897 | 108 | |
AnnaBridge | 125:2e9cc70d1897 | 109 | struct analogin_s { |
AnnaBridge | 125:2e9cc70d1897 | 110 | mxc_adc_regs_t *adc; |
AnnaBridge | 125:2e9cc70d1897 | 111 | PinName adc_pin; |
AnnaBridge | 125:2e9cc70d1897 | 112 | }; |
AnnaBridge | 125:2e9cc70d1897 | 113 | |
AnnaBridge | 125:2e9cc70d1897 | 114 | typedef struct { |
AnnaBridge | 125:2e9cc70d1897 | 115 | volatile uint32_t *reg_req; |
AnnaBridge | 125:2e9cc70d1897 | 116 | volatile uint32_t *reg_ack; |
AnnaBridge | 125:2e9cc70d1897 | 117 | uint32_t req_val; |
AnnaBridge | 125:2e9cc70d1897 | 118 | uint32_t ack_mask; |
AnnaBridge | 125:2e9cc70d1897 | 119 | } pin_function_t; |
AnnaBridge | 125:2e9cc70d1897 | 120 | |
AnnaBridge | 125:2e9cc70d1897 | 121 | #ifdef __cplusplus |
AnnaBridge | 125:2e9cc70d1897 | 122 | } |
AnnaBridge | 125:2e9cc70d1897 | 123 | #endif |
AnnaBridge | 125:2e9cc70d1897 | 124 | |
AnnaBridge | 125:2e9cc70d1897 | 125 | #endif |