test

Committer:
elijahsj
Date:
Mon Nov 09 00:02:47 2020 -0500
Revision:
1:8a094db1347f
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elijahsj 1:8a094db1347f 1 /* mbed Microcontroller Library
elijahsj 1:8a094db1347f 2 *******************************************************************************
elijahsj 1:8a094db1347f 3 * Copyright (c) 2016, STMicroelectronics
elijahsj 1:8a094db1347f 4 * All rights reserved.
elijahsj 1:8a094db1347f 5 *
elijahsj 1:8a094db1347f 6 * Redistribution and use in source and binary forms, with or without
elijahsj 1:8a094db1347f 7 * modification, are permitted provided that the following conditions are met:
elijahsj 1:8a094db1347f 8 *
elijahsj 1:8a094db1347f 9 * 1. Redistributions of source code must retain the above copyright notice,
elijahsj 1:8a094db1347f 10 * this list of conditions and the following disclaimer.
elijahsj 1:8a094db1347f 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
elijahsj 1:8a094db1347f 12 * this list of conditions and the following disclaimer in the documentation
elijahsj 1:8a094db1347f 13 * and/or other materials provided with the distribution.
elijahsj 1:8a094db1347f 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
elijahsj 1:8a094db1347f 15 * may be used to endorse or promote products derived from this software
elijahsj 1:8a094db1347f 16 * without specific prior written permission.
elijahsj 1:8a094db1347f 17 *
elijahsj 1:8a094db1347f 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
elijahsj 1:8a094db1347f 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
elijahsj 1:8a094db1347f 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
elijahsj 1:8a094db1347f 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
elijahsj 1:8a094db1347f 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
elijahsj 1:8a094db1347f 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
elijahsj 1:8a094db1347f 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
elijahsj 1:8a094db1347f 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
elijahsj 1:8a094db1347f 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
elijahsj 1:8a094db1347f 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
elijahsj 1:8a094db1347f 28 *******************************************************************************
elijahsj 1:8a094db1347f 29 */
elijahsj 1:8a094db1347f 30 #ifndef MBED_COMMON_OBJECTS_H
elijahsj 1:8a094db1347f 31 #define MBED_COMMON_OBJECTS_H
elijahsj 1:8a094db1347f 32
elijahsj 1:8a094db1347f 33 #include "cmsis.h"
elijahsj 1:8a094db1347f 34 #include "PortNames.h"
elijahsj 1:8a094db1347f 35 #include "PeripheralNames.h"
elijahsj 1:8a094db1347f 36 #include "PinNames.h"
elijahsj 1:8a094db1347f 37
elijahsj 1:8a094db1347f 38 #ifdef __cplusplus
elijahsj 1:8a094db1347f 39 extern "C" {
elijahsj 1:8a094db1347f 40 #endif
elijahsj 1:8a094db1347f 41
elijahsj 1:8a094db1347f 42 struct pwmout_s {
elijahsj 1:8a094db1347f 43 PWMName pwm;
elijahsj 1:8a094db1347f 44 PinName pin;
elijahsj 1:8a094db1347f 45 uint32_t prescaler;
elijahsj 1:8a094db1347f 46 uint32_t period;
elijahsj 1:8a094db1347f 47 uint32_t pulse;
elijahsj 1:8a094db1347f 48 uint8_t channel;
elijahsj 1:8a094db1347f 49 uint8_t inverted;
elijahsj 1:8a094db1347f 50 };
elijahsj 1:8a094db1347f 51
elijahsj 1:8a094db1347f 52 struct spi_s {
elijahsj 1:8a094db1347f 53 SPI_HandleTypeDef handle;
elijahsj 1:8a094db1347f 54 IRQn_Type spiIRQ;
elijahsj 1:8a094db1347f 55 SPIName spi;
elijahsj 1:8a094db1347f 56 PinName pin_miso;
elijahsj 1:8a094db1347f 57 PinName pin_mosi;
elijahsj 1:8a094db1347f 58 PinName pin_sclk;
elijahsj 1:8a094db1347f 59 PinName pin_ssel;
elijahsj 1:8a094db1347f 60 #ifdef DEVICE_SPI_ASYNCH
elijahsj 1:8a094db1347f 61 uint32_t event;
elijahsj 1:8a094db1347f 62 uint8_t transfer_type;
elijahsj 1:8a094db1347f 63 #endif
elijahsj 1:8a094db1347f 64 };
elijahsj 1:8a094db1347f 65
elijahsj 1:8a094db1347f 66 struct serial_s {
elijahsj 1:8a094db1347f 67 UARTName uart;
elijahsj 1:8a094db1347f 68 int index; // Used by irq
elijahsj 1:8a094db1347f 69 uint32_t baudrate;
elijahsj 1:8a094db1347f 70 uint32_t databits;
elijahsj 1:8a094db1347f 71 uint32_t stopbits;
elijahsj 1:8a094db1347f 72 uint32_t parity;
elijahsj 1:8a094db1347f 73 PinName pin_tx;
elijahsj 1:8a094db1347f 74 PinName pin_rx;
elijahsj 1:8a094db1347f 75 #if DEVICE_SERIAL_ASYNCH
elijahsj 1:8a094db1347f 76 uint32_t events;
elijahsj 1:8a094db1347f 77 #endif
elijahsj 1:8a094db1347f 78 #if DEVICE_SERIAL_FC
elijahsj 1:8a094db1347f 79 uint32_t hw_flow_ctl;
elijahsj 1:8a094db1347f 80 PinName pin_rts;
elijahsj 1:8a094db1347f 81 PinName pin_cts;
elijahsj 1:8a094db1347f 82 #endif
elijahsj 1:8a094db1347f 83 };
elijahsj 1:8a094db1347f 84
elijahsj 1:8a094db1347f 85 struct i2c_s {
elijahsj 1:8a094db1347f 86 /* The 1st 2 members I2CName i2c
elijahsj 1:8a094db1347f 87 * and I2C_HandleTypeDef handle should
elijahsj 1:8a094db1347f 88 * be kept as the first members of this struct
elijahsj 1:8a094db1347f 89 * to ensure i2c_get_obj to work as expected
elijahsj 1:8a094db1347f 90 */
elijahsj 1:8a094db1347f 91 I2CName i2c;
elijahsj 1:8a094db1347f 92 I2C_HandleTypeDef handle;
elijahsj 1:8a094db1347f 93 uint8_t index;
elijahsj 1:8a094db1347f 94 int hz;
elijahsj 1:8a094db1347f 95 PinName sda;
elijahsj 1:8a094db1347f 96 PinName scl;
elijahsj 1:8a094db1347f 97 IRQn_Type event_i2cIRQ;
elijahsj 1:8a094db1347f 98 IRQn_Type error_i2cIRQ;
elijahsj 1:8a094db1347f 99 uint32_t XferOperation;
elijahsj 1:8a094db1347f 100 volatile uint8_t event;
elijahsj 1:8a094db1347f 101 volatile int pending_start;
elijahsj 1:8a094db1347f 102 #if DEVICE_I2CSLAVE
elijahsj 1:8a094db1347f 103 uint8_t slave;
elijahsj 1:8a094db1347f 104 volatile uint8_t pending_slave_tx_master_rx;
elijahsj 1:8a094db1347f 105 volatile uint8_t pending_slave_rx_maxter_tx;
elijahsj 1:8a094db1347f 106 #endif
elijahsj 1:8a094db1347f 107 #if DEVICE_I2C_ASYNCH
elijahsj 1:8a094db1347f 108 uint32_t address;
elijahsj 1:8a094db1347f 109 uint8_t stop;
elijahsj 1:8a094db1347f 110 uint8_t available_events;
elijahsj 1:8a094db1347f 111 #endif
elijahsj 1:8a094db1347f 112 };
elijahsj 1:8a094db1347f 113
elijahsj 1:8a094db1347f 114 struct analogin_s {
elijahsj 1:8a094db1347f 115 ADC_HandleTypeDef handle;
elijahsj 1:8a094db1347f 116 PinName pin;
elijahsj 1:8a094db1347f 117 uint8_t channel;
elijahsj 1:8a094db1347f 118 };
elijahsj 1:8a094db1347f 119
elijahsj 1:8a094db1347f 120 #define GPIO_IP_WITHOUT_BRR
elijahsj 1:8a094db1347f 121 #include "gpio_object.h"
elijahsj 1:8a094db1347f 122
elijahsj 1:8a094db1347f 123 struct dac_s {
elijahsj 1:8a094db1347f 124 DACName dac;
elijahsj 1:8a094db1347f 125 PinName pin;
elijahsj 1:8a094db1347f 126 uint32_t channel;
elijahsj 1:8a094db1347f 127 DAC_HandleTypeDef handle;
elijahsj 1:8a094db1347f 128 };
elijahsj 1:8a094db1347f 129
elijahsj 1:8a094db1347f 130 struct flash_s {
elijahsj 1:8a094db1347f 131 /* nothing to be stored for now */
elijahsj 1:8a094db1347f 132 uint32_t dummy;
elijahsj 1:8a094db1347f 133 };
elijahsj 1:8a094db1347f 134
elijahsj 1:8a094db1347f 135 #if DEVICE_CAN
elijahsj 1:8a094db1347f 136 struct can_s {
elijahsj 1:8a094db1347f 137 CAN_HandleTypeDef CanHandle;
elijahsj 1:8a094db1347f 138 int index;
elijahsj 1:8a094db1347f 139 int hz;
elijahsj 1:8a094db1347f 140 };
elijahsj 1:8a094db1347f 141 #endif
elijahsj 1:8a094db1347f 142
elijahsj 1:8a094db1347f 143 #ifdef __cplusplus
elijahsj 1:8a094db1347f 144 }
elijahsj 1:8a094db1347f 145 #endif
elijahsj 1:8a094db1347f 146
elijahsj 1:8a094db1347f 147 #endif
elijahsj 1:8a094db1347f 148