fork

Dependencies:   BLE_API mbed-dev-bin nRF51822

Dependents:   microbit

Fork of microbit-dal by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

MicroBitComponent Class Reference

MicroBitComponent Class Reference

Class definition for MicroBitComponent. More...

#include <MicroBitComponent.h>

Inherited by MicroBitAccelerometer, MicroBitBLEManager [private], MicroBitButton, MicroBitCompass, MicroBitDisplay, MicroBitEventService, MicroBitIOPinService, MicroBitMessageBus, MicroBitMultiButton, MicroBitPin, MicroBitRadio [private], MicroBitSystemTimerCallback [private], and MicroBitThermometer.

Public Member Functions

 MicroBitComponent ()
 The default constructor of a MicroBitComponent.
virtual void systemTick ()
 The system timer will call this member function once the component has been added to the array of system components using system_timer_add_component.
virtual void idleTick ()
 The idle thread will call this member function once the component has been added to the array of idle components using fiber_add_idle_component.
virtual int isIdleCallbackNeeded ()
 When added to the idleThreadComponents array, this function will be called to determine if and when data is ready.
virtual ~MicroBitComponent ()
 If you have added your component to the idle or system tick component arrays, you must remember to remove your component from them if your component is destructed.

Detailed Description

Class definition for MicroBitComponent.

All components should inherit from this class.

If a component requires regular updates, then you should add the component to the systemTick and idleTick queues.

The system timer will call systemTick() once the component has been added to the array of system components using system_timer_add_component. This callback will be in interrupt context.

The idle thread will call idleTick() once the component has been added to the array of idle components using fiber_add_idle_component. Updates are determined by the isIdleCallbackNeeded() member function.

Definition at line 95 of file MicroBitComponent.h.


Constructor & Destructor Documentation

The default constructor of a MicroBitComponent.

Definition at line 107 of file MicroBitComponent.h.

virtual ~MicroBitComponent (  ) [virtual]

If you have added your component to the idle or system tick component arrays, you must remember to remove your component from them if your component is destructed.

Definition at line 147 of file MicroBitComponent.h.


Member Function Documentation

virtual void idleTick (  ) [virtual]

The idle thread will call this member function once the component has been added to the array of idle components using fiber_add_idle_component.

Updates are determined by the isIdleCallbackNeeded() member function.

Reimplemented in MicroBitBLEManager, MicroBitEventService, MicroBitIOPinService, MicroBitAccelerometer, MicroBitCompass, and MicroBitThermometer.

Definition at line 127 of file MicroBitComponent.h.

virtual int isIdleCallbackNeeded (  ) [virtual]

When added to the idleThreadComponents array, this function will be called to determine if and when data is ready.

Note:
override this if you want to request to be scheduled as soon as possible.

Reimplemented in MicroBitAccelerometer, MicroBitCompass, and MicroBitThermometer.

Definition at line 138 of file MicroBitComponent.h.

virtual void systemTick (  ) [virtual]

The system timer will call this member function once the component has been added to the array of system components using system_timer_add_component.

This callback will be in interrupt context.

Reimplemented in MicroBitSystemTimerCallback, MicroBitButton, and MicroBitDisplay.

Definition at line 118 of file MicroBitComponent.h.