diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c21ce6..4d462a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 2.0.2 + +### Fixes + +* Last release did not have the submodules correctly bundled. The `bundle.py` script now ensures this wont happen again. + # 2.0.1 ### Features diff --git a/CPPLINT.cfg b/CPPLINT.cfg index 083e6fd..ae26212 100644 --- a/CPPLINT.cfg +++ b/CPPLINT.cfg @@ -1,2 +1,2 @@ filter=-build/header_guard,-legal/copyright,-runtime/int,-readability/casting,-build/include -linelength=100 +linelength=300 diff --git a/gulpfile.js b/gulpfile.js index b22911e..6c58ed1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,7 +9,8 @@ var config = { function deployMarkers() { return { - 'UPDATED_AT': new Date().toISOString() + 'UPDATED_AT': new Date().toISOString(), + '.nojekyll': "" } } diff --git a/hardware/bean/avr/cores/bean/Bean.h b/hardware/bean/avr/cores/bean/Bean.h index 93fbd45..11a20b4 100644 --- a/hardware/bean/avr/cores/bean/Bean.h +++ b/hardware/bean/avr/cores/bean/Bean.h @@ -6,67 +6,66 @@ #include "BeanAncs.h" #include "bma250.h" -/* - * An accelerometer interrupt type, they are as follows: - * FLAT_EVENT - triggers when the accelerometer is lying flat on a surface - * ORIENT_EVENT - triggers when the accelerometer is NOT lying flat on a surface, but is tilted * in any direction - * SINGLE_TAP_EVENT - triggers when the accelerometer is tapped once - * DOUBLE_TAP_EVENT - triggers when the accelerometer is tapped twice - * ANY_MOTION_EVENT - triggers when the accelerometer experiences any change in motion - * HIGH_G_EVENT - triggers when the accelerometer experiences a velocity event higher than it's * sensitivity - * LOW_G_EVENT - triggers when the accelerometer is in free fall or experiences no gravitational * pull +/** + * Accelerometer interrupt types */ typedef enum AccelEventTypes { - FLAT_EVENT = 0x80, - ORIENT_EVENT = 0x40, - SINGLE_TAP_EVENT = 0x20, - DOUBLE_TAP_EVENT = 0x10, - ANY_MOTION_EVENT = 0x04, - HIGH_G_EVENT = 0x02, - LOW_G_EVENT = 0x01 + FLAT_EVENT = 0x80, /**< triggers when the accelerometer is lying flat on a surface */ + ORIENT_EVENT = 0x40, /**< triggers when the accelerometer is NOT lying flat on a surface, but is tilted * in any direction */ + SINGLE_TAP_EVENT = 0x20, /**< triggers when the accelerometer is tapped once */ + DOUBLE_TAP_EVENT = 0x10, /**< triggers when the accelerometer is tapped twice */ + ANY_MOTION_EVENT = 0x04, /**< triggers when the accelerometer experiences any change in motion */ + HIGH_G_EVENT = 0x02, /**< triggers when the accelerometer experiences a velocity event higher than it's * sensitivity */ + LOW_G_EVENT = 0x01 /**< triggers when the accelerometer is in free fall or experiences no gravitational * pull */ }; +/** + * Advertisement data types + */ typedef enum AdvertisementDataTypes { - GAP_ADTYPE_FLAGS = 0x01, // Discovery Mode: @ref GAP_ADTYPE_FLAGS_MODES - GAP_ADTYPE_16BIT_MORE = 0x02, // Service: More 16-bit UUIDs available - GAP_ADTYPE_16BIT_COMPLETE = 0x03, // Service: Complete list of 16-bit UUIDs - GAP_ADTYPE_32BIT_MORE = 0x04, // Service: More 32-bit UUIDs available - GAP_ADTYPE_32BIT_COMPLETE = 0x05, // Service: Complete list of 32-bit UUIDs - GAP_ADTYPE_128BIT_MORE = 0x06, // Service: More 128-bit UUIDs available - GAP_ADTYPE_128BIT_COMPLETE = 0x07, // Service: Complete list of 128-bit UUIDs - GAP_ADTYPE_LOCAL_NAME_SHORT = 0x08, // Shortened local name - GAP_ADTYPE_LOCAL_NAME_COMPLETE = 0x09, // Complete local name - GAP_ADTYPE_POWER_LEVEL = 0x0A, // TX Power Level: 0xXX: -127 to +127 dBm - GAP_ADTYPE_OOB_CLASS_OF_DEVICE = 0x0D, // Simple Pairing OOB Tag: Class - // of device (3 octets) - GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC = 0x0E, // Simple Pairing OOB Tag: Simple Pairing - // Hash C (16 octets) - GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR = 0x0F, // Simple Pairing OOB Tag: Simple Pairing - // Randomizer R (16 octets) - GAP_ADTYPE_SM_TK = 0x10, // Security Manager TK Value - GAP_ADTYPE_SM_OOB_FLAG = 0x11, // Secutiry Manager OOB Flags - GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE = 0x12, // Min and Max values of the connection - // interval - // (2 octets Min, 2 octets Max) (0xFFFF - // indicates no conn interval min or max) - GAP_ADTYPE_SIGNED_DATA = 0x13, // Signed Data field - GAP_ADTYPE_SERVICES_LIST_16BIT = 0x14, // Service Solicitation: - // list of 16-bit Service UUIDs - GAP_ADTYPE_SERVICES_LIST_128BIT = 0x15, // Service Solicitation: - // list of 128-bit Service UUIDs - GAP_ADTYPE_SERVICE_DATA = 0x16, // Service Data - GAP_ADTYPE_APPEARANCE = 0x19, // Appearance - GAP_ADTYPE_MANUFACTURER_SPECIFIC = 0xFF, // Manufacturer Specific Data: - // first 2 octets contain - // the Company Identifier Code - // followed by the additional - // manufacturer specific data + GAP_ADTYPE_FLAGS = 0x01, /**< Discovery Mode: @ref GAP_ADTYPE_FLAGS_MODES */ + GAP_ADTYPE_16BIT_MORE = 0x02, /**< Service: More 16-bit UUIDs available */ + GAP_ADTYPE_16BIT_COMPLETE = 0x03, /**< Service: Complete list of 16-bit UUIDs */ + GAP_ADTYPE_32BIT_MORE = 0x04, /**< Service: More 32-bit UUIDs available */ + GAP_ADTYPE_32BIT_COMPLETE = 0x05, /**< Service: Complete list of 32-bit UUIDs */ + GAP_ADTYPE_128BIT_MORE = 0x06, /**< Service: More 128-bit UUIDs available */ + GAP_ADTYPE_128BIT_COMPLETE = 0x07, /**< Service: Complete list of 128-bit UUIDs */ + GAP_ADTYPE_LOCAL_NAME_SHORT = 0x08, /**< Shortened local name */ + GAP_ADTYPE_LOCAL_NAME_COMPLETE = 0x09, /**< Complete local name */ + GAP_ADTYPE_POWER_LEVEL = 0x0A, /**< TX Power Level: 0xXX: -127 to +127 dBm */ + GAP_ADTYPE_OOB_CLASS_OF_DEVICE = 0x0D, /**< Simple Pairing OOB Tag: Class */ + /**< of device (3 octets) */ + GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC = 0x0E, /**< Simple Pairing OOB Tag: Simple Pairing */ + /**< Hash C (16 octets) */ + GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR = 0x0F, /**< Simple Pairing OOB Tag: Simple Pairing */ + /**< Randomizer R (16 octets) */ + GAP_ADTYPE_SM_TK = 0x10, /**< Security Manager TK Value */ + GAP_ADTYPE_SM_OOB_FLAG = 0x11, /**< Secutiry Manager OOB Flags */ + GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE = 0x12, /**< Min and Max values of the connection */ + /**< interval */ + /**< (2 octets Min, 2 octets Max) (0xFFFF */ + /**< indicates no conn interval min or max) */ + GAP_ADTYPE_SIGNED_DATA = 0x13, /**< Signed Data field */ + GAP_ADTYPE_SERVICES_LIST_16BIT = 0x14, /**< Service Solicitation: */ + /**< list of 16-bit Service UUIDs */ + GAP_ADTYPE_SERVICES_LIST_128BIT = 0x15, /**< Service Solicitation: */ + /**< list of 128-bit Service UUIDs */ + GAP_ADTYPE_SERVICE_DATA = 0x16, /**< Service Data */ + GAP_ADTYPE_APPEARANCE = 0x19, /**< Appearance */ + GAP_ADTYPE_MANUFACTURER_SPECIFIC = 0xFF, /**< Manufacturer Specific Data: */ + /**< first 2 octets contain */ + /**< the Company Identifier Code */ + /**< followed by the additional */ + /**< manufacturer specific data */ }; +/** + * Advertisement Type + */ typedef enum AdvertisementType { - GAP_ADTYPE_FLAGS_LIMITED = 0x01, // Discovery Mode: LE Limited Discoverable Mode - GAP_ADTYPE_FLAGS_GENERAL = 0x02, // Discovery Mode: LE General Discoverable Mode - GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED = 0x04, // Discovery Mode: BR/EDR Not Supported + GAP_ADTYPE_FLAGS_LIMITED = 0x01, /**< Discovery Mode: LE Limited Discoverable Mode */ + GAP_ADTYPE_FLAGS_GENERAL = 0x02, /**< Discovery Mode: LE General Discoverable Mode */ + GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED = 0x04, /**< Discovery Mode: BR/EDR Not Supported */ }; diff --git a/hardware/bean/avr/cores/bean/BeanHID.cpp b/hardware/bean/avr/cores/bean/BeanHID.cpp index 36cfbe8..ebab685 100644 --- a/hardware/bean/avr/cores/bean/BeanHID.cpp +++ b/hardware/bean/avr/cores/bean/BeanHID.cpp @@ -20,7 +20,7 @@ #include "BeanHID.h" // Singleton -BeanHid_ BeanHid; +BeanHidClass BeanHid; #define HID_DEV_DATA_LEN 8 @@ -267,7 +267,7 @@ uint8_t _hid_idle = 1; // void sendReport(CcReport *pReport); // void buttons(uint8_t b); -BeanHid_::BeanHid_(void) { +BeanHidClass::BeanHidClass(void) { _buttons = 0; isShiftHeld = false; } @@ -363,7 +363,7 @@ static void addCommandToCcReport(CcReport *pReport, uint8_t cmd) { } } -void BeanHid_::_genericSendReport(uint8_t id, uint8_t *buffer, size_t length) { +void BeanHidClass::_genericSendReport(uint8_t id, uint8_t *buffer, size_t length) { hidDevReport_t report; report.type = HID_REPORT_TYPE_INPUT; report.id = id; @@ -376,20 +376,20 @@ void BeanHid_::_genericSendReport(uint8_t id, uint8_t *buffer, size_t length) { } } -void BeanHid_::sendReport(MouseReport *pReport) { +void BeanHidClass::sendReport(MouseReport *pReport) { _genericSendReport(HID_RPT_ID_MOUSE_IN, (uint8_t *)pReport, sizeof(MouseReport)); } -void BeanHid_::sendReport(KeyReport *pReport) { +void BeanHidClass::sendReport(KeyReport *pReport) { _genericSendReport(HID_RPT_ID_KEY_IN, (uint8_t *)pReport, sizeof(KeyReport)); } -void BeanHid_::sendReport(CcReport *pReport) { +void BeanHidClass::sendReport(CcReport *pReport) { _genericSendReport(HID_RPT_ID_CC_IN, (uint8_t *)pReport, sizeof(CcReport)); } -void BeanHid_::buttons(uint8_t b) { +void BeanHidClass::buttons(uint8_t b) { if (b != _buttons) { _buttons = b; moveMouse(0, 0, 0); @@ -398,25 +398,25 @@ void BeanHid_::buttons(uint8_t b) { // Public functions -void BeanHid_::enable(void) { +void BeanHidClass::enable(void) { ADV_SWITCH_ENABLED_T curServices = Bean.getServices(); curServices.hid = 1; Bean.setServices(curServices); } -bool BeanHid_::isEnabled(void) { +bool BeanHidClass::isEnabled(void) { ADV_SWITCH_ENABLED_T curServices = Bean.getServices(); return (curServices.hid == 1) ? true : false; } -void BeanHid_::disable(void) { +void BeanHidClass::disable(void) { ADV_SWITCH_ENABLED_T curServices = Bean.getServices(); curServices.hid = 0; Bean.setServices(curServices); } // Mouse -void BeanHid_::moveMouse(signed char delta_x, signed char delta_y, +void BeanHidClass::moveMouse(signed char delta_x, signed char delta_y, signed char delta_wheel) { MouseReport m; m.mouse[0] = _buttons; @@ -426,31 +426,31 @@ void BeanHid_::moveMouse(signed char delta_x, signed char delta_y, sendReport(&m); } -void BeanHid_::holdMouseClick(mouseButtons button) { +void BeanHidClass::holdMouseClick(mouseButtons button) { buttons(_buttons | button); } -void BeanHid_::releaseMouseClick(mouseButtons button) { +void BeanHidClass::releaseMouseClick(mouseButtons button) { buttons(_buttons & ~button); } -void BeanHid_::sendMouseClick(mouseButtons button) { +void BeanHidClass::sendMouseClick(mouseButtons button) { holdMouseClick(button); releaseMouseClick(button); } // Consumer Control -void BeanHid_::sendMediaControl(mediaControl command) { +void BeanHidClass::sendMediaControl(mediaControl command) { holdMediaControl(command); releaseMediaControl(command); } -void BeanHid_::holdMediaControl(mediaControl command) { +void BeanHidClass::holdMediaControl(mediaControl command) { addCommandToCcReport(&ccReportForHeldCommands, command); sendReport(&ccReportForHeldCommands); } -void BeanHid_::releaseMediaControl(mediaControl command) { +void BeanHidClass::releaseMediaControl(mediaControl command) { CcReport report = {0, 0}; addCommandToCcReport(&report, command); @@ -461,7 +461,7 @@ void BeanHid_::releaseMediaControl(mediaControl command) { sendReport(&ccReportForHeldCommands); } -void BeanHid_::releaseAllMediaControls() { +void BeanHidClass::releaseAllMediaControls() { ccReportForHeldCommands = {0, 0}; sendReport(&ccReportForHeldCommands); } @@ -472,7 +472,7 @@ void BeanHid_::releaseAllMediaControls() { // to the persistent key report and sends the report. Because of the way // USB HID works, the host acts like the key remains pressed until we // call release(), releaseAll(), or otherwise clear the report and resend. -size_t BeanHid_::_holdKey(uint8_t k) { +size_t BeanHidClass::_holdKey(uint8_t k) { uint8_t i; if (k >= 136) { // it's a non-printing key (not a modifier) k = k - 136; @@ -516,7 +516,7 @@ size_t BeanHid_::_holdKey(uint8_t k) { // _release() takes the specified key out of the persistent key report and // sends the report. This tells the OS the key is no longer pressed and that // it shouldn't be repeated any more. -size_t BeanHid_::_releaseKey(uint8_t k) { +size_t BeanHidClass::_releaseKey(uint8_t k) { uint8_t i; if (k >= 136) { // it's a non-printing key (not a modifier) k = k - 136; @@ -549,27 +549,27 @@ size_t BeanHid_::_releaseKey(uint8_t k) { return 1; } -size_t BeanHid_::_sendKey(uint8_t c) { +size_t BeanHidClass::_sendKey(uint8_t c) { uint8_t p = _holdKey(c); // Keydown uint8_t r = _releaseKey(c); // Keyup return (p & r); } -int BeanHid_::holdKey(char key) { return (int)_holdKey((uint8_t)key); } -int BeanHid_::holdKey(modifierKey key) { return (int)_holdKey((uint8_t)key); } +int BeanHidClass::holdKey(char key) { return (int)_holdKey((uint8_t)key); } +int BeanHidClass::holdKey(modifierKey key) { return (int)_holdKey((uint8_t)key); } /** * Needs docs */ -int BeanHid_::releaseKey(char key) { return (int)_releaseKey((uint8_t)key); } -int BeanHid_::releaseKey(modifierKey key) { +int BeanHidClass::releaseKey(char key) { return (int)_releaseKey((uint8_t)key); } +int BeanHidClass::releaseKey(modifierKey key) { return (int)_releaseKey((uint8_t)key); } /** * Needs docs */ -void BeanHid_::releaseAllKeys(void) { +void BeanHidClass::releaseAllKeys(void) { _keyReport.keys[0] = 0; _keyReport.keys[1] = 0; _keyReport.keys[2] = 0; @@ -583,13 +583,13 @@ void BeanHid_::releaseAllKeys(void) { /** * Needs docs */ -int BeanHid_::sendKey(char key) { return (int)_sendKey((uint8_t)key); } -int BeanHid_::sendKey(modifierKey key) { return (int)_sendKey((uint8_t)key); } +int BeanHidClass::sendKey(char key) { return (int)_sendKey((uint8_t)key); } +int BeanHidClass::sendKey(modifierKey key) { return (int)_sendKey((uint8_t)key); } /** * Needs docs */ -int BeanHid_::sendKeys(String charsToType) { +int BeanHidClass::sendKeys(String charsToType) { int status = 0; int maxIndex = charsToType.length(); for (int i = 0; i < maxIndex; i++) { diff --git a/hardware/bean/avr/cores/bean/BeanHID.h b/hardware/bean/avr/cores/bean/BeanHID.h index 8a1216d..22c713e 100644 --- a/hardware/bean/avr/cores/bean/BeanHID.h +++ b/hardware/bean/avr/cores/bean/BeanHID.h @@ -1,17 +1,19 @@ - - #ifndef __BEANHID__ #define __BEANHID__ #include "BeanSerialTransport.h" -typedef enum { +/** Enumeration of mouse buttons + */ +typedef enum mouseButtons { MOUSE_LEFT = 1, MOUSE_RIGHT = 2, MOUSE_MIDDLE = 4, MOUSE_ALL = (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE) -} mouseButtons; +}; +/** Enumeration of modifier keys + */ typedef enum { KEY_LEFT_CTRL = 0x80, KEY_LEFT_SHIFT = 0x81, @@ -21,7 +23,6 @@ typedef enum { KEY_RIGHT_SHIFT = 0x85, KEY_RIGHT_ALT = 0x86, KEY_RIGHT_GUI = 0x87, - KEY_UP_ARROW = 0xDA, KEY_DOWN_ARROW = 0xD9, KEY_LEFT_ARROW = 0xD8, @@ -51,8 +52,8 @@ typedef enum { KEY_F12 = 0xCD } modifierKey; -// HID Consumer Usage IDs (subset of the codes available in the USB HID Usage -// Tables spec) +/** HID Consumer Usage IDs (subset of the codes available in the USB HID Usage Tables spec) + */ typedef enum { POWER = 0x30, ASSIGN_SEL = 0x81, @@ -72,18 +73,23 @@ typedef enum { MUTE = 0xE2 } mediaControl; -// Low level key report: up to 6 keys and shift, ctrl etc at once +/** Low level key report: up to 6 keys and shift, ctrl etc at once + */ typedef struct { uint8_t modifiers; uint8_t reserved; uint8_t keys[6]; } KeyReport; -typedef struct { uint8_t mouse[4]; } MouseReport; +typedef struct { + uint8_t mouse[4]; +} MouseReport; -typedef struct { uint8_t bytes[2]; } CcReport; +typedef struct { + uint8_t bytes[2]; +} CcReport; -class BeanHid_ { +class BeanHidClass { private: void buttons(uint8_t b); void _genericSendReport(uint8_t id, uint8_t *buffer, size_t length); @@ -95,7 +101,7 @@ class BeanHid_ { size_t _sendKey(uint8_t c); public: - BeanHid_(void); + BeanHidClass(void); /****************************************************************************/ /** @name HID * The user must enter a pairing code (default of 000000) to connect. @@ -244,6 +250,6 @@ class BeanHid_ { private: bool isShiftHeld; }; -extern BeanHid_ BeanHid; +extern BeanHidClass BeanHid; #endif /* if defined(BeanHID) */ diff --git a/hardware/bean/avr/cores/bean/BeanMidi.h b/hardware/bean/avr/cores/bean/BeanMidi.h index 27f8573..03598a5 100644 --- a/hardware/bean/avr/cores/bean/BeanMidi.h +++ b/hardware/bean/avr/cores/bean/BeanMidi.h @@ -20,7 +20,7 @@ typedef enum { CHANNEL13 = 0x0D, CHANNEL14 = 0x0E, CHANNEL15 = 0x0F -}midiChannels; +} midiChannels; typedef enum { NOTE_Cn1 = 0, @@ -216,7 +216,7 @@ typedef enum { OMNIMODEON = 125, MONOMODEON = 126, POLYMODEON = 127 -}midiControlChange; +} midiControlChange; typedef enum { NOTEOFF = 0x80, @@ -228,7 +228,7 @@ typedef enum { PITCHBENDCHANGE = 0xE0, SYSTEMCOMMON = 0xF0, SYSTEMREALTIME = 0xF8 -}midiMessageTypes; +} midiMessageTypes; typedef enum { BASS_DRUM_2 = 35, @@ -278,7 +278,7 @@ typedef enum { OPEN_CUICA = 79, MUTE_TRIANGLE = 80, OPEN_TRIANGLE = 81 -}midiDrums; +} midiDrums; class BeanMidiClass { @@ -286,7 +286,7 @@ class BeanMidiClass { /****************************************************************************/ /** @name MIDI * Read and write MIDI packets via Bluetooth Low Energy. - * This profile uses Apple's Core Midi Framework to act as a musical instrument. + * This profile uses Apple's Core Midi Framework to act as a musical instrument. * The Bean can send midi messages to an app like garage band to emulate diferent instruments. * A list of different types of MIDI messages can be found here */ @@ -294,11 +294,11 @@ class BeanMidiClass { /** * Enables core Midi functionality on the Bean. - * + * * # Examples * When connected to iOS's or OSX's garage band this bean will play through the C Major scale, play a C Major chord, and then bend a note up. * The Bean will also listen for incoming Core Midi messages. If you have an app that can send core midi messages to BLE peripherals, the Bean's green LED will blink. - * + * * @include profiles/MIDI.ino */ void enable(void); @@ -340,7 +340,7 @@ class BeanMidiClass { int readMessage(uint8_t *status, uint8_t *byte1, uint8_t *byte2); /** - * Sends Midi messages after they have been loaded to the midi buffer using loadMessage() commands. + * Sends Midi messages after they have been loaded to the midi buffer using loadMessage() commands. * * The buffer has a maximum size of 20 messages before it must be dumped or sent using this function. * diff --git a/hardware/bean/avr/cores/bean/BeanSerialTransport.h b/hardware/bean/avr/cores/bean/BeanSerialTransport.h index 092fde9..1151302 100644 --- a/hardware/bean/avr/cores/bean/BeanSerialTransport.h +++ b/hardware/bean/avr/cores/bean/BeanSerialTransport.h @@ -21,7 +21,7 @@ class BeanSerialTransport : public HardwareSerial { friend class BeanClass; friend class BeanMidiClass; friend class BeanAncsClass; - friend class BeanHid_; + friend class BeanHidClass; private: uint32_t m_wakeDelay;