nbus_cmd.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /**
  2. ******************************************************************************
  3. * @file nbus_cmd.h
  4. * @author Juraj Dudak
  5. * @version v.1
  6. * @date 27-October-2023
  7. * @brief Deklaracie kodov funckií protokolu nBUS.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. *
  12. ******************************************************************************
  13. */
  14. #ifndef NBUS_CMD_H
  15. #define NBUS_CMD_H
  16. #define CMD_ECHO 0x01
  17. #define CMD_STOP 0x02
  18. #define CMD_START 0x03
  19. #define CMD_PARAM 0x04
  20. #define CMD_SENSOR_CNT 0x05
  21. #define CMD_SLEEP 0x06
  22. #define CMD_WAKEUP 0x07
  23. #define CMD_CALIBRATE 0x08
  24. #define CMD_RESET 0x09
  25. #define CMD_STORE 0x0A
  26. #define CMD_DATA 0x0B
  27. #define CMD_SYNC 0x0C
  28. #define CMD_SENSOR_TYPE 0x0D
  29. #define CMD_INFO 0x0E
  30. // Command parameters
  31. #define INFO_MODULE_NAME 0xE1
  32. #define INFO_MODULE_TYPE 0xE2
  33. #define INFO_MODULE_UUID 0xE3
  34. #define INFO_MODULE_HW 0xE4
  35. #define INFO_MODULE_FW 0xE5 // ?
  36. #define PARAM_SENSOR_SAMPLERATE 0x41
  37. #define PARAM_SENSOR_LPF 0x42
  38. #define PARAM_SENSOR_FULL_SCALE 0x43
  39. #define PARAM_SENSOR_GAIN 0x44
  40. #define OK_CODE (0x00)
  41. #define ILLEGAL_FUNCTION (0x01)
  42. #define ILLEGAL_DEVICE_ADDRESS (0x02) // ?
  43. #define ILLEGAL_DATA_VALUE (0x03)
  44. #define SLAVE_DEVICE_FAILURE (0x04)
  45. #define ACKNOWLEDGE (0x05)
  46. #define DEVICE_BUSY (0x06)
  47. #define PARAM_NOT_IMPLEMENTED (0x10)
  48. /**
  49. * Chyba pri vykonaní príkazu v subslave, napr. ak senzor nie je pripojený.
  50. * Scope: subslave
  51. */
  52. #define GENERIC_SUBSLAVE_ERROR (0x13)
  53. /**
  54. * Chyba pri inicializácii. Je potrebné resetnúť senzor.
  55. * Scope: subslave
  56. */
  57. #define ERR_SUBSLAVE_INIT_FAIL (0x14)
  58. /**
  59. * Vlastná chyba subslave.
  60. * Scope: subslave
  61. */
  62. #define SUBSLAVE_CUSTOM_ERR_1 (0x1A)
  63. /**
  64. * Vlastná chyba subslave.
  65. * Scope: subslave
  66. */
  67. #define SUBSLAVE_CUSTOM_ERR_2 (0x1B)
  68. /**
  69. * Vlastná chyba subslave.
  70. * Scope: subslave
  71. */
  72. #define SUBSLAVE_CUSTOM_ERR_3 (0x1C)
  73. /**
  74. * Vlastná chyba subslave.
  75. * Scope: subslave
  76. */
  77. #define SUBSLAVE_CUSTOM_ERR_4 (0x1D)
  78. /**
  79. * Vlastná chyba subslave.
  80. * Scope: subslave
  81. */
  82. #define SUBSLAVE_CUSTOM_ERR_5 (0x1E)
  83. /**
  84. * Vlastná chyba subslave.
  85. * Scope: subslave
  86. */
  87. #define SUBSLAVE_CUSTOM_ERR_6 (0x1F)
  88. /**
  89. * Chyba pri načítaní údajov - zariadenie je výstupné.
  90. * Scope: uBus
  91. */
  92. #define ERR_OUTPUT_ONLY (0x21)
  93. /**
  94. * Chyba pri nastavení údajov - zariadenie je vstupné.
  95. * Scope: uBus
  96. */
  97. #define ERR_INPUT_ONLY (0x22)
  98. #endif