hal_can.dox 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @defgroup CAN CAN Driver
  15. * @brief Generic CAN Driver.
  16. * @details This module implements a generic CAN (Controller Area Network)
  17. * driver allowing the exchange of information at frame level.
  18. * @pre In order to use the CAN driver the @p HAL_USE_CAN option
  19. * must be enabled in @p halconf.h.
  20. *
  21. * @section can_1 Driver State Machine
  22. * The driver implements a state machine internally, not all the driver
  23. * functionalities can be used in any moment, any transition not explicitly
  24. * shown in the following diagram has to be considered an error and shall
  25. * be captured by an assertion (if enabled).
  26. * @if LATEX_PDF
  27. * @dot
  28. digraph example {
  29. size="5, 7";
  30. rankdir="LR";
  31. node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
  32. edge [fontname=Helvetica, fontsize=8];
  33. stop [label="CAN_STOP\nLow Power"];
  34. uninit [label="CAN_UNINIT", style="bold"];
  35. starting [label="CAN_STARTING\nInitializing"];
  36. ready [label="CAN_READY\nClock Enabled"];
  37. sleep [label="CAN_SLEEP\nLow Power"];
  38. uninit -> stop [label=" canInit()", constraint=false];
  39. stop -> stop [label="\ncanStop()"];
  40. stop -> ready [label="\ncanStart()\n(fast implementation)"];
  41. stop -> starting [label="\ncanStart()\n(slow implementation)"];
  42. starting -> ready [label="\ninitialization complete\n(all threads)"];
  43. ready -> stop [label="\ncanStop()"];
  44. ready -> ready [label="\ncanReceive()\ncanTransmit()"];
  45. ready -> sleep [label="\ncanSleep()"];
  46. sleep -> sleep [label="\ncanSleep()"];
  47. sleep -> ready [label="\ncanWakeup()"];
  48. sleep -> ready [label="\nhardware\nwakeup event"];
  49. }
  50. * @enddot
  51. * @else
  52. * @dot
  53. digraph example {
  54. rankdir="LR";
  55. node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
  56. edge [fontname=Helvetica, fontsize=8];
  57. stop [label="CAN_STOP\nLow Power"];
  58. uninit [label="CAN_UNINIT", style="bold"];
  59. starting [label="CAN_STARTING\nInitializing"];
  60. ready [label="CAN_READY\nClock Enabled"];
  61. sleep [label="CAN_SLEEP\nLow Power"];
  62. uninit -> stop [label=" canInit()", constraint=false];
  63. stop -> stop [label="\ncanStop()"];
  64. stop -> ready [label="\ncanStart()\n(fast implementation)"];
  65. stop -> starting [label="\ncanStart()\n(slow implementation)"];
  66. starting -> starting [label="\ncanStart()\n(other thread)"];
  67. starting -> ready [label="\ninitialization complete\n(all threads)"];
  68. ready -> stop [label="\ncanStop()"];
  69. ready -> ready [label="\ncanStart()\ncanReceive()\ncanTransmit()"];
  70. ready -> sleep [label="\ncanSleep()"];
  71. sleep -> sleep [label="\ncanSleep()"];
  72. sleep -> ready [label="\ncanWakeup()"];
  73. sleep -> ready [label="\nhardware\nwakeup event"];
  74. }
  75. * @enddot
  76. * @endif
  77. *
  78. * @ingroup HAL_NORMAL_DRIVERS
  79. */