]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/objects.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / hal / TARGET_NORDIC / TARGET_MCU_NRF51822 / objects.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2013 Nordic Semiconductor
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef MBED_OBJECTS_H
17 #define MBED_OBJECTS_H
18
19 #include "cmsis.h"
20 #include "PortNames.h"
21 #include "PeripheralNames.h"
22 #include "PinNames.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define I2C_SPI_PERIPHERAL_FOR_I2C      1
29 #define I2C_SPI_PERIPHERAL_FOR_SPI      2
30
31 typedef struct {
32     uint8_t usage;   // I2C: 1, SPI: 2
33     uint8_t sda_mosi;
34     uint8_t scl_miso;
35     uint8_t sclk;
36 } i2c_spi_peripheral_t;
37
38 struct serial_s {
39     NRF_UART_Type *uart;
40     int index;
41 };
42
43 struct spi_s {
44     NRF_SPI_Type *spi;
45     NRF_SPIS_Type *spis;
46     uint8_t peripheral;
47 };
48
49 struct port_s {
50     __IO uint32_t *reg_cnf;
51     __IO uint32_t *reg_out;
52     __I  uint32_t *reg_in;
53     PortName port;
54     uint32_t mask;
55 };
56
57 struct pwmout_s {
58     PWMName pwm;
59     PinName pin;
60 };
61
62 struct i2c_s {
63     NRF_TWI_Type *i2c;
64     PinName sda;
65     PinName scl;
66     int freq;
67     uint8_t address_set;
68     uint8_t peripheral;
69 };
70
71 struct analogin_s {
72     ADCName adc;
73     uint8_t adc_pin;
74 };
75
76 struct gpio_irq_s {
77     uint32_t ch;
78 };
79
80 #include "gpio_object.h"
81
82 #ifdef __cplusplus
83 }
84 #endif
85
86 #endif