Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
TARGET_EFM32ZG_STK3200/TARGET_Silicon_Labs/TARGET_EFM32/objects.h@98:8ab26030e058, 2015-04-29 (annotated)
- Committer:
- Kojto
- Date:
- Wed Apr 29 10:16:23 2015 +0100
- Revision:
- 98:8ab26030e058
- Child:
- 100:cbbeb26dbd92
Release 98 of the mbed library
Changes:
- Silabs new targets (Giant, Zero, Happy, Leopard, Wonder Geckos)
- Asynchronous SPI, I2C, Serial
- LowPower classes
- Nordic - nordic SDK v8.0 update
- Teensy - gcc arm fix for startup
- Nucleo F411 - usb freq fix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 98:8ab26030e058 | 1 | /* mbed Microcontroller Library |
Kojto | 98:8ab26030e058 | 2 | * Copyright (c) 2006-2013 ARM Limited |
Kojto | 98:8ab26030e058 | 3 | * |
Kojto | 98:8ab26030e058 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Kojto | 98:8ab26030e058 | 5 | * you may not use this file except in compliance with the License. |
Kojto | 98:8ab26030e058 | 6 | * You may obtain a copy of the License at |
Kojto | 98:8ab26030e058 | 7 | * |
Kojto | 98:8ab26030e058 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Kojto | 98:8ab26030e058 | 9 | * |
Kojto | 98:8ab26030e058 | 10 | * Unless required by applicable law or agreed to in writing, software |
Kojto | 98:8ab26030e058 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Kojto | 98:8ab26030e058 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Kojto | 98:8ab26030e058 | 13 | * See the License for the specific language governing permissions and |
Kojto | 98:8ab26030e058 | 14 | * limitations under the License. |
Kojto | 98:8ab26030e058 | 15 | */ |
Kojto | 98:8ab26030e058 | 16 | #ifndef MBED_OBJECTS_H |
Kojto | 98:8ab26030e058 | 17 | #define MBED_OBJECTS_H |
Kojto | 98:8ab26030e058 | 18 | |
Kojto | 98:8ab26030e058 | 19 | #include "PinNames.h" |
Kojto | 98:8ab26030e058 | 20 | #include "PeripheralNames.h" |
Kojto | 98:8ab26030e058 | 21 | #include "PortNames.h" |
Kojto | 98:8ab26030e058 | 22 | #include "em_i2c.h" |
Kojto | 98:8ab26030e058 | 23 | #include "em_dma.h" |
Kojto | 98:8ab26030e058 | 24 | #include "em_cmu.h" |
Kojto | 98:8ab26030e058 | 25 | #include "dma_api_HAL.h" |
Kojto | 98:8ab26030e058 | 26 | |
Kojto | 98:8ab26030e058 | 27 | #ifdef __cplusplus |
Kojto | 98:8ab26030e058 | 28 | extern "C" { |
Kojto | 98:8ab26030e058 | 29 | #endif |
Kojto | 98:8ab26030e058 | 30 | |
Kojto | 98:8ab26030e058 | 31 | #if DEVICE_ANALOGIN |
Kojto | 98:8ab26030e058 | 32 | struct analogin_s { |
Kojto | 98:8ab26030e058 | 33 | ADC_TypeDef *adc; |
Kojto | 98:8ab26030e058 | 34 | uint32_t channel; |
Kojto | 98:8ab26030e058 | 35 | }; |
Kojto | 98:8ab26030e058 | 36 | #endif |
Kojto | 98:8ab26030e058 | 37 | |
Kojto | 98:8ab26030e058 | 38 | #if DEVICE_ANALOGOUT |
Kojto | 98:8ab26030e058 | 39 | struct dac_s { |
Kojto | 98:8ab26030e058 | 40 | DAC_TypeDef *dac; |
Kojto | 98:8ab26030e058 | 41 | uint32_t channel; |
Kojto | 98:8ab26030e058 | 42 | }; |
Kojto | 98:8ab26030e058 | 43 | #endif |
Kojto | 98:8ab26030e058 | 44 | |
Kojto | 98:8ab26030e058 | 45 | #if DEVICE_I2C |
Kojto | 98:8ab26030e058 | 46 | struct i2c_s { |
Kojto | 98:8ab26030e058 | 47 | I2C_TypeDef *i2c; |
Kojto | 98:8ab26030e058 | 48 | int loc; |
Kojto | 98:8ab26030e058 | 49 | uint8_t index; |
Kojto | 98:8ab26030e058 | 50 | PinName sda; |
Kojto | 98:8ab26030e058 | 51 | PinName scl; |
Kojto | 98:8ab26030e058 | 52 | uint32_t clock; |
Kojto | 98:8ab26030e058 | 53 | #if DEVICE_I2C_ASYNCH |
Kojto | 98:8ab26030e058 | 54 | uint32_t events; |
Kojto | 98:8ab26030e058 | 55 | I2C_TransferSeq_TypeDef xfer; |
Kojto | 98:8ab26030e058 | 56 | #endif |
Kojto | 98:8ab26030e058 | 57 | }; |
Kojto | 98:8ab26030e058 | 58 | #endif |
Kojto | 98:8ab26030e058 | 59 | |
Kojto | 98:8ab26030e058 | 60 | #if DEVICE_PORTOUT |
Kojto | 98:8ab26030e058 | 61 | struct port_s { |
Kojto | 98:8ab26030e058 | 62 | PortName port; |
Kojto | 98:8ab26030e058 | 63 | uint32_t mask; |
Kojto | 98:8ab26030e058 | 64 | PinDirection dir; |
Kojto | 98:8ab26030e058 | 65 | }; |
Kojto | 98:8ab26030e058 | 66 | #endif |
Kojto | 98:8ab26030e058 | 67 | |
Kojto | 98:8ab26030e058 | 68 | #if DEVICE_PWMOUT |
Kojto | 98:8ab26030e058 | 69 | struct pwmout_s { |
Kojto | 98:8ab26030e058 | 70 | //The period of the pulse in clock cycles |
Kojto | 98:8ab26030e058 | 71 | uint32_t period_cycles; |
Kojto | 98:8ab26030e058 | 72 | //The width of the pulse in clock cycles |
Kojto | 98:8ab26030e058 | 73 | uint32_t width_cycles; |
Kojto | 98:8ab26030e058 | 74 | //Channel on TIMER |
Kojto | 98:8ab26030e058 | 75 | uint32_t channel; |
Kojto | 98:8ab26030e058 | 76 | PinName pin; |
Kojto | 98:8ab26030e058 | 77 | }; |
Kojto | 98:8ab26030e058 | 78 | #endif |
Kojto | 98:8ab26030e058 | 79 | |
Kojto | 98:8ab26030e058 | 80 | #if DEVICE_INTERRUPTIN |
Kojto | 98:8ab26030e058 | 81 | struct gpio_irq_s { |
Kojto | 98:8ab26030e058 | 82 | uint32_t port; |
Kojto | 98:8ab26030e058 | 83 | PinName pin; |
Kojto | 98:8ab26030e058 | 84 | uint32_t risingEdge; |
Kojto | 98:8ab26030e058 | 85 | uint32_t fallingEdge; |
Kojto | 98:8ab26030e058 | 86 | }; |
Kojto | 98:8ab26030e058 | 87 | #endif |
Kojto | 98:8ab26030e058 | 88 | |
Kojto | 98:8ab26030e058 | 89 | #if DEVICE_SERIAL |
Kojto | 98:8ab26030e058 | 90 | #define SERIAL_NUM_UARTS (7) |
Kojto | 98:8ab26030e058 | 91 | |
Kojto | 98:8ab26030e058 | 92 | struct serial_s { |
Kojto | 98:8ab26030e058 | 93 | union { |
Kojto | 98:8ab26030e058 | 94 | USART_TypeDef *uart; |
Kojto | 98:8ab26030e058 | 95 | LEUART_TypeDef *leuart; |
Kojto | 98:8ab26030e058 | 96 | } periph; |
Kojto | 98:8ab26030e058 | 97 | uint32_t location; |
Kojto | 98:8ab26030e058 | 98 | PinName rx_pin; |
Kojto | 98:8ab26030e058 | 99 | PinName tx_pin; |
Kojto | 98:8ab26030e058 | 100 | #if DEVICE_SERIAL_ASYNCH |
Kojto | 98:8ab26030e058 | 101 | uint32_t events; |
Kojto | 98:8ab26030e058 | 102 | DMA_OPTIONS_t dmaOptionsTX; |
Kojto | 98:8ab26030e058 | 103 | DMA_OPTIONS_t dmaOptionsRX; |
Kojto | 98:8ab26030e058 | 104 | #endif |
Kojto | 98:8ab26030e058 | 105 | }; |
Kojto | 98:8ab26030e058 | 106 | #endif |
Kojto | 98:8ab26030e058 | 107 | |
Kojto | 98:8ab26030e058 | 108 | #if DEVICE_SPI |
Kojto | 98:8ab26030e058 | 109 | struct spi_s { |
Kojto | 98:8ab26030e058 | 110 | USART_TypeDef *spi; |
Kojto | 98:8ab26030e058 | 111 | int location; |
Kojto | 98:8ab26030e058 | 112 | uint8_t bits; |
Kojto | 98:8ab26030e058 | 113 | uint8_t master; |
Kojto | 98:8ab26030e058 | 114 | #if DEVICE_SPI_ASYNCH |
Kojto | 98:8ab26030e058 | 115 | uint32_t event; |
Kojto | 98:8ab26030e058 | 116 | DMA_OPTIONS_t dmaOptionsTX; |
Kojto | 98:8ab26030e058 | 117 | DMA_OPTIONS_t dmaOptionsRX; |
Kojto | 98:8ab26030e058 | 118 | #endif |
Kojto | 98:8ab26030e058 | 119 | }; |
Kojto | 98:8ab26030e058 | 120 | #endif |
Kojto | 98:8ab26030e058 | 121 | |
Kojto | 98:8ab26030e058 | 122 | #if DEVICE_RTC |
Kojto | 98:8ab26030e058 | 123 | struct lp_timer_s { |
Kojto | 98:8ab26030e058 | 124 | uint32_t start; |
Kojto | 98:8ab26030e058 | 125 | uint32_t stop; |
Kojto | 98:8ab26030e058 | 126 | }; |
Kojto | 98:8ab26030e058 | 127 | #endif |
Kojto | 98:8ab26030e058 | 128 | |
Kojto | 98:8ab26030e058 | 129 | #if DEVICE_SLEEP |
Kojto | 98:8ab26030e058 | 130 | #define NUM_SLEEP_MODES 5 |
Kojto | 98:8ab26030e058 | 131 | typedef enum { |
Kojto | 98:8ab26030e058 | 132 | EM0 = 0, |
Kojto | 98:8ab26030e058 | 133 | EM1 = 1, |
Kojto | 98:8ab26030e058 | 134 | EM2 = 2, |
Kojto | 98:8ab26030e058 | 135 | EM3 = 3, |
Kojto | 98:8ab26030e058 | 136 | EM4 = 4 |
Kojto | 98:8ab26030e058 | 137 | } sleepstate_enum; |
Kojto | 98:8ab26030e058 | 138 | #endif |
Kojto | 98:8ab26030e058 | 139 | |
Kojto | 98:8ab26030e058 | 140 | #include "gpio_object.h" |
Kojto | 98:8ab26030e058 | 141 | |
Kojto | 98:8ab26030e058 | 142 | #ifdef __cplusplus |
Kojto | 98:8ab26030e058 | 143 | } |
Kojto | 98:8ab26030e058 | 144 | #endif |
Kojto | 98:8ab26030e058 | 145 | |
Kojto | 98:8ab26030e058 | 146 | #endif |