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