Created
November 11, 2013 22:11
-
-
Save oyvindrobertsen/7421391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.thumb | |
.syntax unified | |
.include "gpio_constants.s" // Register-adresser og konstanter for GPIO | |
.text | |
.global Start | |
.global GPIO_ODD_IRQHandler | |
Start: | |
.thumb_func | |
GPIO_ODD_IRQHandler: | |
// Do the actual toggling | |
LDR R0, =GPIO_BASE | |
MOV R1, PORT_SIZE | |
MOV R2, PORT_E | |
MOV R3, GPIO_PORT_DOUTTGL | |
MUL R1, R1, R2 | |
ADD R1, R1, R3 | |
ADD R0, R0, R1 // R1 is hex amount of bytes to offset GPIO_BASE with, PORT_SIZE*PORT + REG | |
MOV R1, #0b00000100 // pins 0-7 from right to left | |
STR R1, [R0] | |
// Clear interrupt flag | |
LDR R0, =GPIO_BASE | |
LDR R1, =GPIO_IF | |
ADD R0, R0, R1 | |
LDR R1, [R0] | |
LDR R0, =GPIO_BASE | |
LDR R2, =GPIO_IFC | |
ADD R0, R0, R2 | |
STR R1, [R0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment