tile_timer_driver.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * NOTICE
  3. *
  4. * Copyright 2020 Tile Inc. All Rights Reserved.
  5. * All code or other information included in the accompanying files ("Tile Source Material")
  6. * is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
  7. * is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
  8. * and may not be otherwise distributed or made available to others, including for commercial purposes.
  9. * Without limiting the foregoing , you understand and agree that no production use
  10. * of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
  11. * agreement with Tile.
  12. * You also understand and agree that Tile may terminate the limited rights granted under these terms
  13. * at any time in its discretion.
  14. * All Tile Source Material is provided AS-IS without warranty of any kind.
  15. * Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
  16. * Tile will not be liable for any damages resulting from your use of or inability to use
  17. * the Tile Source Material.
  18. *
  19. * Support: firmware_support@tile.com
  20. */
  21. /** @file tile_timer_driver.h
  22. ** @brief Tile Timer Driver interface. Provides TileLib an interface to use timers.
  23. */
  24. #ifndef TILE_TIMER_DRIVER_H_
  25. #define TILE_TIMER_DRIVER_H_
  26. #include <stdint.h>
  27. /**
  28. * Number of Tile ticks in one second. All Tile timer durations are
  29. * specified in Tile ticks.
  30. */
  31. #define TILE_TICKS_PER_SEC ((uint32_t)100)
  32. /**
  33. * IDs to associate with each Tile timer.
  34. */
  35. enum TILE_TIMER_IDS
  36. {
  37. TILE_CONNECTION_TIMER,
  38. TILE_AUTHENTICATION_TIMER,
  39. TILE_TDT_DOUBLETAP_TIMER,
  40. TILE_TDT_HDC_TIMER,
  41. TILE_TCU_PARAM_UPDATE_TIMER,
  42. TILE_TKA_TIMER1,
  43. TILE_TKA_TIMER2,
  44. TILE_TKA_TIMER3,
  45. TILE_TEST_TIMER1,
  46. TILE_TEST_TIMER2,
  47. TILE_TEST_TIMER3,
  48. TILE_TEST_TIMER4,
  49. TILE_TEST_TIMER5,
  50. TILE_TEST_TIMER6,
  51. TILE_TEST_TIMER7,
  52. TILE_TEST_TIMER8,
  53. TILE_TILEID_COUNTER_TIMER,
  54. TILE_MAX_TIMERS /* < Number of timers used by Tile Lib. */
  55. };
  56. struct tile_timer_driver
  57. {
  58. /**
  59. * Start a timer. duration is in 10ms increments.
  60. */
  61. int (*start)(uint8_t timer_id, uint32_t duration);
  62. /**
  63. * Cancel a timer.
  64. */
  65. int (*cancel)(uint8_t timer_id);
  66. };
  67. /**
  68. * Timer registration function.
  69. */
  70. int tile_timer_register(struct tile_timer_driver *driver);
  71. /**
  72. * Call when a Tile timer has expired.
  73. */
  74. int tile_timer_expired(uint8_t timer_id);
  75. #endif // TILE_TIMER_DRIVER_H_