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:
emilmont
Date:
Fri Feb 14 14:36:43 2014 +0000
Revision:
77:869cf507173a
Release 77 of the mbed library

Main changes:
* Add target NUCLEO_F030R8
* Add target NUCLEO_F401RE
* Add target NUCLEO_F103RB
* Add target NUCLEO_L152RE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /* mbed Microcontroller Library
emilmont 77:869cf507173a 2 *******************************************************************************
emilmont 77:869cf507173a 3 * Copyright (c) 2014, STMicroelectronics
emilmont 77:869cf507173a 4 * All rights reserved.
emilmont 77:869cf507173a 5 *
emilmont 77:869cf507173a 6 * Redistribution and use in source and binary forms, with or without
emilmont 77:869cf507173a 7 * modification, are permitted provided that the following conditions are met:
emilmont 77:869cf507173a 8 *
emilmont 77:869cf507173a 9 * 1. Redistributions of source code must retain the above copyright notice,
emilmont 77:869cf507173a 10 * this list of conditions and the following disclaimer.
emilmont 77:869cf507173a 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
emilmont 77:869cf507173a 12 * this list of conditions and the following disclaimer in the documentation
emilmont 77:869cf507173a 13 * and/or other materials provided with the distribution.
emilmont 77:869cf507173a 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
emilmont 77:869cf507173a 15 * may be used to endorse or promote products derived from this software
emilmont 77:869cf507173a 16 * without specific prior written permission.
emilmont 77:869cf507173a 17 *
emilmont 77:869cf507173a 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
emilmont 77:869cf507173a 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
emilmont 77:869cf507173a 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
emilmont 77:869cf507173a 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
emilmont 77:869cf507173a 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
emilmont 77:869cf507173a 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
emilmont 77:869cf507173a 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emilmont 77:869cf507173a 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
emilmont 77:869cf507173a 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
emilmont 77:869cf507173a 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 28 *******************************************************************************
emilmont 77:869cf507173a 29 */
emilmont 77:869cf507173a 30 #ifndef MBED_OBJECTS_H
emilmont 77:869cf507173a 31 #define MBED_OBJECTS_H
emilmont 77:869cf507173a 32
emilmont 77:869cf507173a 33 #include "cmsis.h"
emilmont 77:869cf507173a 34 #include "PortNames.h"
emilmont 77:869cf507173a 35 #include "PeripheralNames.h"
emilmont 77:869cf507173a 36 #include "PinNames.h"
emilmont 77:869cf507173a 37
emilmont 77:869cf507173a 38 #ifdef __cplusplus
emilmont 77:869cf507173a 39 extern "C" {
emilmont 77:869cf507173a 40 #endif
emilmont 77:869cf507173a 41
emilmont 77:869cf507173a 42 struct gpio_irq_s {
emilmont 77:869cf507173a 43 IRQn_Type irq_n;
emilmont 77:869cf507173a 44 uint32_t irq_index;
emilmont 77:869cf507173a 45 uint32_t event;
emilmont 77:869cf507173a 46 };
emilmont 77:869cf507173a 47
emilmont 77:869cf507173a 48 struct port_s {
emilmont 77:869cf507173a 49 PortName port;
emilmont 77:869cf507173a 50 uint32_t mask;
emilmont 77:869cf507173a 51 PinDirection direction;
emilmont 77:869cf507173a 52 __IO uint16_t *reg_in;
emilmont 77:869cf507173a 53 __IO uint16_t *reg_out;
emilmont 77:869cf507173a 54 };
emilmont 77:869cf507173a 55
emilmont 77:869cf507173a 56 struct analogin_s {
emilmont 77:869cf507173a 57 ADCName adc;
emilmont 77:869cf507173a 58 PinName pin;
emilmont 77:869cf507173a 59 };
emilmont 77:869cf507173a 60
emilmont 77:869cf507173a 61 struct dac_s {
emilmont 77:869cf507173a 62 DACName dac;
emilmont 77:869cf507173a 63 PinName channel;
emilmont 77:869cf507173a 64 };
emilmont 77:869cf507173a 65
emilmont 77:869cf507173a 66 struct serial_s {
emilmont 77:869cf507173a 67 UARTName uart;
emilmont 77:869cf507173a 68 int index; // Used by irq
emilmont 77:869cf507173a 69 uint32_t baudrate;
emilmont 77:869cf507173a 70 uint32_t databits;
emilmont 77:869cf507173a 71 uint32_t stopbits;
emilmont 77:869cf507173a 72 uint32_t parity;
emilmont 77:869cf507173a 73 };
emilmont 77:869cf507173a 74
emilmont 77:869cf507173a 75 struct spi_s {
emilmont 77:869cf507173a 76 SPIName spi;
emilmont 77:869cf507173a 77 uint32_t bits;
emilmont 77:869cf507173a 78 uint32_t cpol;
emilmont 77:869cf507173a 79 uint32_t cpha;
emilmont 77:869cf507173a 80 uint32_t mode;
emilmont 77:869cf507173a 81 uint32_t nss;
emilmont 77:869cf507173a 82 uint32_t br_presc;
emilmont 77:869cf507173a 83 };
emilmont 77:869cf507173a 84
emilmont 77:869cf507173a 85 struct i2c_s {
emilmont 77:869cf507173a 86 I2CName i2c;
emilmont 77:869cf507173a 87 };
emilmont 77:869cf507173a 88
emilmont 77:869cf507173a 89 struct pwmout_s {
emilmont 77:869cf507173a 90 PWMName pwm;
emilmont 77:869cf507173a 91 PinName pin;
emilmont 77:869cf507173a 92 uint32_t period;
emilmont 77:869cf507173a 93 uint32_t pulse;
emilmont 77:869cf507173a 94 };
emilmont 77:869cf507173a 95
emilmont 77:869cf507173a 96 #include "gpio_object.h"
emilmont 77:869cf507173a 97
emilmont 77:869cf507173a 98 #ifdef __cplusplus
emilmont 77:869cf507173a 99 }
emilmont 77:869cf507173a 100 #endif
emilmont 77:869cf507173a 101
emilmont 77:869cf507173a 102 #endif