Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
Diff: drivers/SerialBase.h
- Revision:
- 187:0387e8f68319
- Parent:
- 184:08ed48f1de7f
--- a/drivers/SerialBase.h	Fri Jun 22 16:45:37 2018 +0100
+++ b/drivers/SerialBase.h	Thu Sep 06 13:40:20 2018 +0100
@@ -76,7 +76,7 @@
      *  @param parity The parity used (SerialBase::None, SerialBase::Odd, SerialBase::Even, SerialBase::Forced1, SerialBase::Forced0; default = SerialBase::None)
      *  @param stop_bits The number of stop bits (1 or 2; default = 1)
      */
-    void format(int bits=8, Parity parity=SerialBase::None, int stop_bits=1);
+    void format(int bits = 8, Parity parity = SerialBase::None, int stop_bits = 1);
 
     /** Determine if there is a character available to read
      *
@@ -99,7 +99,7 @@
      *  @param func A pointer to a void function, or 0 to set as none
      *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
      */
-    void attach(Callback<void()> func, IrqType type=RxIrq);
+    void attach(Callback<void()> func, IrqType type = RxIrq);
 
     /** Attach a member function to call whenever a serial interrupt is generated
      *
@@ -112,9 +112,10 @@
      */
     template<typename T>
     MBED_DEPRECATED_SINCE("mbed-os-5.1",
-        "The attach function does not support cv-qualifiers. Replaced by "
-        "attach(callback(obj, method), type).")
-    void attach(T *obj, void (T::*method)(), IrqType type=RxIrq) {
+                          "The attach function does not support cv-qualifiers. Replaced by "
+                          "attach(callback(obj, method), type).")
+    void attach(T *obj, void (T::*method)(), IrqType type = RxIrq)
+    {
         attach(callback(obj, method), type);
     }
 
@@ -129,9 +130,10 @@
      */
     template<typename T>
     MBED_DEPRECATED_SINCE("mbed-os-5.1",
-        "The attach function does not support cv-qualifiers. Replaced by "
-        "attach(callback(obj, method), type).")
-    void attach(T *obj, void (*method)(T*), IrqType type=RxIrq) {
+                          "The attach function does not support cv-qualifiers. Replaced by "
+                          "attach(callback(obj, method), type).")
+    void attach(T *obj, void (*method)(T *), IrqType type = RxIrq)
+    {
         attach(callback(obj, method), type);
     }
 
@@ -158,7 +160,7 @@
      *  @param flow1 the first flow control pin (RTS for RTS or RTSCTS, CTS for CTS)
      *  @param flow2 the second flow control pin (CTS for RTSCTS)
      */
-    void set_flow_control(Flow type, PinName flow1=NC, PinName flow2=NC);
+    void set_flow_control(Flow type, PinName flow1 = NC, PinName flow2 = NC);
 #endif
 
     static void _irq_handler(uint32_t id, SerialIrq irq_type);
@@ -168,24 +170,24 @@
     /** Begin asynchronous write using 8bit buffer. The completition invokes registered TX event callback
      *
      *  This function locks the deep sleep until any event has occurred
-     * 
+     *
      *  @param buffer   The buffer where received data will be stored
      *  @param length   The buffer length in bytes
      *  @param callback The event callback function
      *  @param event    The logical OR of TX events
      */
-    int write(const uint8_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
+    int write(const uint8_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_TX_COMPLETE);
 
     /** Begin asynchronous write using 16bit buffer. The completition invokes registered TX event callback
      *
      *  This function locks the deep sleep until any event has occurred
-     * 
+     *
      *  @param buffer   The buffer where received data will be stored
      *  @param length   The buffer length in bytes
      *  @param callback The event callback function
      *  @param event    The logical OR of TX events
      */
-    int write(const uint16_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
+    int write(const uint16_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_TX_COMPLETE);
 
     /** Abort the on-going write transfer
      */
@@ -194,26 +196,26 @@
     /** Begin asynchronous reading using 8bit buffer. The completition invokes registred RX event callback.
      *
      *  This function locks the deep sleep until any event has occurred
-     * 
+     *
      *  @param buffer     The buffer where received data will be stored
      *  @param length     The buffer length in bytes
      *  @param callback   The event callback function
      *  @param event      The logical OR of RX events
      *  @param char_match The matching character
      */
-    int read(uint8_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_RX_COMPLETE, unsigned char char_match = SERIAL_RESERVED_CHAR_MATCH);
+    int read(uint8_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_RX_COMPLETE, unsigned char char_match = SERIAL_RESERVED_CHAR_MATCH);
 
     /** Begin asynchronous reading using 16bit buffer. The completition invokes registred RX event callback.
      *
      *  This function locks the deep sleep until any event has occurred
-     * 
+     *
      *  @param buffer     The buffer where received data will be stored
      *  @param length     The buffer length in bytes
      *  @param callback   The event callback function
      *  @param event      The logical OR of RX events
      *  @param char_match The matching character
      */
-    int read(uint16_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_RX_COMPLETE, unsigned char char_match = SERIAL_RESERVED_CHAR_MATCH);
+    int read(uint16_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_RX_COMPLETE, unsigned char char_match = SERIAL_RESERVED_CHAR_MATCH);
 
     /** Abort the on-going read transfer
      */
@@ -234,8 +236,8 @@
     int set_dma_usage_rx(DMAUsage usage);
 
 protected:
-    void start_read(void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event, unsigned char char_match);
-    void start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event);
+    void start_read(void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event, unsigned char char_match);
+    void start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event);
     void interrupt_handler_asynch(void);
 #endif
 
    