Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Arduino Core for SAMD21 CPU
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
josc941e
Arduino Core for SAMD21 CPU
Commits
d654db22
Commit
d654db22
authored
9 years ago
by
Cristian Maglie
Browse files
Options
Downloads
Patches
Plain Diff
Cosmetic changes in WInterrupt.*
parent
e2584897
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cores/arduino/WInterrupts.c
+14
-25
14 additions, 25 deletions
cores/arduino/WInterrupts.c
cores/arduino/WInterrupts.h
+5
-30
5 additions, 30 deletions
cores/arduino/WInterrupts.h
cores/arduino/WVariant.h
+18
-18
18 additions, 18 deletions
cores/arduino/WVariant.h
with
37 additions
and
73 deletions
cores/arduino/WInterrupts.c
+
14
−
25
View file @
d654db22
...
...
@@ -32,32 +32,23 @@ static void __initialize()
{
memset
(
callbacksInt
,
0
,
sizeof
(
callbacksInt
));
NVIC_DisableIRQ
(
EIC_IRQn
)
;
NVIC_ClearPendingIRQ
(
EIC_IRQn
)
;
NVIC_SetPriority
(
EIC_IRQn
,
0
)
;
NVIC_EnableIRQ
(
EIC_IRQn
)
;
NVIC_DisableIRQ
(
EIC_IRQn
)
;
NVIC_ClearPendingIRQ
(
EIC_IRQn
)
;
NVIC_SetPriority
(
EIC_IRQn
,
0
)
;
NVIC_EnableIRQ
(
EIC_IRQn
)
;
// Enable GCLK for IEC (External Interrupt Controller)
GCLK
->
CLKCTRL
.
reg
=
(
uint16_t
)
(
GCLK_CLKCTRL_CLKEN
|
GCLK_CLKCTRL_GEN_GCLK0
|
GCLK_CLKCTRL_ID
(
GCM_EIC
))
;
GCLK
->
CLKCTRL
.
reg
=
(
uint16_t
)
(
GCLK_CLKCTRL_CLKEN
|
GCLK_CLKCTRL_GEN_GCLK0
|
GCLK_CLKCTRL_ID
(
GCM_EIC
));
/* Shall we do that?
// Do a software reset on EIC
EIC->CTRL.SWRST.bit = 1 ;
while ( (EIC->CTRL.SWRST.bit == 1) && (EIC->STATUS.SYNCBUSY.bit == 1) )
{
// Waiting for synchronisation
}
while ((EIC->CTRL.SWRST.bit == 1) && (EIC->STATUS.SYNCBUSY.bit == 1)) { }
*/
// Enable EIC
EIC
->
CTRL
.
bit
.
ENABLE
=
1
;
while
(
EIC
->
STATUS
.
bit
.
SYNCBUSY
==
1
)
{
// Waiting for synchronisation
}
EIC
->
CTRL
.
bit
.
ENABLE
=
1
;
while
(
EIC
->
STATUS
.
bit
.
SYNCBUSY
==
1
)
{
}
}
/*
...
...
@@ -138,22 +129,20 @@ void detachInterrupt(uint32_t pin)
/*
* External Interrupt Controller NVIC Interrupt Handler
*/
void
EIC_Handler
(
void
)
void
EIC_Handler
(
void
)
{
uint32_t
ul
;
// Test the 16 normal interrupts
for
(
ul
=
EXTERNAL_INT_0
;
ul
<=
EXTERNAL_INT_15
;
ul
++
)
for
(
uint32_t
i
=
EXTERNAL_INT_0
;
i
<=
EXTERNAL_INT_15
;
i
++
)
{
if
(
(
EIC
->
INTFLAG
.
reg
&
(
1
<<
ul
)
)
!=
0
)
if
((
EIC
->
INTFLAG
.
reg
&
(
1
<<
i
)
)
!=
0
)
{
// Call the callback function if assigned
if
(
callbacksInt
[
ul
])
{
callbacksInt
[
ul
]();
if
(
callbacksInt
[
i
])
{
callbacksInt
[
i
]();
}
// Clear the interrupt
EIC
->
INTFLAG
.
reg
=
1
<<
ul
;
EIC
->
INTFLAG
.
reg
=
1
<<
i
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
cores/arduino/WInterrupts.h
+
5
−
30
View file @
d654db22
/*
Copyright (c) 201
4
Arduino. All right reserved.
Copyright (c) 201
5
Arduino
LLC
. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -31,49 +31,24 @@ extern "C" {
#define FALLING 3
#define RISING 4
///*
//* Interrupt modes
//* The two first values are conflicting with the ones used by Digital API, so we use another name for each.
//*/
//typedef enum _EExt_IntMode
//{
//IM_LOW = 0,
//IM_HIGH = 1,
//CHANGE = 2,
//FALLING = 3,
//RISING = 4,
//IM_CHANGE = 2,
//IM_FALLING = 3,
//IM_RISING = 4,
//} EExt_IntMode ;
#define DEFAULT 1
#define EXTERNAL 0
typedef
void
(
*
voidFuncPtr
)(
void
)
;
typedef
void
(
*
voidFuncPtr
)(
void
)
;
/*
* \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs.
* Replaces any previous function that was attached to the interrupt.
*/
//void attachInterrupt( uint32_t ulPin, void (*callback)(void), EExt_IntMode mode ) ;
//void attachInterrupt( uint32_t ulPin, voidFuncPtr callback, EExt_IntMode mode ) ;
void
attachInterrupt
(
uint32_t
ulPin
,
voidFuncPtr
callback
,
uint32_t
mode
)
;
void
attachInterrupt
(
uint32_t
pin
,
voidFuncPtr
callback
,
uint32_t
mode
);
/*
* \brief Turns off the given interrupt.
*/
void
detachInterrupt
(
uint32_t
ulPin
)
;
void
detachInterrupt
(
uint32_t
pin
)
;
#ifdef __cplusplus
}
#endif
//#ifdef __cplusplus
//inline operator ::EExt_IntMode( uint32_t ul )
//{
//return (EExt_IntMode)ul ;
//}
//#endif
#endif
/* _WIRING_INTERRUPTS_ */
#endif
This diff is collapsed.
Click to expand it.
cores/arduino/WVariant.h
+
18
−
18
View file @
d654db22
...
...
@@ -111,25 +111,25 @@ typedef enum _EPortType
PORTC
=
2
,
}
EPortType
;
typedef
enum
_EExt_Interrupts
typedef
enum
{
EXTERNAL_INT_0
=
0
,
// Available on pin 11
EXTERNAL_INT_1
,
// Available on pin 13
EXTERNAL_INT_2
,
// Available on pins 10, A0, A5
EXTERNAL_INT_3
,
// Available on pin 12
EXTERNAL_INT_4
,
// Available on pin 6, 8, A3
EXTERNAL_INT_5
,
// Available on pin 7, 9, A4
EXTERNAL_INT_6
,
// Available on pin 16
EXTERNAL_INT_7
,
// Available on pin 17
EXTERNAL_INT_8
,
// Available on pin A1
EXTERNAL_INT_9
,
// Available on pin 3, A2
EXTERNAL_INT_10
,
// Available on pin 0, 21
EXTERNAL_INT_11
,
// Available on pin 1, 20
EXTERNAL_INT_12
,
// Available on pin 18
EXTERNAL_INT_13
,
// Available on pin EDBG_GPIO0 (43)
EXTERNAL_INT_14
,
// Available on pin 4
EXTERNAL_INT_15
,
// Available on pin 5
EXTERNAL_INT_NMI
,
// Available on pin 2
EXTERNAL_INT_0
=
0
,
EXTERNAL_INT_1
,
EXTERNAL_INT_2
,
EXTERNAL_INT_3
,
EXTERNAL_INT_4
,
EXTERNAL_INT_5
,
EXTERNAL_INT_6
,
EXTERNAL_INT_7
,
EXTERNAL_INT_8
,
EXTERNAL_INT_9
,
EXTERNAL_INT_10
,
EXTERNAL_INT_11
,
EXTERNAL_INT_12
,
EXTERNAL_INT_13
,
EXTERNAL_INT_14
,
EXTERNAL_INT_15
,
EXTERNAL_INT_NMI
,
EXTERNAL_NUM_INTERRUPTS
,
NOT_AN_INTERRUPT
=
-
1
,
EXTERNAL_INT_NONE
=
NOT_AN_INTERRUPT
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment