Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. call DelayFrame ; raise CS
  2.  
  3. ld a, LIS3DH_REG_WHOAMI
  4. ld b, a
  5. call ReadRegister
  6. ld a, c
  7. ldh [hWhoAmI], a
  8.  
  9. call DelayFrame ; raise CS
  10.  
  11. ; based on application note section 6.3.2-3
  12. ld a, LIS3DH_REG_CTRL1
  13. ld b, a
  14. ld a, $77 ; CTRL1: enable all axes, 400HZ
  15. ld c, a
  16. call WriteRegister
  17. ld a, $0F ; CTRL2: high-pass filter on everything
  18. call SPITransfer
  19. ld a, $00 ; CTRL3: not used
  20. call SPITransfer
  21. ld a, $88 ; CTRL4: BDU, high resolution, 2g
  22. call SPITransfer
  23. ld a, $08 ; CTRL5: latch interrupt on INT1_SRC
  24. call SPITransfer
  25.  
  26. call DelayFrame ; raise CS
  27.  
  28. ld a, LIS3DH_REG_INT1CFG
  29. ld b, a
  30. ld a, %00101010 ; int1 config: enable high int on all axes
  31. ld c, a
  32. call WriteRegister
  33. ld a, 0 ; src
  34. call SPITransfer
  35. ld a, 4 ; threshold
  36. call SPITransfer
  37. ld a, 0 ; minimum duration
  38. call SPITransfer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement