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:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
mbed library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 171:3a7713b1edbc 1 /***************************************************************************//**
AnnaBridge 171:3a7713b1edbc 2 * @file objects.h
AnnaBridge 171:3a7713b1edbc 3 *******************************************************************************
AnnaBridge 171:3a7713b1edbc 4 * @section License
AnnaBridge 171:3a7713b1edbc 5 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
AnnaBridge 171:3a7713b1edbc 6 *******************************************************************************
AnnaBridge 171:3a7713b1edbc 7 *
AnnaBridge 171:3a7713b1edbc 8 * SPDX-License-Identifier: Apache-2.0
AnnaBridge 171:3a7713b1edbc 9 *
AnnaBridge 171:3a7713b1edbc 10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
AnnaBridge 171:3a7713b1edbc 11 * not use this file except in compliance with the License.
AnnaBridge 171:3a7713b1edbc 12 * You may obtain a copy of the License at
AnnaBridge 171:3a7713b1edbc 13 *
AnnaBridge 171:3a7713b1edbc 14 * http://www.apache.org/licenses/LICENSE-2.0
AnnaBridge 171:3a7713b1edbc 15 *
AnnaBridge 171:3a7713b1edbc 16 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 171:3a7713b1edbc 17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
AnnaBridge 171:3a7713b1edbc 18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 171:3a7713b1edbc 19 * See the License for the specific language governing permissions and
AnnaBridge 171:3a7713b1edbc 20 * limitations under the License.
AnnaBridge 171:3a7713b1edbc 21 *
AnnaBridge 171:3a7713b1edbc 22 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 23
AnnaBridge 171:3a7713b1edbc 24 #ifndef MBED_OBJECTS_H
AnnaBridge 171:3a7713b1edbc 25 #define MBED_OBJECTS_H
AnnaBridge 171:3a7713b1edbc 26
AnnaBridge 171:3a7713b1edbc 27 #include "PinNames.h"
AnnaBridge 171:3a7713b1edbc 28 #include "PeripheralNames.h"
AnnaBridge 171:3a7713b1edbc 29 #include "PortNames.h"
AnnaBridge 171:3a7713b1edbc 30 #include "em_i2c.h"
AnnaBridge 171:3a7713b1edbc 31 #include "em_dma.h"
AnnaBridge 171:3a7713b1edbc 32 #include "em_cmu.h"
AnnaBridge 171:3a7713b1edbc 33 #include "dma_api_HAL.h"
AnnaBridge 171:3a7713b1edbc 34
AnnaBridge 171:3a7713b1edbc 35 #ifdef __cplusplus
AnnaBridge 171:3a7713b1edbc 36 extern "C" {
AnnaBridge 171:3a7713b1edbc 37 #endif
AnnaBridge 171:3a7713b1edbc 38
AnnaBridge 171:3a7713b1edbc 39 typedef struct {
AnnaBridge 171:3a7713b1edbc 40 PinName pin;
AnnaBridge 171:3a7713b1edbc 41 PinMode mode;
AnnaBridge 171:3a7713b1edbc 42 PinDirection dir;
AnnaBridge 171:3a7713b1edbc 43 } gpio_t;
AnnaBridge 171:3a7713b1edbc 44
AnnaBridge 171:3a7713b1edbc 45 #if DEVICE_ANALOGIN
AnnaBridge 171:3a7713b1edbc 46 struct analogin_s {
AnnaBridge 171:3a7713b1edbc 47 ADC_TypeDef *adc;
AnnaBridge 171:3a7713b1edbc 48 uint32_t channel;
AnnaBridge 171:3a7713b1edbc 49 };
AnnaBridge 171:3a7713b1edbc 50 #endif
AnnaBridge 171:3a7713b1edbc 51
AnnaBridge 171:3a7713b1edbc 52 #if DEVICE_ANALOGOUT
AnnaBridge 171:3a7713b1edbc 53 struct dac_s {
AnnaBridge 171:3a7713b1edbc 54 DAC_TypeDef *dac;
AnnaBridge 171:3a7713b1edbc 55 uint32_t channel;
AnnaBridge 171:3a7713b1edbc 56 };
AnnaBridge 171:3a7713b1edbc 57 #endif
AnnaBridge 171:3a7713b1edbc 58
AnnaBridge 171:3a7713b1edbc 59 #if DEVICE_I2C
AnnaBridge 171:3a7713b1edbc 60 struct i2c_s {
AnnaBridge 171:3a7713b1edbc 61 I2C_TypeDef *i2c;
AnnaBridge 171:3a7713b1edbc 62 uint32_t location;
AnnaBridge 171:3a7713b1edbc 63 #if DEVICE_I2C_ASYNCH
AnnaBridge 171:3a7713b1edbc 64 uint32_t events;
AnnaBridge 171:3a7713b1edbc 65 I2C_TransferSeq_TypeDef xfer;
AnnaBridge 171:3a7713b1edbc 66 #endif
AnnaBridge 171:3a7713b1edbc 67 };
AnnaBridge 171:3a7713b1edbc 68 #endif
AnnaBridge 171:3a7713b1edbc 69
AnnaBridge 171:3a7713b1edbc 70 #if DEVICE_PORTOUT
AnnaBridge 171:3a7713b1edbc 71 struct port_s {
AnnaBridge 171:3a7713b1edbc 72 PortName port;
AnnaBridge 171:3a7713b1edbc 73 uint32_t mask;
AnnaBridge 171:3a7713b1edbc 74 PinDirection dir;
AnnaBridge 171:3a7713b1edbc 75 };
AnnaBridge 171:3a7713b1edbc 76 #endif
AnnaBridge 171:3a7713b1edbc 77
AnnaBridge 171:3a7713b1edbc 78 #if DEVICE_PWMOUT
AnnaBridge 171:3a7713b1edbc 79 struct pwmout_s {
AnnaBridge 171:3a7713b1edbc 80 //Channel on TIMER
AnnaBridge 171:3a7713b1edbc 81 uint32_t channel;
AnnaBridge 171:3a7713b1edbc 82 PinName pin;
AnnaBridge 171:3a7713b1edbc 83 };
AnnaBridge 171:3a7713b1edbc 84 #endif
AnnaBridge 171:3a7713b1edbc 85
AnnaBridge 171:3a7713b1edbc 86 #if DEVICE_INTERRUPTIN
AnnaBridge 171:3a7713b1edbc 87 struct gpio_irq_s {
AnnaBridge 171:3a7713b1edbc 88 PinName pin;
AnnaBridge 171:3a7713b1edbc 89 uint8_t risingEdge;
AnnaBridge 171:3a7713b1edbc 90 uint8_t fallingEdge;
AnnaBridge 171:3a7713b1edbc 91 };
AnnaBridge 171:3a7713b1edbc 92 #endif
AnnaBridge 171:3a7713b1edbc 93
AnnaBridge 171:3a7713b1edbc 94 #if DEVICE_SERIAL
AnnaBridge 171:3a7713b1edbc 95 struct serial_s {
AnnaBridge 171:3a7713b1edbc 96 union {
AnnaBridge 171:3a7713b1edbc 97 USART_TypeDef *uart;
AnnaBridge 171:3a7713b1edbc 98 LEUART_TypeDef *leuart;
AnnaBridge 171:3a7713b1edbc 99 } periph;
AnnaBridge 171:3a7713b1edbc 100 #ifndef _SILICON_LABS_32B_PLATFORM_2
AnnaBridge 171:3a7713b1edbc 101 uint32_t location;
AnnaBridge 171:3a7713b1edbc 102 #else
AnnaBridge 171:3a7713b1edbc 103 uint32_t location_tx;
AnnaBridge 171:3a7713b1edbc 104 uint32_t location_rx;
AnnaBridge 171:3a7713b1edbc 105 #endif
AnnaBridge 171:3a7713b1edbc 106 PinName rx_pin;
AnnaBridge 171:3a7713b1edbc 107 PinName tx_pin;
AnnaBridge 171:3a7713b1edbc 108 #if DEVICE_SERIAL_ASYNCH
AnnaBridge 171:3a7713b1edbc 109 uint32_t events;
AnnaBridge 171:3a7713b1edbc 110 DMA_OPTIONS_t dmaOptionsTX;
AnnaBridge 171:3a7713b1edbc 111 DMA_OPTIONS_t dmaOptionsRX;
AnnaBridge 171:3a7713b1edbc 112 #endif
AnnaBridge 171:3a7713b1edbc 113 uint32_t sleep_blocked;
AnnaBridge 171:3a7713b1edbc 114 };
AnnaBridge 171:3a7713b1edbc 115 #endif
AnnaBridge 171:3a7713b1edbc 116
AnnaBridge 171:3a7713b1edbc 117 #if DEVICE_SPI
AnnaBridge 171:3a7713b1edbc 118 struct spi_s {
AnnaBridge 171:3a7713b1edbc 119 USART_TypeDef *spi;
AnnaBridge 171:3a7713b1edbc 120 uint32_t location;
AnnaBridge 171:3a7713b1edbc 121 uint32_t route;
AnnaBridge 171:3a7713b1edbc 122 uint8_t bits;
AnnaBridge 171:3a7713b1edbc 123 uint8_t master;
AnnaBridge 171:3a7713b1edbc 124 #if DEVICE_SPI_ASYNCH
AnnaBridge 171:3a7713b1edbc 125 uint32_t event;
AnnaBridge 171:3a7713b1edbc 126 DMA_OPTIONS_t dmaOptionsTX;
AnnaBridge 171:3a7713b1edbc 127 DMA_OPTIONS_t dmaOptionsRX;
AnnaBridge 171:3a7713b1edbc 128 #endif
AnnaBridge 171:3a7713b1edbc 129 };
AnnaBridge 171:3a7713b1edbc 130 #endif
AnnaBridge 171:3a7713b1edbc 131
AnnaBridge 171:3a7713b1edbc 132 #if DEVICE_RTC
AnnaBridge 171:3a7713b1edbc 133 struct lp_timer_s {
AnnaBridge 171:3a7713b1edbc 134 uint32_t start;
AnnaBridge 171:3a7713b1edbc 135 uint32_t stop;
AnnaBridge 171:3a7713b1edbc 136 };
AnnaBridge 171:3a7713b1edbc 137 #endif
AnnaBridge 171:3a7713b1edbc 138
AnnaBridge 171:3a7713b1edbc 139 #if DEVICE_FLASH
AnnaBridge 171:3a7713b1edbc 140 struct flash_s {
AnnaBridge 171:3a7713b1edbc 141 MSC_TypeDef *msc;
AnnaBridge 171:3a7713b1edbc 142 };
AnnaBridge 171:3a7713b1edbc 143 #endif
AnnaBridge 171:3a7713b1edbc 144
AnnaBridge 171:3a7713b1edbc 145 #if DEVICE_TRNG
AnnaBridge 171:3a7713b1edbc 146 struct trng_s {
AnnaBridge 171:3a7713b1edbc 147 TRNG_TypeDef *instance;
AnnaBridge 171:3a7713b1edbc 148 };
AnnaBridge 171:3a7713b1edbc 149 #endif
AnnaBridge 171:3a7713b1edbc 150
AnnaBridge 171:3a7713b1edbc 151 #if DEVICE_CAN
AnnaBridge 171:3a7713b1edbc 152 struct can_s {
AnnaBridge 171:3a7713b1edbc 153 CAN_TypeDef *instance;
AnnaBridge 171:3a7713b1edbc 154 };
AnnaBridge 171:3a7713b1edbc 155 #endif
AnnaBridge 171:3a7713b1edbc 156
AnnaBridge 171:3a7713b1edbc 157 #if DEVICE_QSPI
AnnaBridge 171:3a7713b1edbc 158 struct qspi_s {
AnnaBridge 171:3a7713b1edbc 159 QSPI_TypeDef *instance;
AnnaBridge 171:3a7713b1edbc 160 PinName io0;
AnnaBridge 171:3a7713b1edbc 161 PinName io1;
AnnaBridge 171:3a7713b1edbc 162 PinName io2;
AnnaBridge 171:3a7713b1edbc 163 PinName io3;
AnnaBridge 171:3a7713b1edbc 164 PinName sclk;
AnnaBridge 171:3a7713b1edbc 165 PinName ssel;
AnnaBridge 171:3a7713b1edbc 166 };
AnnaBridge 171:3a7713b1edbc 167 #endif
AnnaBridge 171:3a7713b1edbc 168
AnnaBridge 171:3a7713b1edbc 169 #ifdef __cplusplus
AnnaBridge 171:3a7713b1edbc 170 }
AnnaBridge 171:3a7713b1edbc 171 #endif
AnnaBridge 171:3a7713b1edbc 172
AnnaBridge 171:3a7713b1edbc 173 #endif