Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Proyecto Smart Watch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Leonardo Martinez Hornak
Proyecto Smart Watch
Commits
fc91de93
Commit
fc91de93
authored
4 years ago
by
Leonardo Martinez Hornak
Browse files
Options
Downloads
Patches
Plain Diff
Button press ISR working
parent
79213e35
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
firmware/smartwatch/main.c
+4
-2
4 additions, 2 deletions
firmware/smartwatch/main.c
firmware/src/gpio.c
+41
-6
41 additions, 6 deletions
firmware/src/gpio.c
with
45 additions
and
8 deletions
firmware/smartwatch/main.c
+
4
−
2
View file @
fc91de93
...
...
@@ -5,6 +5,7 @@
/**
* main.c
*/
void
main
(
void
)
{
volatile
int
i
;
...
...
@@ -12,11 +13,12 @@ void main(void)
initializeGPIOModule
();
__enable_interrupt
();
while
(
1
)
{
turnOnAlarmLED
();
turnOffAlarmLED
();
//
turnOnAlarmLED();
//
turnOffAlarmLED();
}
}
This diff is collapsed.
Click to expand it.
firmware/src/gpio.c
+
41
−
6
View file @
fc91de93
#include
"msp.h"
#include
"gpio.h"
volatile
int
prueba
;
void
initializeGPIOModule
(
void
)
{
//Configures Port1 pins according to SLAU597F (MSP432 Launchpad User Guide)
P1DIR
=
0
b11101001
;
P1SEL1
=
0
b0000000
;
P1SEL0
=
0
b1110110
;
P1OUT
=
0
;
P1DIR
=
0xE9
;
P1SEL1
=
0
;
P1SEL0
=
0xE6
;
P2OUT
=
0
;
P2DIR
=
0xFF
;
P2SEL1
=
0
;
P2SEL0
=
0xF0
;
//Configure Interrupt for P1.4
P1IFG
=
0
;
P1IES
=
0
;
//Low to high transition for the ISR
P1IE
|=
BIT4
;
//Enable interrupt
//Enable Pull-Up for P1.4
P1OUT
|=
BIT4
;
//Enable interrupt
P1REN
|=
BIT4
;
//Enable interrupt
P2DIR
=
0
b11111111
;
P2SEL1
=
0
b00000000
;
P2SEL0
=
0
b11110000
;
NVIC_SetPriority
(
PORT1_IRQn
,
3
);
NVIC_EnableIRQ
(
PORT1_IRQn
);
// Enable PORT1 Interrupt
//TODO Configure other ports
}
...
...
@@ -56,6 +72,25 @@ void turnOffLED(int identifier)
void
setBluetoothButtonISRCallbackFunction
(
void
*
callback_function
)
{}
void
PORT1_IRQHandler
(
void
)
{
if
(
P1IFG
&
BIT4
){
if
(
prueba
==
0
)
{
turnOnLED
(
LED_BLUE
);
prueba
=
1
;
}
else
{
turnOffLED
(
LED_BLUE
);
prueba
=
0
;
}
P1IFG
&=
~
BIT4
;
}
}
...
...
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