Naze32 clone with Frysky receiver
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_SERIAL_H
  17. #define MBED_SERIAL_H
  18. #include "platform.h"
  19. #if DEVICE_SERIAL
  20. #include "Stream.h"
  21. #include "SerialBase.h"
  22. #include "serial_api.h"
  23. namespace mbed {
  24. /** A serial port (UART) for communication with other serial devices
  25. *
  26. * Can be used for Full Duplex communication, or Simplex by specifying
  27. * one pin as NC (Not Connected)
  28. *
  29. * Example:
  30. * @code
  31. * // Print "Hello World" to the PC
  32. *
  33. * #include "mbed.h"
  34. *
  35. * Serial pc(USBTX, USBRX);
  36. *
  37. * int main() {
  38. * pc.printf("Hello World\n");
  39. * }
  40. * @endcode
  41. */
  42. class Serial : public SerialBase, public Stream {
  43. public:
  44. #if DEVICE_SERIAL_ASYNCH
  45. using SerialBase::read;
  46. using SerialBase::write;
  47. #endif
  48. /** Create a Serial port, connected to the specified transmit and receive pins
  49. *
  50. * @param tx Transmit pin
  51. * @param rx Receive pin
  52. *
  53. * @note
  54. * Either tx or rx may be specified as NC if unused
  55. */
  56. Serial(PinName tx, PinName rx, const char *name=NULL);
  57. protected:
  58. virtual int _getc();
  59. virtual int _putc(int c);
  60. };
  61. } // namespace mbed
  62. #endif
  63. #endif