Skip to content

Commit

Permalink
Merge pull request #442 from adafruit/clue-play
Browse files Browse the repository at this point in the history
enhance Clue support
  • Loading branch information
hathach authored Feb 19, 2020
2 parents 3d8c68a + a6a7bcd commit 7b8d3e1
Show file tree
Hide file tree
Showing 32 changed files with 795 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/githubci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
rm -r $HOME/$BSP_PATH/*
ln -s $GITHUB_WORKSPACE $HOME/$BSP_PATH/$BSP_VERSION
# Install library dependency
arduino-cli lib install "Adafruit GFX Library" "Adafruit SSD1306" "Adafruit ILI9341" "Adafruit HX8357 Library" "Adafruit EPD"
arduino-cli lib install "Adafruit GFX Library" "Adafruit SSD1306" "Adafruit ILI9341" "Adafruit HX8357 Library" "Adafruit ST7735 and ST7789 Library" "Adafruit EPD"
arduino-cli lib install "Adafruit Circuit Playground" "Adafruit NeoPixel" "Adafruit NeoMatrix" "MIDI Library" "Firmata"
- name: Build examples
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

This repository contains the Arduino BSP for Adafruit Bluefruit nRF52 series:

- Adafruit CLUE nRF52840
- [Adafruit CLUE nRF52840](https://www.adafruit.com/product/4500)
- [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
- [Adafruit Feather nRF52832](https://www.adafruit.com/product/3406)
- [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
- Adafruit Feather nRF52840 Sense
- [Adafruit Feather nRF52840 Sense](https://www.adafruit.com/product/4516)
- [Adafruit ItsyBitsy nRF52840 Express](https://www.adafruit.com/product/4481)
- Adafruit Metro nRF52840 Express

Expand Down
20 changes: 15 additions & 5 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ feather52840sense.build.board=NRF52840_FEATHER_SENSE
feather52840sense.build.core=nRF5
feather52840sense.build.variant=feather_nrf52840_sense
feather52840sense.build.usb_manufacturer="Adafruit LLC"
feather52840sense.build.usb_product="Feather Bluefruit Sense"
feather52840sense.build.usb_product="Feather nRF52840 Sense"
feather52840sense.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
feather52840sense.build.ldscript=nrf52840_s140_v6.ld
feather52840sense.build.vid=0x239A
Expand All @@ -167,9 +167,9 @@ feather52840sense.menu.debug.l3=Level 3 (Segger SystemView)
feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3


# ----------------------------------
# ---------------------------------------------
# Bluefruit ItsyBitsy nRF52840 Express
# ----------------------------------
# ---------------------------------------------
itsybitsy52840.name=Adafruit ItsyBitsy nRF52840 Express

# VID/PID for bootloader with/without UF2, Arduino + Circuitpython App
Expand Down Expand Up @@ -251,7 +251,7 @@ cplaynrf52840.build.board=NRF52840_CIRCUITPLAY
cplaynrf52840.build.core=nRF5
cplaynrf52840.build.variant=circuitplayground_nrf52840
cplaynrf52840.build.usb_manufacturer="Adafruit LLC"
cplaynrf52840.build.usb_product="Adafruit Circuit Playground Bluefruit"
cplaynrf52840.build.usb_product="Circuit Playground Bluefruit"
cplaynrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
cplaynrf52840.build.ldscript=nrf52840_s140_v6.ld
cplaynrf52840.build.vid=0x239A
Expand Down Expand Up @@ -305,7 +305,7 @@ cluenrf52840.build.board=NRF52840_CLUE
cluenrf52840.build.core=nRF5
cluenrf52840.build.variant=clue_nrf52840
cluenrf52840.build.usb_manufacturer="Adafruit LLC"
cluenrf52840.build.usb_product="Adafruit Clue"
cluenrf52840.build.usb_product="CLUE"
cluenrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
cluenrf52840.build.ldscript=nrf52840_s140_v6.ld
cluenrf52840.build.vid=0x239A
Expand Down Expand Up @@ -380,6 +380,16 @@ metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
metro52840.menu.debug.l3=Level 3 (Segger SystemView)
metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3




# -------------------------------------------------------
#
# Boards that aren't made by Adafruit
#
# -------------------------------------------------------


# ----------------------------------
# Nordic nRF52840DK (PCA10056)
# ----------------------------------
Expand Down
12 changes: 8 additions & 4 deletions libraries/BLEAdafruitService/src/BLEAdafruitService.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@
#include "bluefruit_common.h"
#include "BLECharacteristic.h"
#include "BLEService.h"

#include "services/BLEAdafruitSensor.h"
#include "services/BLEAdafruitTemperature.h"

#include "services/BLEAdafruitAccel.h"
#include "services/BLEAdafruitLightSensor.h"
#include "services/BLEAdafruitAddressablePixel.h"
#include "services/BLEAdafruitBaro.h"
#include "services/BLEAdafruitButton.h"
#include "services/BLEAdafruitGyro.h"
#include "services/BLEAdafruitHumid.h"
#include "services/BLEAdafruitLightSensor.h"
#include "services/BLEAdafruitMagnetic.h"
#include "services/BLEAdafruitTemperature.h"
#include "services/BLEAdafruitTone.h"
#include "services/BLEAdafruitAddressablePixel.h"

#endif /* BLEADAFRUITSERVICE_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ err_t BLEAdafruitAccel::begin (void)
_measurement.setFixedLen(4*3);

// Invoke base class begin(), this will add Service, Measurement and Period characteristics
VERIFY_STATUS( BLEAdafruitSensor::begin(1000) );
VERIFY_STATUS( BLEAdafruitSensor::begin(DEFAULT_PERIOD) );

return ERROR_NONE;
}
9 changes: 4 additions & 5 deletions libraries/BLEAdafruitService/src/services/BLEAdafruitAccel.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,18 @@
* THE SOFTWARE.
*/

#ifndef BLEADAFRUITACCEL_H_
#define BLEADAFRUITACCEL_H_
#ifndef BLEADAFRUIT_ACCEL_H_
#define BLEADAFRUIT_ACCEL_H_

class BLEAdafruitAccel : public BLEAdafruitSensor
{
public:
static const uint8_t UUID128_SERVICE[16];
static const uint8_t UUID128_CHR_DATA[16];

BLECharacteristic Accel;
static const int32_t DEFAULT_PERIOD = 1000;

BLEAdafruitAccel(void);
virtual err_t begin(void);
};

#endif /* BLEADAFRUITACCEL_H_ */
#endif /* BLEADAFRUIT_ACCEL_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* THE SOFTWARE.
*/

#ifndef BLEADAFRUITADDRESSABLEPIXEL_H_
#define BLEADAFRUITADDRESSABLEPIXEL_H_
#ifndef BLEADAFRUIT_ADDRESSABLEPIXEL_H_
#define BLEADAFRUIT_ADDRESSABLEPIXEL_H_

#include "Adafruit_NeoPixel.h"

Expand Down Expand Up @@ -54,4 +54,4 @@ class BLEAdafruitAddressablePixel : public BLEService



#endif /* BLEADAFRUITADDRESSABLEPIXEL_H_ */
#endif /* BLEADAFRUIT_ADDRESSABLEPIXEL_H_ */
74 changes: 74 additions & 0 deletions libraries/BLEAdafruitService/src/services/BLEAdafruitBaro.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach (tinyusb.org) for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "BLEAdafruitService.h"

//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+


/* All Adafruit Service/Characteristic UUID128 share the same Base UUID:
* ADAFxxx-C332-42A8-93BD-25E905756CB8
*
* Shared Characteristics
* - Measurement Period 0001 | int32_t | Read + Write |
* ms between measurements, -1: stop reading, 0: update when changes
*
* Barometric service 0800
* - Pressure 0801 | float[3] | Read + Notify | x, y, z
* - Measurement Period 0001
*/

const uint8_t BLEAdafruitBaro::UUID128_SERVICE[16] =
{
0xB8, 0x6c, 0x75, 0x05, 0xE9, 0x25, 0xBD, 0x93,
0xA8, 0x42, 0x32, 0xC3, 0x00, 0x08, 0xAF, 0xAD
};

const uint8_t BLEAdafruitBaro::UUID128_CHR_DATA[16] =
{
0xB8, 0x6c, 0x75, 0x05, 0xE9, 0x25, 0xBD, 0x93,
0xA8, 0x42, 0x32, 0xC3, 0x01, 0x08, 0xAF, 0xAD
};

// Constructor
BLEAdafruitBaro::BLEAdafruitBaro(void)
: BLEAdafruitSensor(UUID128_SERVICE, UUID128_CHR_DATA)
{

}

err_t BLEAdafruitBaro::begin (void)
{
// Setup Measurement Characteristic
_measurement.setProperties(CHR_PROPS_READ | CHR_PROPS_NOTIFY);
_measurement.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);
_measurement.setFixedLen(4);

// Invoke base class begin(), this will add Service, Measurement and Period characteristics
VERIFY_STATUS( BLEAdafruitSensor::begin(DEFAULT_PERIOD) );

return ERROR_NONE;
}
39 changes: 39 additions & 0 deletions libraries/BLEAdafruitService/src/services/BLEAdafruitBaro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach (tinyusb.org) for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef BLEADAFRUIT_BARO_H_
#define BLEADAFRUIT_BARO_H_

class BLEAdafruitBaro : public BLEAdafruitSensor
{
public:
static const uint8_t UUID128_SERVICE[16];
static const uint8_t UUID128_CHR_DATA[16];
static const int32_t DEFAULT_PERIOD = 1000;

BLEAdafruitBaro(void);
virtual err_t begin(void);
};

#endif /* BLEADAFRUIT_BARO_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ err_t BLEAdafruitButton::begin(void)
_measurement.setFixedLen(4);

// Invoke base class begin(), this will add Service, Measurement and Period characteristics
VERIFY_STATUS( BLEAdafruitSensor::begin(100) );
VERIFY_STATUS( BLEAdafruitSensor::begin(DEFAULT_PERIOD) );

return ERROR_NONE;
}
7 changes: 4 additions & 3 deletions libraries/BLEAdafruitService/src/services/BLEAdafruitButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@
* THE SOFTWARE.
*/

#ifndef BLE_ADAFRUIT_BUTTON_H_
#define BLE_ADAFRUIT_BUTTON_H_
#ifndef BLEADAFRUIT_BUTTON_H_
#define BLEADAFRUIT_BUTTON_H_

class BLEAdafruitButton : public BLEAdafruitSensor
{
public:
static const uint8_t UUID128_SERVICE[16];
static const uint8_t UUID128_CHR_DATA[16];
static const int32_t DEFAULT_PERIOD = 100;

BLEAdafruitButton(void);
virtual err_t begin(void);
};

#endif /* BLE_ADAFRUIT_BUTTON_H_ */
#endif /* BLEADAFRUIT_BUTTON_H_ */
74 changes: 74 additions & 0 deletions libraries/BLEAdafruitService/src/services/BLEAdafruitGyro.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach (tinyusb.org) for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "BLEAdafruitService.h"

//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+


/* All Adafruit Service/Characteristic UUID128 share the same Base UUID:
* ADAFxxx-C332-42A8-93BD-25E905756CB8
*
* Shared Characteristics
* - Measurement Period 0001 | int32_t | Read + Write |
* ms between measurements, -1: stop reading, 0: update when changes
*
* Gyroscope service 0400
* - Gyro 0401 | float[3] | Read + Notify | x, y, z
* - Measurement Period 0001
*/

const uint8_t BLEAdafruitGyro::UUID128_SERVICE[16] =
{
0xB8, 0x6c, 0x75, 0x05, 0xE9, 0x25, 0xBD, 0x93,
0xA8, 0x42, 0x32, 0xC3, 0x00, 0x04, 0xAF, 0xAD
};

const uint8_t BLEAdafruitGyro::UUID128_CHR_DATA[16] =
{
0xB8, 0x6c, 0x75, 0x05, 0xE9, 0x25, 0xBD, 0x93,
0xA8, 0x42, 0x32, 0xC3, 0x01, 0x04, 0xAF, 0xAD
};

// Constructor
BLEAdafruitGyro::BLEAdafruitGyro(void)
: BLEAdafruitSensor(UUID128_SERVICE, UUID128_CHR_DATA)
{

}

err_t BLEAdafruitGyro::begin (void)
{
// Setup Measurement Characteristic
_measurement.setProperties(CHR_PROPS_READ | CHR_PROPS_NOTIFY);
_measurement.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);
_measurement.setFixedLen(4*3); // float[3]

// Invoke base class begin(), this will add Service, Measurement and Period characteristics
VERIFY_STATUS( BLEAdafruitSensor::begin(DEFAULT_PERIOD) );

return ERROR_NONE;
}
Loading

0 comments on commit 7b8d3e1

Please sign in to comment.