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:
Kojto
Date:
Wed Jul 19 16:46:19 2017 +0100
Revision:
147:a97add6d7e64
Parent:
124:2241e3a39974
Release 147 of the mbed library.

Who changed what in which revision?

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