Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMX: JSON Mux #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions inc/MicroBit.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ DEALINGS IN THE SOFTWARE.
#include "MicroBitMultiButton.h"

#include "MicroBitSerial.h"
#include "JMXSerial.h"
#include "MicroBitIO.h"
#include "MicroBitMatrixMaps.h"
#include "MicroBitDisplay.h"
Expand Down Expand Up @@ -92,11 +93,8 @@ class MicroBit

public:

// Serial Interface
MicroBitSerial serial;

// Reset Button
InterruptIn resetButton;
// Reset Button
InterruptIn resetButton;

// Persistent key value store
MicroBitStorage storage;
Expand All @@ -107,6 +105,13 @@ class MicroBit
// Device level Message Bus abstraction
MicroBitMessageBus messageBus;

// Serial Interface
#if CONFIG_ENABLED(MICROBIT_IF_CHIP_FS)
JMXSerial serial;
#else
MicroBitSerial serial;
#endif

// Member variables to represent each of the core components on the device.
MicroBitDisplay display;
MicroBitButton buttonA;
Expand All @@ -121,7 +126,7 @@ class MicroBit
MicroBitIO io;

// Bluetooth related member variables.
MicroBitBLEManager bleManager;
MicroBitBLEManager bleManager;
MicroBitRadio radio;
BLEDevice *ble;

Expand Down Expand Up @@ -302,7 +307,7 @@ class MicroBit
*
* @note This interface is now deprecated, and will be removed in the next major release. Please use system_timer_add_component().
*/
int addSystemComponent(MicroBitComponent *component);
int addSystemComponent(MicroBitComponent *component);

/**
* Remove a component from the array of system components. This component will no longer receive
Expand All @@ -323,7 +328,7 @@ class MicroBit
*
* @note This interface is now deprecated, and will be removed in the next major release. Please use system_timer_remove_component().
*/
int removeSystemComponent(MicroBitComponent *component);
int removeSystemComponent(MicroBitComponent *component);

/**
* Adds a component to the array of idle thread components, which are processed
Expand All @@ -347,7 +352,7 @@ class MicroBit
*
* @note This interface is now deprecated, and will be removed in the next major release. Please use fiber_add_idle_component().
*/
int addIdleComponent(MicroBitComponent *component);
int addIdleComponent(MicroBitComponent *component);

/**
* Remove a component from the array of idle thread components
Expand All @@ -369,7 +374,7 @@ class MicroBit
*
* @note This interface is now deprecated, and will be removed in the next major release. Please use fiber_remove_idle_component().
*/
int removeIdleComponent(MicroBitComponent *component);
int removeIdleComponent(MicroBitComponent *component);
};

/**
Expand Down Expand Up @@ -528,7 +533,7 @@ inline void MicroBit::seedRandom(uint32_t seed)
*/
inline int MicroBit::addSystemComponent(MicroBitComponent *component)
{
return system_timer_add_component(component);
return system_timer_add_component(component);
}

/**
Expand All @@ -552,7 +557,7 @@ inline int MicroBit::addSystemComponent(MicroBitComponent *component)
*/
inline int MicroBit::removeSystemComponent(MicroBitComponent *component)
{
return system_timer_remove_component(component);
return system_timer_remove_component(component);
}

/**
Expand All @@ -579,7 +584,7 @@ inline int MicroBit::removeSystemComponent(MicroBitComponent *component)
*/
inline int MicroBit::addIdleComponent(MicroBitComponent *component)
{
return fiber_add_idle_component(component);
return fiber_add_idle_component(component);
}

/**
Expand All @@ -604,7 +609,7 @@ inline int MicroBit::addIdleComponent(MicroBitComponent *component)
*/
inline int MicroBit::removeIdleComponent(MicroBitComponent *component)
{
return fiber_remove_idle_component(component);
return fiber_remove_idle_component(component);
}


Expand Down Expand Up @@ -652,7 +657,7 @@ inline const char *MicroBit::systemVersion()
inline void MicroBit::panic(int statusCode)
{
//show error and enter infinite while
microbit_panic(statusCode);
microbit_panic(statusCode);
}

#endif
4 changes: 2 additions & 2 deletions source/MicroBit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ RawSerial* SERIAL_DEBUG = NULL;
* that represent various device drivers used to control aspects of the micro:bit.
*/
MicroBit::MicroBit() :
serial(USBTX, USBRX),
resetButton(MICROBIT_PIN_BUTTON_RESET),
resetButton(MICROBIT_PIN_BUTTON_RESET),
storage(),
i2c(I2C_SDA0, I2C_SCL0),
messageBus(),
serial(USBTX, USBRX),
display(),
buttonA(MICROBIT_PIN_BUTTON_A, MICROBIT_ID_BUTTON_A),
buttonB(MICROBIT_PIN_BUTTON_B, MICROBIT_ID_BUTTON_B),
Expand Down