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