Naze32 clone with Frysky receiver
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

can_api.h 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* mbed Microcontroller Library
  2. * Copyright (c) 2006-2016 ARM Limited
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef MBED_CAN_API_H
  17. #define MBED_CAN_API_H
  18. #include "device.h"
  19. #if DEVICE_CAN
  20. #include "PinNames.h"
  21. #include "PeripheralNames.h"
  22. #include "can_helper.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. typedef enum {
  27. IRQ_RX,
  28. IRQ_TX,
  29. IRQ_ERROR,
  30. IRQ_OVERRUN,
  31. IRQ_WAKEUP,
  32. IRQ_PASSIVE,
  33. IRQ_ARB,
  34. IRQ_BUS,
  35. IRQ_READY
  36. } CanIrqType;
  37. typedef enum {
  38. MODE_RESET,
  39. MODE_NORMAL,
  40. MODE_SILENT,
  41. MODE_TEST_LOCAL,
  42. MODE_TEST_GLOBAL,
  43. MODE_TEST_SILENT
  44. } CanMode;
  45. typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
  46. typedef struct can_s can_t;
  47. void can_init (can_t *obj, PinName rd, PinName td);
  48. void can_free (can_t *obj);
  49. int can_frequency(can_t *obj, int hz);
  50. void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
  51. void can_irq_free (can_t *obj);
  52. void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
  53. int can_write (can_t *obj, CAN_Message, int cc);
  54. int can_read (can_t *obj, CAN_Message *msg, int handle);
  55. int can_mode (can_t *obj, CanMode mode);
  56. int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
  57. void can_reset (can_t *obj);
  58. unsigned char can_rderror (can_t *obj);
  59. unsigned char can_tderror (can_t *obj);
  60. void can_monitor (can_t *obj, int silent);
  61. #ifdef __cplusplus
  62. };
  63. #endif
  64. #endif // MBED_CAN_API_H
  65. #endif