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
Parent:
TARGET_SAMR21G18A/TARGET_Atmel/TARGET_SAM_CortexM0P/objects.h@111:4336505e4b1c
mbed library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 111:4336505e4b1c 1 /* mbed Microcontroller Library
Kojto 111:4336505e4b1c 2 * Copyright (c) 2006-2015 ARM Limited
Kojto 111:4336505e4b1c 3 *
Kojto 111:4336505e4b1c 4 * Licensed under the Apache License, Version 2.0 (the "License");
Kojto 111:4336505e4b1c 5 * you may not use this file except in compliance with the License.
Kojto 111:4336505e4b1c 6 * You may obtain a copy of the License at
Kojto 111:4336505e4b1c 7 *
Kojto 111:4336505e4b1c 8 * http://www.apache.org/licenses/LICENSE-2.0
Kojto 111:4336505e4b1c 9 *
Kojto 111:4336505e4b1c 10 * Unless required by applicable law or agreed to in writing, software
Kojto 111:4336505e4b1c 11 * distributed under the License is distributed on an "AS IS" BASIS,
Kojto 111:4336505e4b1c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Kojto 111:4336505e4b1c 13 * See the License for the specific language governing permissions and
Kojto 111:4336505e4b1c 14 * limitations under the License.
Kojto 111:4336505e4b1c 15 */
Kojto 111:4336505e4b1c 16 #ifndef MBED_OBJECTS_H
Kojto 111:4336505e4b1c 17 #define MBED_OBJECTS_H
Kojto 111:4336505e4b1c 18
Kojto 111:4336505e4b1c 19 #include "cmsis.h"
Kojto 111:4336505e4b1c 20 #include "PortNames.h"
Kojto 111:4336505e4b1c 21 #include "PeripheralNames.h"
Kojto 111:4336505e4b1c 22 #include "gpio_object.h"
Kojto 111:4336505e4b1c 23 #include "tc.h"
Kojto 111:4336505e4b1c 24 #include "tcc.h"
Kojto 111:4336505e4b1c 25 #include "adc.h"
Kojto 111:4336505e4b1c 26 #include "extint.h"
Kojto 111:4336505e4b1c 27 #include "i2c_master.h"
Kojto 111:4336505e4b1c 28 #include "i2c_slave.h"
Kojto 111:4336505e4b1c 29 #include "dma_api.h"
Kojto 111:4336505e4b1c 30
Kojto 111:4336505e4b1c 31 #if DEVICE_ANALOGOUT
Kojto 111:4336505e4b1c 32 #include "dac.h"
Kojto 111:4336505e4b1c 33 #endif
Kojto 111:4336505e4b1c 34
Kojto 111:4336505e4b1c 35 #ifdef __cplusplus
Kojto 111:4336505e4b1c 36 extern "C" {
Kojto 111:4336505e4b1c 37 #endif
Kojto 111:4336505e4b1c 38
Kojto 111:4336505e4b1c 39 struct gpio_irq_s {
Kojto 111:4336505e4b1c 40 uint8_t irqmask;
Kojto 111:4336505e4b1c 41 uint32_t port;
Kojto 111:4336505e4b1c 42 uint32_t pin;
Kojto 111:4336505e4b1c 43 uint32_t ch;
Kojto 111:4336505e4b1c 44 struct extint_chan_conf config_extint_chan;
Kojto 111:4336505e4b1c 45 };
Kojto 111:4336505e4b1c 46
Kojto 111:4336505e4b1c 47 struct port_s {
Kojto 111:4336505e4b1c 48 __IO uint32_t *OUTCLR;
Kojto 111:4336505e4b1c 49 __IO uint32_t *OUTSET;
Kojto 111:4336505e4b1c 50 __I uint32_t *IN;
Kojto 111:4336505e4b1c 51 __I uint32_t *OUT;
Kojto 111:4336505e4b1c 52
Kojto 111:4336505e4b1c 53 PortName port;
Kojto 111:4336505e4b1c 54 uint32_t mask;
Kojto 111:4336505e4b1c 55 uint8_t powersave;
Kojto 111:4336505e4b1c 56 uint8_t mode;
Kojto 111:4336505e4b1c 57 uint8_t direction;
Kojto 111:4336505e4b1c 58 };
Kojto 111:4336505e4b1c 59
Kojto 111:4336505e4b1c 60 struct serial_s {
Kojto 111:4336505e4b1c 61 Sercom *usart;
Kojto 111:4336505e4b1c 62 uint32_t index;
Kojto 111:4336505e4b1c 63 uint32_t parity;
Kojto 111:4336505e4b1c 64 uint32_t stopbits;
Kojto 111:4336505e4b1c 65 uint32_t character_size;
Kojto 111:4336505e4b1c 66 uint32_t mux_setting;
Kojto 111:4336505e4b1c 67 uint32_t baudrate;
Kojto 111:4336505e4b1c 68 PinName pins[4];
Kojto 111:4336505e4b1c 69 #if DEVICE_SERIAL_ASYNCH
Kojto 111:4336505e4b1c 70 uint32_t events;
Kojto 111:4336505e4b1c 71 #endif
Kojto 111:4336505e4b1c 72 };
Kojto 111:4336505e4b1c 73
Kojto 111:4336505e4b1c 74 struct analogin_s {
Kojto 111:4336505e4b1c 75 ADCName adc;
Kojto 111:4336505e4b1c 76 struct adc_config config_adc;
Kojto 111:4336505e4b1c 77 };
Kojto 111:4336505e4b1c 78
Kojto 111:4336505e4b1c 79 #if DEVICE_ANALOGOUT
Kojto 111:4336505e4b1c 80 struct dac_s {
Kojto 111:4336505e4b1c 81 DACName dac;
Kojto 111:4336505e4b1c 82 PinName pin;
Kojto 111:4336505e4b1c 83 uint32_t channel;
Kojto 111:4336505e4b1c 84 struct dac_module dac_instance;
Kojto 111:4336505e4b1c 85 };
Kojto 111:4336505e4b1c 86 #endif
Kojto 111:4336505e4b1c 87
Kojto 111:4336505e4b1c 88 struct pwmout_s {
Kojto 111:4336505e4b1c 89 struct tcc_module tcc;
Kojto 111:4336505e4b1c 90 PinName pin;
Kojto 111:4336505e4b1c 91 uint32_t period;
Kojto 111:4336505e4b1c 92 float duty_cycle;
Kojto 111:4336505e4b1c 93 double us_per_cycle;
Kojto 111:4336505e4b1c 94 enum gclk_generator clock_source;
Kojto 111:4336505e4b1c 95 enum tc_clock_prescaler clock_prescaler;
Kojto 111:4336505e4b1c 96 };
Kojto 111:4336505e4b1c 97
Kojto 111:4336505e4b1c 98 struct i2c_s {
Kojto 111:4336505e4b1c 99 struct i2c_master_module master;
Kojto 111:4336505e4b1c 100 struct i2c_slave_module slave;
Kojto 111:4336505e4b1c 101 uint8_t mode;
Kojto 111:4336505e4b1c 102 uint32_t baud_rate;
Kojto 111:4336505e4b1c 103 uint32_t baud_rate_high_speed;
Kojto 111:4336505e4b1c 104 uint8_t start_pending;
Kojto 111:4336505e4b1c 105 PinName pins[2];
Kojto 111:4336505e4b1c 106 #if DEVICE_I2C_ASYNCH
Kojto 111:4336505e4b1c 107 uint32_t events;
Kojto 111:4336505e4b1c 108 uint32_t handler;
Kojto 111:4336505e4b1c 109 struct i2c_master_packet wr_packet;
Kojto 111:4336505e4b1c 110 struct i2c_master_packet rd_packet;
Kojto 111:4336505e4b1c 111 #endif
Kojto 111:4336505e4b1c 112 };
Kojto 111:4336505e4b1c 113
Kojto 111:4336505e4b1c 114 struct spi_s {
Kojto 111:4336505e4b1c 115 Sercom *spi;
Kojto 111:4336505e4b1c 116 uint8_t mode;
Kojto 111:4336505e4b1c 117 PinName pins[4];
Kojto 111:4336505e4b1c 118 #if DEVICE_SPI_ASYNCH
Kojto 111:4336505e4b1c 119 uint8_t status;
Kojto 111:4336505e4b1c 120 uint32_t mask;
Kojto 111:4336505e4b1c 121 uint32_t event;
Kojto 111:4336505e4b1c 122 void *tx_buffer;
Kojto 111:4336505e4b1c 123 void *rx_buffer;
Kojto 111:4336505e4b1c 124 uint8_t dma_usage;
Kojto 111:4336505e4b1c 125 #endif
Kojto 111:4336505e4b1c 126 };
Kojto 111:4336505e4b1c 127
Kojto 111:4336505e4b1c 128 #ifdef __cplusplus
Kojto 111:4336505e4b1c 129 }
Kojto 111:4336505e4b1c 130 #endif
Kojto 111:4336505e4b1c 131
Kojto 111:4336505e4b1c 132 #endif