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.
TARGET_NRF51822/TOOLCHAIN_GCC_ARM/objects.h@172:65be27845400, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 20:53:29 2019 +0000
- Revision:
- 172:65be27845400
- Parent:
- 171:3a7713b1edbc
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 104:b9ad9a133dc7 | 1 | /* mbed Microcontroller Library |
Kojto | 104:b9ad9a133dc7 | 2 | * Copyright (c) 2013 Nordic Semiconductor |
Kojto | 104:b9ad9a133dc7 | 3 | * |
Kojto | 104:b9ad9a133dc7 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Kojto | 104:b9ad9a133dc7 | 5 | * you may not use this file except in compliance with the License. |
Kojto | 104:b9ad9a133dc7 | 6 | * You may obtain a copy of the License at |
Kojto | 104:b9ad9a133dc7 | 7 | * |
Kojto | 104:b9ad9a133dc7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Kojto | 104:b9ad9a133dc7 | 9 | * |
Kojto | 104:b9ad9a133dc7 | 10 | * Unless required by applicable law or agreed to in writing, software |
Kojto | 104:b9ad9a133dc7 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Kojto | 104:b9ad9a133dc7 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Kojto | 104:b9ad9a133dc7 | 13 | * See the License for the specific language governing permissions and |
Kojto | 104:b9ad9a133dc7 | 14 | * limitations under the License. |
Kojto | 104:b9ad9a133dc7 | 15 | */ |
Kojto | 104:b9ad9a133dc7 | 16 | #ifndef MBED_OBJECTS_H |
Kojto | 104:b9ad9a133dc7 | 17 | #define MBED_OBJECTS_H |
Kojto | 104:b9ad9a133dc7 | 18 | |
Kojto | 104:b9ad9a133dc7 | 19 | #include "cmsis.h" |
Kojto | 104:b9ad9a133dc7 | 20 | #include "PortNames.h" |
Kojto | 104:b9ad9a133dc7 | 21 | #include "PeripheralNames.h" |
Kojto | 104:b9ad9a133dc7 | 22 | #include "PinNames.h" |
Kojto | 104:b9ad9a133dc7 | 23 | |
Kojto | 104:b9ad9a133dc7 | 24 | #ifdef __cplusplus |
Kojto | 104:b9ad9a133dc7 | 25 | extern "C" { |
Kojto | 104:b9ad9a133dc7 | 26 | #endif |
Kojto | 104:b9ad9a133dc7 | 27 | |
Kojto | 104:b9ad9a133dc7 | 28 | #define I2C_SPI_PERIPHERAL_FOR_I2C 1 |
Kojto | 104:b9ad9a133dc7 | 29 | #define I2C_SPI_PERIPHERAL_FOR_SPI 2 |
Kojto | 104:b9ad9a133dc7 | 30 | |
Kojto | 104:b9ad9a133dc7 | 31 | typedef struct { |
Kojto | 104:b9ad9a133dc7 | 32 | uint8_t usage; // I2C: 1, SPI: 2 |
Kojto | 104:b9ad9a133dc7 | 33 | uint8_t sda_mosi; |
Kojto | 104:b9ad9a133dc7 | 34 | uint8_t scl_miso; |
Kojto | 104:b9ad9a133dc7 | 35 | uint8_t sclk; |
Kojto | 104:b9ad9a133dc7 | 36 | } i2c_spi_peripheral_t; |
Kojto | 104:b9ad9a133dc7 | 37 | |
Kojto | 104:b9ad9a133dc7 | 38 | struct serial_s { |
Kojto | 104:b9ad9a133dc7 | 39 | NRF_UART_Type *uart; |
Kojto | 104:b9ad9a133dc7 | 40 | int index; |
Kojto | 104:b9ad9a133dc7 | 41 | }; |
Kojto | 104:b9ad9a133dc7 | 42 | |
Kojto | 104:b9ad9a133dc7 | 43 | struct spi_s { |
Kojto | 104:b9ad9a133dc7 | 44 | NRF_SPI_Type *spi; |
Kojto | 104:b9ad9a133dc7 | 45 | NRF_SPIS_Type *spis; |
Kojto | 104:b9ad9a133dc7 | 46 | uint8_t peripheral; |
Kojto | 104:b9ad9a133dc7 | 47 | }; |
Kojto | 104:b9ad9a133dc7 | 48 | |
Kojto | 104:b9ad9a133dc7 | 49 | struct port_s { |
Kojto | 104:b9ad9a133dc7 | 50 | __IO uint32_t *reg_cnf; |
Kojto | 104:b9ad9a133dc7 | 51 | __IO uint32_t *reg_out; |
Kojto | 104:b9ad9a133dc7 | 52 | __I uint32_t *reg_in; |
Kojto | 104:b9ad9a133dc7 | 53 | PortName port; |
Kojto | 104:b9ad9a133dc7 | 54 | uint32_t mask; |
Kojto | 104:b9ad9a133dc7 | 55 | }; |
Kojto | 104:b9ad9a133dc7 | 56 | |
Kojto | 104:b9ad9a133dc7 | 57 | struct pwmout_s { |
Kojto | 104:b9ad9a133dc7 | 58 | PWMName pwm; |
Kojto | 104:b9ad9a133dc7 | 59 | PinName pin; |
Kojto | 104:b9ad9a133dc7 | 60 | }; |
Kojto | 104:b9ad9a133dc7 | 61 | |
Kojto | 104:b9ad9a133dc7 | 62 | struct i2c_s { |
Kojto | 104:b9ad9a133dc7 | 63 | NRF_TWI_Type *i2c; |
Kojto | 104:b9ad9a133dc7 | 64 | PinName sda; |
Kojto | 104:b9ad9a133dc7 | 65 | PinName scl; |
Kojto | 104:b9ad9a133dc7 | 66 | int freq; |
Kojto | 104:b9ad9a133dc7 | 67 | uint8_t address_set; |
Kojto | 104:b9ad9a133dc7 | 68 | uint8_t peripheral; |
Kojto | 104:b9ad9a133dc7 | 69 | }; |
Kojto | 104:b9ad9a133dc7 | 70 | |
Kojto | 104:b9ad9a133dc7 | 71 | struct analogin_s { |
Kojto | 104:b9ad9a133dc7 | 72 | ADCName adc; |
Kojto | 104:b9ad9a133dc7 | 73 | uint8_t adc_pin; |
Kojto | 104:b9ad9a133dc7 | 74 | }; |
Kojto | 104:b9ad9a133dc7 | 75 | |
Kojto | 104:b9ad9a133dc7 | 76 | struct gpio_irq_s { |
Kojto | 104:b9ad9a133dc7 | 77 | uint32_t ch; |
Kojto | 104:b9ad9a133dc7 | 78 | }; |
Kojto | 104:b9ad9a133dc7 | 79 | |
Kojto | 104:b9ad9a133dc7 | 80 | #include "gpio_object.h" |
Kojto | 104:b9ad9a133dc7 | 81 | |
Kojto | 104:b9ad9a133dc7 | 82 | #ifdef __cplusplus |
Kojto | 104:b9ad9a133dc7 | 83 | } |
Kojto | 104:b9ad9a133dc7 | 84 | #endif |
Kojto | 104:b9ad9a133dc7 | 85 | |
Kojto | 104:b9ad9a133dc7 | 86 | #endif |