This program shows how to use the MODSERIAL library by Andy Kirkham to do canonical input processing. This allows you to enter and edit a command line (in the same way that you do in DOS or Linux) without tying up your main routine.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

MODSERIAL_callback Class Reference

MODSERIAL_callback Class Reference

#include <MODSERIAL.h>

Public Member Functions

 MODSERIAL_callback ()
 Constructor.
void attach (void(*function)(MODSERIAL_IRQ_INFO *)=0)
 attach - Overloaded attachment function.
template<class T >
void attach (T *item, void(T::*method)(MODSERIAL_IRQ_INFO *))
 attach - Overloaded attachment function.
void call (MODSERIAL_IRQ_INFO *arg)
 call - Overloaded callback initiator.

Protected Attributes

void(* c_callback )(MODSERIAL_IRQ_INFO *)
 C callback function pointer.
MODSERIAL_callback_dummy * obj_callback
 C++ callback object/method pointer (the object part).
void(MODSERIAL_callback_dummy::* method_callback )(MODSERIAL_IRQ_INFO *)
 C++ callback object/method pointer (the method part).

Detailed Description

Author:
Andy Kirkham
See also:
http://mbed.org/cookbook/MODSERIAL
example3a.cpp
example3b.cpp
The MODSERIAL API

MODSERIAL_callback is a class used to hold application callbacks that MODSERIAL can invoke on certain events.

Definition at line 105 of file MODSERIAL.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 122 of file MODSERIAL.h.


Member Function Documentation

void attach ( void(*)(MODSERIAL_IRQ_INFO *)  function = 0 )

attach - Overloaded attachment function.

Attach a C type function pointer as the callback.

Note, the callback function prototype must be:-

 void myCallbackFunction(MODSERIAL_IRQ_INFO *);
Parameters:
AC function pointer to call.

Definition at line 138 of file MODSERIAL.h.

void attach ( T *  item,
void(T::*)(MODSERIAL_IRQ_INFO *)  method 
)

attach - Overloaded attachment function.

Attach a C++ type object/method pointer as the callback.

Note, the callback method prototype must be:-

     public:
         void myCallbackFunction(MODSERIAL_IRQ_INFO *);
Parameters:
AC++ object pointer.
AC++ method within the object to call.

Definition at line 153 of file MODSERIAL.h.

void call ( MODSERIAL_IRQ_INFO arg )

call - Overloaded callback initiator.

call the callback function.

Parameters:
uint32_tThe value to pass to the callback.
Returns:
uint32_t The value the callback returns.

Definition at line 165 of file MODSERIAL.h.


Field Documentation

void(* c_callback)(MODSERIAL_IRQ_INFO *) [protected]

C callback function pointer.

Definition at line 110 of file MODSERIAL.h.

void(MODSERIAL_callback_dummy::* method_callback)(MODSERIAL_IRQ_INFO *) [protected]

C++ callback object/method pointer (the method part).

Definition at line 116 of file MODSERIAL.h.

MODSERIAL_callback_dummy* obj_callback [protected]

C++ callback object/method pointer (the object part).

Definition at line 113 of file MODSERIAL.h.