nbus_cmd.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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_FIND 0x00
  17. #define CMD_ECHO 0x01
  18. #define CMD_STOP 0x02
  19. #define CMD_START 0x03
  20. #define CMD_PARAM 0x04
  21. #define CMD_SENSOR_CNT 0x05
  22. #define CMD_SLEEP 0x06
  23. #define CMD_WAKEUP 0x07
  24. #define CMD_CALIBRATE 0x08
  25. #define CMD_RESET 0x09
  26. #define CMD_STORE 0x0A
  27. #define CMD_DATA 0x0B
  28. #define CMD_SYNC 0x0C
  29. #define CMD_SENSOR_TYPE 0x0D
  30. #define CMD_INFO 0x0E
  31. #define CMD_FORMAT 0x0F
  32. #define PARAM_SENSOR_SAMPLERATE 0x41
  33. #define PARAM_SENSOR_LPF 0x42
  34. #define PARAM_SENSOR_FULL_SCALE 0x43
  35. #define PARAM_SENSOR_GAIN 0x44
  36. #define OK_CODE (0x00)
  37. #define ILLEGAL_FUNCTION (0x01)
  38. #define ILLEGAL_DEVICE_ADDRESS (0x02) // ?
  39. #define ILLEGAL_DATA_VALUE (0x03)
  40. #define SLAVE_DEVICE_FAILURE (0x04)
  41. #define ACKNOWLEDGE (0x05)
  42. #define DEVICE_BUSY (0x06)
  43. #define DEVICE_NOT_READY (0x07)
  44. #define PARAM_NOT_IMPLEMENTED (0x10)
  45. #define ILLEGAL_FUNCTION_PARAM (0x11)
  46. #define DEVICE_IS_READ_ONLY (0x12)
  47. /**
  48. * Chyba pri vykonaní príkazu v subslave, napr. ak senzor nie je pripojený.
  49. * Scope: subslave
  50. */
  51. #define GENERIC_SUBSLAVE_ERROR (0x13)
  52. /**
  53. * Chyba pri inicializácii. Je potrebné resetnúť senzor.
  54. * Scope: subslave
  55. */
  56. #define ERR_SUBSLAVE_INIT_FAIL (0x14)
  57. /**
  58. * Vlastná chyba subslave.
  59. * Scope: subslave
  60. */
  61. #define SUBSLAVE_CUSTOM_ERR_1 (0x1A)
  62. /**
  63. * Vlastná chyba subslave.
  64. * Scope: subslave
  65. */
  66. #define SUBSLAVE_CUSTOM_ERR_2 (0x1B)
  67. /**
  68. * Vlastná chyba subslave.
  69. * Scope: subslave
  70. */
  71. #define SUBSLAVE_CUSTOM_ERR_3 (0x1C)
  72. /**
  73. * Vlastná chyba subslave.
  74. * Scope: subslave
  75. */
  76. #define SUBSLAVE_CUSTOM_ERR_4 (0x1D)
  77. /**
  78. * Vlastná chyba subslave.
  79. * Scope: subslave
  80. */
  81. #define SUBSLAVE_CUSTOM_ERR_5 (0x1E)
  82. /**
  83. * Vlastná chyba subslave.
  84. * Scope: subslave
  85. */
  86. #define SUBSLAVE_CUSTOM_ERR_6 (0x1F)
  87. /**
  88. * Chyba pri načítaní údajov - zariadenie je výstupné.
  89. * Scope: uBus
  90. */
  91. #define ERR_OUTPUT_ONLY (0x21)
  92. /**
  93. * Chyba pri nastavení údajov - zariadenie je vstupné.
  94. * Scope: uBus
  95. */
  96. #define ERR_INPUT_ONLY (0x22)
  97. #endif