8 years, 7 months ago.

Callback is not a template "Callback<void()> _ irq[IrqCnt];

  1. ifndef MBED_SERIALBASE_H
  2. define MBED_SERIALBASE_H
  1. include "platform/platform.h"
  1. if DEVICE_SERIAL
  1. include "Stream.h"
  2. include "Callback.h"
  3. include "serial_api.h"
  4. include "toolchain.h"
  1. if DEVICE_SERIAL_ASYNCH
  2. include "CThunk.h"
  3. include "dma_api.h"
  4. endif

namespace mbed { class SerialBase {

public: void baud(int baudrate);

enum Parity { None = 0, Odd, Even, Forced1, Forced0 };

enum IrqType { RxIrq = 0, TxIrq,

IrqCnt };

enum Flow { Disabled = 0, RTS, CTS, RTSCTS };

void format(int bits=8, Parity parity=SerialBase::None, int stop_bits=1);

int readable();

int writeable();

void attach(Callback<void()> func, IrqType type=RxIrq);

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) { attach(callback(obj, method), type); }

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) { attach(callback(obj, method), type); }

protected:

virtual void unlock(void);

public:

  1. if DEVICE_SERIAL_FC void set_flow_control(Flow type, PinName flow1=NC, PinName flow2=NC);
  2. endif

static void _irq_handler(uint32_t id, SerialIrq irq_type);

  1. if DEVICE_SERIAL_ASYNCH

int write(const uint8_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);

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(uint16_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_RX_COMPLETE, unsigned char char_match = SERIAL_RESERVED_CHAR_MATCH);

void abort_read();

int set_dma_usage_tx(DMAUsage usage);

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 interrupt_handler_asynch(void);

  1. endif

protected: SerialBase(PinName tx, PinName rx, int baud); virtual SerialBase() { }

int _base_getc(); int _base_putc(int c);

  1. if DEVICE_SERIAL_ASYNCH CThunk<SerialBase> _thunk_irq; event_callback_t _tx_callback; event_callback_t _rx_callback; DMAUsage _tx_usage; DMAUsage _rx_usage;
  2. endif

serial_t _serial; Callback<void()> _irq[IrqCnt]; int _baud;

};

} namespace mbed

  1. endif
  1. endif
Be the first to answer this question.