The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

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