Василий Басалаев / mbed-I2CIO

Fork of mbed-STM32F030F4 by Nothing Special

Committer:
acosinwork
Date:
Thu Feb 01 10:37:10 2018 +0000
Revision:
12:6f07dd7cbe47
Parent:
0:38ccae254a29
Change pin mapping and set internall oscillator as default. Fork to support Troyka GPIO expander (I2C I/O); http://amperka.ru/product/troyka-gpio-expander

Who changed what in which revision?

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