microbit: refactored event codes used by a shared listener "MICROBIT_ID_NOTIFY"

There was no common place to track event codes used in Events intended
for the shared channel using the ID MICROBIT_ID_NOTIFY. This commit
adds a common place for these Event codes.
master
James Devine 7 years ago
parent 776131e4cb
commit 728604423f
  1. 7
      inc/core/NotifyEvents.h
  2. 3
      inc/drivers/MicroBitDisplay.h
  3. 7
      inc/drivers/MicroBitSerial.h
  4. 3
      source/drivers/MicroBitDisplay.cpp
  5. 1
      source/drivers/MicroBitSerial.cpp

@ -0,0 +1,7 @@
#ifndef NOTIFY_EVENTS_H
#define NOTIFY_EVENTS_H
#define MICROBIT_DISPLAY_EVT_FREE 1
#define MICROBIT_SERIAL_EVT_TX_EMPTY 2
#endif

@ -14,8 +14,7 @@
* Event codes raised by MicroBitDisplay
*/
#define MICROBIT_DISPLAY_EVT_ANIMATION_COMPLETE 1
#define MICROBIT_DISPLAY_EVT_FREE 2
#define MICROBIT_DISPLAY_EVT_LIGHT_SENSE 4
#define MICROBIT_DISPLAY_EVT_LIGHT_SENSE 2
//
// Internal constants

@ -7,10 +7,9 @@
#define MICROBIT_SERIAL_DEFAULT_BAUD_RATE 115200
#define MICROBIT_SERIAL_DEFAULT_BUFFER_SIZE 20
#define MICROBIT_SERIAL_EVT_TX_EMPTY 1
#define MICROBIT_SERIAL_EVT_DELIM_MATCH 2
#define MICROBIT_SERIAL_EVT_HEAD_MATCH 3
#define MICROBIT_SERIAL_EVT_RX_FULL 4
#define MICROBIT_SERIAL_EVT_DELIM_MATCH 1
#define MICROBIT_SERIAL_EVT_HEAD_MATCH 2
#define MICROBIT_SERIAL_EVT_RX_FULL 3
#define MICROBIT_SERIAL_RX_IN_USE 1
#define MICROBIT_SERIAL_TX_IN_USE 2

@ -8,6 +8,7 @@
#include "MicroBitSystemTimer.h"
#include "MicroBitFiber.h"
#include "ErrorNo.h"
#include "NotifyEvents.h"
const int greyScaleTimings[MICROBIT_DISPLAY_GREYSCALE_BIT_DEPTH] = {1, 23, 70, 163, 351, 726, 1476, 2976};
@ -105,7 +106,7 @@ void MicroBitDisplay::renderFinish()
void MicroBitDisplay::render()
{
// Simple optimisation.
// Simple optimisation.
// If display is at zero brightness, there's nothing to do.
if(brightness == 0)
return;

@ -3,6 +3,7 @@
#include "ErrorNo.h"
#include "MicroBitComponent.h"
#include "MicroBitFiber.h"
#include "NotifyEvents.h"
uint8_t MicroBitSerial::status = 0;

Loading…
Cancel
Save