Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. GPIO_PORTF_DIR_R EQU 0x40025400
  2. GPIO_PORTF_DEN_R EQU 0x4002551C
  3. GPIO_PORTF_DATA_R EQU 0x400253FC
  4. SYSCTL_RCGCGPIO_R EQU 0x400FE608
  5.  
  6. AREA |.text|, CODE, READONLY, ALIGN=2
  7. THUMB
  8. EXPORT GPIOF_INIT
  9.  
  10. GPIOF_INIT
  11. LDR R1, =SYSCTL_RCGCGPIO_R ; R1 = &SYSCTL_RCGCGPIO_R
  12. LDR R0, [R1] ; R0 = [R1]
  13. ORR R0, R0, #0x20 ; Port F
  14. STR R0, [R1] ; [R1] = R0
  15. NOP
  16. NOP ; allow time to finish activating
  17. ; set direction register
  18. LDR R1, =GPIO_PORTF_DIR_R ; R1 = &GPIO_PORTF_DIR_R
  19. LDR R0, [R1] ; R0 = [R1]
  20. ORR R0, R0, #0x04 ; R0 = R0|0x04 (make PF2 output; PF2 built-in blue LED)
  21. STR R0, [R1] ; [R1] = R0
  22.  
  23. ; enable digital port
  24. LDR R1, =GPIO_PORTF_DEN_R ; R1 = &GPIO_PORTF_DEN_R
  25. LDR R0, [R1] ; R0 = [R1]
  26. ORR R0, R0, #0x04 ; R0 = R0|0x04 (enable digital I/O on PF2)
  27. STR R0, [R1] ; [R1] = R0
  28.  
  29. BX LR
  30.  
  31. ALIGN ; make sure the end of this section is aligned
  32. END ; end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement