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.

mbed_interface.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* mbed Microcontroller Library
  2. * Copyright (c) 2006-2013 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_INTERFACE_H
  17. #define MBED_INTERFACE_H
  18. #include "device.h"
  19. /* Mbed interface mac address
  20. * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
  21. * otherwise MAC_ADD_x are used.
  22. */
  23. #define MBED_MAC_ADDR_INTERFACE 0x00
  24. #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE
  25. #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE
  26. #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE
  27. #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE
  28. #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE
  29. #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE
  30. #define MBED_MAC_ADDRESS_SUM (MBED_MAC_ADDR_0 | MBED_MAC_ADDR_1 | MBED_MAC_ADDR_2 | MBED_MAC_ADDR_3 | MBED_MAC_ADDR_4 | MBED_MAC_ADDR_5)
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if DEVICE_SEMIHOST
  35. /** Functions to control the mbed interface
  36. *
  37. * mbed Microcontrollers have a built-in interface to provide functionality such as
  38. * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
  39. * system. These functions provide means to control the interface suing semihost
  40. * calls it supports.
  41. */
  42. /** Determine whether the mbed interface is connected, based on whether debug is enabled
  43. *
  44. * @returns
  45. * 1 if interface is connected,
  46. * 0 otherwise
  47. */
  48. int mbed_interface_connected(void);
  49. /** Instruct the mbed interface to reset, as if the reset button had been pressed
  50. *
  51. * @returns
  52. * 1 if successful,
  53. * 0 otherwise (e.g. interface not present)
  54. */
  55. int mbed_interface_reset(void);
  56. /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
  57. * The interface will still support the USB serial aspect
  58. *
  59. * @returns
  60. * 0 if successful,
  61. * -1 otherwise (e.g. interface not present)
  62. */
  63. int mbed_interface_disconnect(void);
  64. /** This will disconnect the debug aspect of the interface, and if the USB cable is not
  65. * connected, also power down the interface. If the USB cable is connected, the interface
  66. * will remain powered up and visible to the host
  67. *
  68. * @returns
  69. * 0 if successful,
  70. * -1 otherwise (e.g. interface not present)
  71. */
  72. int mbed_interface_powerdown(void);
  73. /** This returns a string containing the 32-character UID of the mbed interface
  74. * This is a weak function that can be overwritten if required
  75. *
  76. * @param uid A 33-byte array to write the null terminated 32-byte string
  77. *
  78. * @returns
  79. * 0 if successful,
  80. * -1 otherwise (e.g. interface not present)
  81. */
  82. int mbed_interface_uid(char *uid);
  83. #endif
  84. /** This returns a unique 6-byte MAC address, based on the interface UID
  85. * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
  86. *
  87. * This is a weak function that can be overwritten if you want to provide your own mechanism to
  88. * provide a MAC address.
  89. *
  90. * @param mac A 6-byte array to write the MAC address
  91. */
  92. void mbed_mac_address(char *mac);
  93. /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
  94. */
  95. void mbed_die(void);
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif