1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
/**
* \file
*
* \brief SAM GPIO Driver for SAMB11
*
* Copyright (C) 2015-2016 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#include <gpio.h>
/**
* \internal
* Internal driver device instance struct.
*/
struct gpio_module _gpio_instances[3];
static void (*aon_handle_ext_wakeup_isr)(void) = (void (*)(void))0x1bc51;
/**
* \brief Initializes a gpio pin/group configuration structure to defaults.
*
* Initializes a given gpio pin/group configuration structure to a set of
* known default values. This function should be called on all new
* instances of these configuration structures before being modified by the
* user application.
*
* The default configuration is as follows:
* \li Input mode with internal pullup enabled
*
* \param[out] config Configuration structure to initialize to default values.
*/
void gpio_get_config_defaults(struct gpio_config *const config)
{
/* Default configuration values */
config->direction = GPIO_PIN_DIR_INPUT;
config->input_pull = GPIO_PIN_PULL_UP;
config->powersave = false;
config->aon_wakeup = false;
}
/**
* \brief Writes a gpio pin configuration to the hardware module.
*
* Writes out a given configuration of a gpio pin configuration to the hardware
* module. If the configuration is NULL then it releases the gpio pin.
*
* \note If the pin direction is set as an output, the pull-up/pull-down input
* configuration setting is ignored. Also certain gpio pin is used by
* FW and not available for user application. Please \ref gpio_pin
* for list of gpio_pin available.
*
* \param[in] gpio_pin Index of the GPIO pin to configure.
* \param[in] config Configuration settings for the pin.
*
* \return Status of initialization.
* \retval STATUS_OK gpio configured correctly
* \retval STATUS_ERR_INVALID_ARG Invalid gpio number, Certain gpios
* are used by FW and not allowed to change.
* \retval STATUS_RESOURCE_NOT_AVAILABLE Requested gpio is already in use.
*
*/
enum status_code gpio_pin_set_config(const uint8_t gpio_pin,
const struct gpio_config *config)
{
enum status_code status = STATUS_OK;
/* Following GPIO's should never be modified by user.
* GPIO_0 & GPIO_1 are used for SWD.
*/
if ((gpio_pin == PIN_LP_GPIO_0) || \
(gpio_pin == PIN_LP_GPIO_1))
{
status = STATUS_ERR_INVALID_ARG;
} else {
if (gpio_pin <= 7) {
LPMCU_MISC_REGS0->PINMUX_SEL_0.reg &= ~(7 << ((gpio_pin % 8) * 4));
} else if (gpio_pin <= 15) {
LPMCU_MISC_REGS0->PINMUX_SEL_1.reg &= ~(7 << ((gpio_pin % 8) * 4));
} else if (gpio_pin <= 23) {
LPMCU_MISC_REGS0->PINMUX_SEL_2.reg &= ~(7 << ((gpio_pin % 8) * 4));
} else if (44 <= gpio_pin && gpio_pin < 48) {
/* Set GPIO_MSx as digital mode */
AON_GP_REGS0->MS_GPIO_MODE.vec.ANALOG_ENABLE_ &= ~(1 << (gpio_pin - PIN_GPIO_MS4));
}
if ((gpio_pin == PIN_AO_GPIO_0) || (gpio_pin == PIN_AO_GPIO_1) ||
(gpio_pin == PIN_AO_GPIO_2)) {
/* Active Low, Always On Pull Enable Control */
if (config->input_pull == GPIO_PIN_PULL_UP) {
AON_GP_REGS0->AON_PULL_ENABLE.reg &= ~(1 << (31 - gpio_pin));
} else {
AON_GP_REGS0->AON_PULL_ENABLE.reg |= 1 << (31 - gpio_pin);
}
if (config->aon_wakeup) {
/* Enable AON_GPIO_x to be a wakeup MCU from sleep mode */
AON_GP_REGS0->AON_PINMUX_SEL.reg |= 1 << (4 * (31 - gpio_pin));
/* Enable AON_GPIO_x to wake up the BLE domain from sleep mode */
AON_PWR_SEQ0->GPIO_WAKEUP_CTRL.bit.BLE_ENABLE = 1;
}
} else {
if(config->direction == GPIO_PIN_DIR_INPUT) {
if(gpio_pin < 16) {
GPIO0->OUTENCLR.reg = (1 << gpio_pin);
} else if (gpio_pin < 32){
GPIO1->OUTENCLR.reg = (1 << (gpio_pin % 16));
} else {
GPIO2->OUTENCLR.reg = (1 << (gpio_pin % 16));
}
/* pull_enable. */
if (gpio_pin < 32) {
switch(config->input_pull) {
case GPIO_PIN_PULL_NONE:
LPMCU_MISC_REGS0->PULL_ENABLE.reg |= (1 << gpio_pin);
break;
case GPIO_PIN_PULL_UP:
LPMCU_MISC_REGS0->PULL_ENABLE.reg &= ~(1 << gpio_pin);
break;
case GPIO_PIN_PULL_DOWN:
/* Set R-Type */
LPMCU_MISC_REGS0->RTYPE_PAD_0.reg |= (1 << gpio_pin);
/* Set REN */
LPMCU_MISC_REGS0->PULL_ENABLE.reg &= ~(1 << gpio_pin);
break;
default:
status = STATUS_ERR_INVALID_ARG;
break;
}
}
} else if(config->direction == GPIO_PIN_DIR_OUTPUT) {
if (gpio_pin < 16) {
GPIO0->OUTENSET.reg = (1 << gpio_pin);
} else if (gpio_pin < 32) {
GPIO1->OUTENSET.reg = (1 << (gpio_pin % 16));
} else {
GPIO2->OUTENSET.reg = (1 << (gpio_pin % 16));
}
}
}
}
return status;
}
/**
* \brief Retrieves the state of a gpio pin that is configured as an input.
*
* Reads the current logic level of a gpio pin and returns the current
* level as a boolean value.
*
* \param[in] gpio_pin Index of the GPIO pin to read.
*
* \return Status of the gpio pin's input buffer.
*/
bool gpio_pin_get_input_level(const uint8_t gpio_pin)
{
uint32_t regval = 0;
if (gpio_pin < 16) {
regval = GPIO0->DATA.reg;
regval &= (1 << gpio_pin);
} else if (gpio_pin < 32) {
regval = GPIO1->DATA.reg;
regval &= (1 << (gpio_pin % 16));
} else {
regval = GPIO2->DATA.reg;
regval &= (1 << (gpio_pin % 16));
}
return regval;
}
/**
* \brief Retrieves the state of a gpio pin that is configured as an output.
*
* Reads the current logical output level of a gpio pin and returns the current
* level as a boolean value.
*
* \param[in] gpio_pin Index of the GPIO pin to read.
*
* \return Status of the gpio pin's output buffer.
*/
bool gpio_pin_get_output_level(const uint8_t gpio_pin)
{
uint32_t regval = 0;
if (gpio_pin < 16) {
regval = GPIO0->DATAOUT.reg;
regval &= (1 << gpio_pin);
} else if (gpio_pin < 32) {
regval = GPIO1->DATAOUT.reg;
regval &= (1 << (gpio_pin % 16));
} else {
regval = GPIO2->DATAOUT.reg;
regval &= (1 << (gpio_pin % 16));
}
return regval;
}
/**
* \brief Sets the state of a gpio pin that is configured as an output.
*
* Sets the current output level of a gpio pin to a given logic level.
*
* \param[in] gpio_pin Index of the GPIO pin to write to.
* \param[in] level Logical level to set the given pin to.
*/
void gpio_pin_set_output_level(const uint8_t gpio_pin, const bool level)
{
if (gpio_pin < 16) {
if(level) {
GPIO0->DATAOUT.reg |= (1 << gpio_pin);
} else {
GPIO0->DATAOUT.reg &= ~(1 << gpio_pin);
}
} else if (gpio_pin < 32) {
if(level) {
GPIO1->DATAOUT.reg |= (1 << (gpio_pin % 16));
} else {
GPIO1->DATAOUT.reg &= ~(1 << (gpio_pin % 16));
}
} else {
if(level) {
GPIO2->DATAOUT.reg |= (1 << (gpio_pin % 16));
} else {
GPIO2->DATAOUT.reg &= ~(1 << (gpio_pin % 16));
}
}
}
/**
* \brief Toggles the state of a gpio pin that is configured as an output.
*
* Toggles the current output level of a gpio pin.
*
* \param[in] gpio_pin Index of the GPIO pin to toggle.
*/
void gpio_pin_toggle_output_level(const uint8_t gpio_pin)
{
if (gpio_pin < 16) {
GPIO0->DATAOUT.reg ^= (1 << gpio_pin);
} else if (gpio_pin < 32) {
GPIO1->DATAOUT.reg ^= (1 << (gpio_pin % 16));
} else {
GPIO2->DATAOUT.reg ^= (1 << (gpio_pin % 16));
}
}
/**
* \brief Writes a GPIO pin configuration to the hardware module.
*
* Writes out a given configuration of a GPIO pin configuration to the hardware
* module.
*
* \param[in] gpio_pin Index of the GPIO pin to toggle.
* \param[in] pinmux_sel PINMUX selection.
*/
void gpio_pinmux_cofiguration(const uint8_t gpio_pin, uint16_t pinmux_sel)
{
uint8_t megamux_sel = (pinmux_sel >> 8) & 0xFF;
pinmux_sel &= 0xFF;
if (gpio_pin <= 7) {
LPMCU_MISC_REGS0->PINMUX_SEL_0.reg &= ~(7 << ((gpio_pin % 8) * 4));
LPMCU_MISC_REGS0->PINMUX_SEL_0.reg |= (pinmux_sel << ((gpio_pin % 8)*4));
if (pinmux_sel == 0x01) {
if (gpio_pin <= 3) {
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_0.reg &= ~(0x3F << ((gpio_pin % 4) * 8));
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_0.reg |= (megamux_sel << ((gpio_pin % 4) * 8));
} else if (gpio_pin <= 7) {
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_1.reg &= ~(0x3F << ((gpio_pin % 4) * 8));
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_1.reg |= (megamux_sel << ((gpio_pin % 4) * 8));
}
}
} else if (gpio_pin <= 15) {
LPMCU_MISC_REGS0->PINMUX_SEL_1.reg &= ~(7 << ((gpio_pin % 8) * 4));
LPMCU_MISC_REGS0->PINMUX_SEL_1.reg |= (pinmux_sel << ((gpio_pin % 8)*4));
if (pinmux_sel == 0x01) {
if (gpio_pin <= 11) {
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_2.reg &= ~(0x3F << ((gpio_pin % 4) * 8));
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_2.reg |= (megamux_sel << ((gpio_pin % 4) * 8));
} else if (gpio_pin <= 15) {
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_3.reg &= ~(0x3F << ((gpio_pin % 4) * 8));
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_3.reg |= (megamux_sel << ((gpio_pin % 4) * 8));
}
}
} else if (gpio_pin <= 23) {
LPMCU_MISC_REGS0->PINMUX_SEL_2.reg &= ~(7 << ((gpio_pin % 8) * 4));
LPMCU_MISC_REGS0->PINMUX_SEL_2.reg |= (pinmux_sel << ((gpio_pin % 8)*4));
if (pinmux_sel == 0x01) {
if (gpio_pin <= 19) {
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_4.reg &= ~(0x3F << ((gpio_pin % 4) * 8));
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_4.reg |= (megamux_sel << ((gpio_pin % 4) * 8));
} else if (gpio_pin <= 23) {
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_5.reg &= ~(0x3F << ((gpio_pin % 4) * 8));
LPMCU_MISC_REGS0->MEGA_MUX_IO_SEL_5.reg |= (megamux_sel << ((gpio_pin % 4) * 8));
}
}
}
}
/**
* \brief Registers a callback
*
* Registers a callback function which is implemented by the user.
*
* \note The callback must be enabled by \ref gpio_enable_callback,
* in order for the interrupt handler to call it when the conditions for
* the callback type are met.
*
* \param[in] gpio_pin GPIO pin number
* \param[in] callback_func Pointer to callback function
* \param[in] callback_type Callback type given by an enum
*
*/
void gpio_register_callback(uint8_t gpio_pin, gpio_callback_t callback_func,
enum gpio_callback callback_type)
{
/* Sanity check arguments */
Assert(callback_func);
Assert(gpio_pin < 48);
uint8_t gpio_port = 0;
if (gpio_pin < 16) {
gpio_port = 0;
} else if (gpio_pin < 32) {
gpio_port = 1;
} else {
gpio_port = 2;
}
switch (callback_type) {
case GPIO_CALLBACK_LOW:
_gpio_instances[gpio_port].hw->INTTYPECLR.reg = 1 << (gpio_pin % 16);
_gpio_instances[gpio_port].hw->INTPOLCLR.reg = 1 << (gpio_pin % 16);
break;
case GPIO_CALLBACK_HIGH:
_gpio_instances[gpio_port].hw->INTTYPECLR.reg = 1 << (gpio_pin % 16);
_gpio_instances[gpio_port].hw->INTPOLSET.reg = 1 << (gpio_pin % 16);
break;
case GPIO_CALLBACK_RISING:
_gpio_instances[gpio_port].hw->INTTYPESET.reg = 1 << (gpio_pin % 16);
_gpio_instances[gpio_port].hw->INTPOLSET.reg = 1 << (gpio_pin % 16);
break;
case GPIO_CALLBACK_FALLING:
_gpio_instances[gpio_port].hw->INTTYPESET.reg = 1 << (gpio_pin % 16);
_gpio_instances[gpio_port].hw->INTPOLCLR.reg = (1 << (gpio_pin % 16));
break;
case GPIO_CALLBACK_N:
break;
}
/* Register callback function */
_gpio_instances[gpio_port].callback[gpio_pin % 16] = callback_func;
/* Set the bit corresponding to the gpio pin */
_gpio_instances[gpio_port].callback_reg_mask |= (1 << (gpio_pin % 16));
}
/**
* \brief Unregisters a callback
*
* Unregisters a callback function which is implemented by the user.
*
*
* \param[in] gpio_pin GPIO pin number
* \param[in] callback_type Callback type given by an enum
*
*/
void gpio_unregister_callback(uint8_t gpio_pin,
enum gpio_callback callback_type)
{
/* Sanity check arguments */
Assert(callback_func);
Assert(gpio_pin < 48);
uint8_t gpio_port = 0;
if (gpio_pin < 16) {
gpio_port = 0;
} else if (gpio_pin < 32) {
gpio_port = 1;
} else {
gpio_port = 2;
}
/* Unregister callback function */
_gpio_instances[gpio_port].callback[gpio_pin % 16] = NULL;
/* Set the bit corresponding to the gpio pin */
_gpio_instances[gpio_port].callback_reg_mask &= ~(1 << (gpio_pin % 16));
}
/**
* \brief Enables callback
*
* Enables the callback function registered by the \ref gpio_register_callback.
* The callback function will be called from the interrupt handler when the
* conditions for the callback type are met.
*
* \param[in] gpio_pin GPIO pin
*/
void gpio_enable_callback(uint8_t gpio_pin)
{
Assert(gpio_pin < 48);
uint8_t gpio_port = 0;
if (gpio_pin < 16) {
gpio_port = 0;
NVIC_EnableIRQ(GPIO0_IRQn);
} else if (gpio_pin < 32) {
gpio_port = 1;
NVIC_EnableIRQ(GPIO1_IRQn);
} else {
gpio_port = 2;
NVIC_EnableIRQ(GPIO2_IRQn);
}
/* Enable callback */
_gpio_instances[gpio_port].callback_enable_mask |= (1 << (gpio_pin % 16));
_gpio_instances[gpio_port].hw->INTENSET.reg = (1 << (gpio_pin % 16));
}
/**
* \brief Disables callback
*
* Disables the callback function registered by the \ref usart_register_callback.
* The callback function will not be called from the interrupt handler.
*
* \param[in] gpio_pin GPIO pin
*/
void gpio_disable_callback(uint8_t gpio_pin)
{
Assert(gpio_pin < 48);
uint8_t gpio_port = 0;
if (gpio_pin < 16) {
gpio_port = 0;
} else if (gpio_pin < 32) {
gpio_port = 1;
} else {
gpio_port = 2;
}
/* Enable callback */
_gpio_instances[gpio_port].callback_enable_mask &= ~(1 << (gpio_pin % 16));
_gpio_instances[gpio_port].hw->INTENCLR.reg = (1 << (gpio_pin % 16));
}
/**
* \internal GPIO port0 isr handler.
*
* This function will enter interrupt.
*
*/
static void gpio_port0_isr_handler(void)
{
uint32_t flag = _gpio_instances[0].hw->INTSTATUSCLEAR.reg;
for (uint8_t i = 0; i < 16; i++){
if (flag & (1 << i)) {
/* Clear interrupt flag */
_gpio_instances[0].hw->INTSTATUSCLEAR.reg = (1 << i);
if ((_gpio_instances[0].callback_enable_mask & (1 << i)) && \
(_gpio_instances[0].callback_reg_mask & (1 << i)))
_gpio_instances[0].callback[i]();
break;
}
}
NVIC_ClearPendingIRQ(GPIO0_IRQn);
}
/**
* \internal GPIO port1 isr handler.
*
* This function will enter interrupt.
*
*/
static void gpio_port1_isr_handler(void)
{
uint32_t flag = _gpio_instances[1].hw->INTSTATUSCLEAR.reg;
for (uint8_t i = 0; i < 16; i++){
/* For AON wakeup pin clear interrupt */
if (flag & ((1<<15) | (1<<14) | (1<<13))) {
aon_handle_ext_wakeup_isr();
}
if (flag & (1 << i)) {
/* Clear interrupt flag */
_gpio_instances[1].hw->INTSTATUSCLEAR.reg = (1 << i);
if ((_gpio_instances[1].callback_enable_mask & (1 << i)) && \
(_gpio_instances[1].callback_reg_mask & (1 << i))) {
_gpio_instances[1].callback[i]();
break;
}
}
}
NVIC_ClearPendingIRQ(GPIO1_IRQn);
}
/**
* \internal GPIO port2 isr handler.
*
* This function will enter interrupt.
*
*/
static void gpio_port2_isr_handler(void)
{
uint32_t flag = _gpio_instances[2].hw->INTSTATUSCLEAR.reg;
for (uint8_t i = 12; i < 16; i++){
if (flag & (1 << i)) {
/* Clear interrupt flag */
_gpio_instances[2].hw->INTSTATUSCLEAR.reg = (1 << i);
if ((_gpio_instances[2].callback_enable_mask & (1 << i)) && \
(_gpio_instances[2].callback_reg_mask & (1 << i)))
_gpio_instances[2].callback[i]();
break;
}
}
NVIC_ClearPendingIRQ(GPIO2_IRQn);
}
/**
* \internal GPIO callback init.
*
* This function will init GPIO callback.
*
*/
void gpio_init(void)
{
uint8_t i, j;
for(i = 0; i < 3; i++) {
for(j = 0; j < 16; j++) {
_gpio_instances[i].callback[j] = NULL;
}
_gpio_instances[i].callback_enable_mask = 0;
_gpio_instances[i].callback_reg_mask = 0;
}
_gpio_instances[0].hw = (void *)GPIO0;
_gpio_instances[1].hw = (void *)GPIO1;
_gpio_instances[2].hw = (void *)GPIO2;
system_register_isr(RAM_ISR_TABLE_PORT0_COMB_INDEX, (uint32_t)gpio_port0_isr_handler);
system_register_isr(RAM_ISR_TABLE_PORT1_COMB_INDEX, (uint32_t)gpio_port1_isr_handler);
system_register_isr(RAM_ISR_TABLE_PORT2_COMB_INDEX, (uint32_t)gpio_port2_isr_handler);
}
|