1 /* mbed Microcontroller Library
2  * Copyright (c) 2006-2013 ARM Limited
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 #include "rtl8721d.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 typedef struct gpio_irq_s {
30 	PinName pin;
31 } gpio_irq_t;
32 
33 typedef struct gpio_s {
34 	PinName pin;
35 } gpio_t;
36 
37 struct port_s {
38 	PortName port;
39 	uint32_t mask;
40 };
41 
42 struct serial_s {
43 	uint8_t uart_idx;
44 	uint32_t tx_len;
45 	uint32_t rx_len;
46 };
47 
48 struct spi_s {
49 	/* user variables */
50 	uint32_t spi_idx;
51 
52 	/* internal variables */
53 	uint32_t irq_handler;
54 	uint32_t irq_id;
55 	uint32_t	state;
56 	uint8_t	sclk;
57 	uint32_t bus_tx_done_handler;
58 	uint32_t bus_tx_done_irq_id;
59 };
60 
61 struct pwmout_s {
62 	uint8_t pwm_idx;
63 	uint32_t period;//in us
64 	float pulse;//in us
65 };
66 
67 struct i2c_s {
68 	uint32_t i2c_idx;
69 	I2C_TypeDef * I2Cx;
70 };
71 
72 struct flash_s {
73 	FLASH_InitTypeDef SpicInitPara;
74 };
75 
76 struct analogin_s {
77 	uint8_t	adc_idx;
78 };
79 
80 struct gtimer_s {
81 	void *handler;
82 	uint32_t hid;
83 	uint8_t timer_id;
84 	uint8_t is_periodcal;
85 };
86 
87 struct i2s_s {
88 	uint8_t i2s_idx;
89 	uint8_t sampling_rate;
90 	uint8_t channel_num;
91 	uint8_t word_length;
92 	uint8_t direction;
93 };
94 
95 struct gdma_s {
96 	u8 index;
97 	u8 ch_num;
98 	IRQ_FUN user_cb;
99 	u32 user_cb_data;
100 };
101 
102 struct captouch_s {
103 	CapTouch_CHInitTypeDef CT_Channel[4];
104 	void* irq_handler_press;
105 	void* irq_handler_release;
106 };
107 
108 struct keyscan_s {
109 	u32 row;
110 	u32 col;
111 	u32 clk;
112 	u32 workmode;	//0 for regular scan mode, 1 for event trigger mode
113 	u32 keylimit;
114 	u32 overctrl;	//0 for discard new, 1 for discard oldest
115 };
116 
117 struct lcdc_s{
118 	u32 lcdc_type;
119 	union{
120 		LCDC_MCUInitTypeDef LCDC_MCUInitStruct;
121 		LCDC_RGBInitTypeDef LCDC_RGBInitStruct;
122 		LCDC_LEDInitTypeDef LCDC_LEDInitStruct;
123 	}lcdc_if;
124 };
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif
131