Merge pull request #442 from adafruit/clue-play

enhance Clue support
This commit is contained in:
Ha Thach authored and GitHub committed 2020-02-19 20:33:00 +07:00
commit 7b8d3e1f41
32 files changed
+798 -132

No files matched your search

+1 -1
View File
@@ -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
+2 -2
View File
@@ -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
+15 -5
View File
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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)
# ----------------------------------
@@ -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/BLEAdafruitButton.h"
#include "services/BLEAdafruitTone.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"
#endif /* BLEADAFRUITSERVICE_H_ */
@@ -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;
}
@@ -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_ */
@@ -22,8 +22,8 @@
* THE SOFTWARE.
*/
#ifndef BLEADAFRUITADDRESSABLEPIXEL_H_
#define BLEADAFRUITADDRESSABLEPIXEL_H_
#ifndef BLEADAFRUIT_ADDRESSABLEPIXEL_H_
#define BLEADAFRUIT_ADDRESSABLEPIXEL_H_
#include "Adafruit_NeoPixel.h"
@@ -54,4 +54,4 @@ class BLEAdafruitAddressablePixel : public BLEService
#endif /* BLEADAFRUITADDRESSABLEPIXEL_H_ */
#endif /* BLEADAFRUIT_ADDRESSABLEPIXEL_H_ */
@@ -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;
}
@@ -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_ */
@@ -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;
}
@@ -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_ */
@@ -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;
}
@@ -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_GYRO_H_
#define BLEADAFRUIT_GYRO_H_
class BLEAdafruitGyro : 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;
BLEAdafruitGyro(void);
virtual err_t begin(void);
};
#endif /* BLEADAFRUIT_GYRO_H_ */
@@ -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
*
* Humidity service 0700
* - Humid 0701 | float[3] | Read + Notify | x, y, z
* - Measurement Period 0001
*/
const uint8_t BLEAdafruitHumid::UUID128_SERVICE[16] =
{
0xB8, 0x6c, 0x75, 0x05, 0xE9, 0x25, 0xBD, 0x93,
0xA8, 0x42, 0x32, 0xC3, 0x00, 0x07, 0xAF, 0xAD
};
const uint8_t BLEAdafruitHumid::UUID128_CHR_DATA[16] =
{
0xB8, 0x6c, 0x75, 0x05, 0xE9, 0x25, 0xBD, 0x93,
0xA8, 0x42, 0x32, 0xC3, 0x01, 0x07, 0xAF, 0xAD
};
// Constructor
BLEAdafruitHumid::BLEAdafruitHumid(void)
: BLEAdafruitSensor(UUID128_SERVICE, UUID128_CHR_DATA)
{
}
err_t BLEAdafruitHumid::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;
}
@@ -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_HUMID_H_
#define BLEADAFRUIT_HUMID_H_
class BLEAdafruitHumid : 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;
BLEAdafruitHumid(void);
virtual err_t begin(void);
};
#endif /* BLEADAFRUIT_HUMID_H_ */
@@ -68,7 +68,7 @@ err_t BLEAdafruitLightSensor::begin (void)
_measurement.setFixedLen(4);
// 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;
}
@@ -22,19 +22,18 @@
* THE SOFTWARE.
*/
#ifndef BLE_ADAFRUIT_LIGHT_SENSOR_H_
#define BLE_ADAFRUIT_LIGHT_SENSOR_H_
#ifndef BLEADAFRUIT_LIGHT_SENSOR_H_
#define BLEADAFRUIT_LIGHT_SENSOR_H_
class BLEAdafruitLightSensor : public BLEAdafruitSensor
{
public:
static const uint8_t UUID128_SERVICE[16];
static const uint8_t UUID128_CHR_DATA[16];
BLECharacteristic Lux;
static const int32_t DEFAULT_PERIOD = 1000;
BLEAdafruitLightSensor(void);
virtual err_t begin(void);
};
#endif /* BLE_ADAFRUIT_LIGHT_SENSOR_H_ */
#endif /* BLEADAFRUIT_LIGHT_SENSOR_H_ */
@@ -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
*
* Magnetic service 0500
* - Magnetic 0501 | float[3] | Read + Notify | x, y, z
* - Measurement Period 0001
*/
const uint8_t BLEAdafruitMagnetic::UUID128_SERVICE[16] =
{
0xB8, 0x6c, 0x75, 0x05, 0xE9, 0x25, 0xBD, 0x93,
0xA8, 0x42, 0x32, 0xC3, 0x00, 0x05, 0xAF, 0xAD
};
const uint8_t BLEAdafruitMagnetic::UUID128_CHR_DATA[16] =
{
0xB8, 0x6c, 0x75, 0x05, 0xE9, 0x25, 0xBD, 0x93,
0xA8, 0x42, 0x32, 0xC3, 0x01, 0x05, 0xAF, 0xAD
};
// Constructor
BLEAdafruitMagnetic::BLEAdafruitMagnetic(void)
: BLEAdafruitSensor(UUID128_SERVICE, UUID128_CHR_DATA)
{
}
err_t BLEAdafruitMagnetic::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;
}
@@ -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_MAGNETIC_H_
#define BLEADAFRUIT_MAGNETIC_H_
class BLEAdafruitMagnetic : 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;
BLEAdafruitMagnetic(void);
virtual err_t begin(void);
};
#endif /* BLEADAFRUIT_MAGNETIC_H_ */
@@ -22,8 +22,8 @@
* THE SOFTWARE.
*/
#ifndef BLE_ADAFRUIT_SENSOR_H_
#define BLE_ADAFRUIT_SENSOR_H_
#ifndef BLEADAFRUIT_SENSOR_H_
#define BLEADAFRUIT_SENSOR_H_
class BLEAdafruitSensor : public BLEService
{
@@ -54,4 +54,4 @@ class BLEAdafruitSensor : public BLEService
static void sensor_data_cccd_cb(uint16_t conn_hdl, BLECharacteristic* chr, uint16_t value);
};
#endif /* BLE_ADAFRUIT_SENSOR_H_ */
#endif /* BLEADAFRUIT_SENSOR_H_ */
@@ -67,7 +67,7 @@ err_t BLEAdafruitTemperature::begin (void)
_measurement.setFixedLen(4);
// 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;
}
@@ -22,17 +22,18 @@
* THE SOFTWARE.
*/
#ifndef BLEADAFRUITTEMPERATURE_H_
#define BLEADAFRUITTEMPERATURE_H_
#ifndef BLEADAFRUIT_TEMPERATURE_H_
#define BLEADAFRUIT_TEMPERATURE_H_
class BLEAdafruitTemperature : 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;
BLEAdafruitTemperature();
virtual err_t begin(void);
};
#endif /* BLEADAFRUITTEMPERATURE_H_ */
#endif /* BLEADAFRUIT_TEMPERATURE_H_ */
@@ -22,8 +22,8 @@
* THE SOFTWARE.
*/
#ifndef BLEADAFRUITTONE_H_
#define BLEADAFRUITTONE_H_
#ifndef BLEADAFRUIT_TONE_H_
#define BLEADAFRUIT_TONE_H_
class BLEAdafruitTone : public BLEService
{
@@ -41,4 +41,4 @@ class BLEAdafruitTone : public BLEService
static void tone_write_cb(uint16_t conn_hdl, BLECharacteristic* chr, uint8_t* data, uint16_t len);
};
#endif /* BLEADAFRUITTONE_H_ */
#endif /* BLEADAFRUIT_TONE_H_ */
@@ -11,11 +11,18 @@
All text above, and the splash screen below must be included in
any redistribution
*********************************************************************/
/* This sketch demonstrate the BLE Adafruit Service that is used with
* "Adafruit Bluefruit Playground" app. Supported boards are
* - Circuit Playground Bluefruit : https://www.adafruit.com/product/4333
* - CLUE nRF52840 : https://www.adafruit.com/product/4500
* - Feather Sense : https://www.adafruit.com/product/4516
*/
#include <Adafruit_LittleFS.h>
#include <InternalFileSystem.h>
#include <bluefruit.h>
#include <BLEAdafruitService.h>
#include <Adafruit_CircuitPlayground.h>
// BLE Service
BLEDfu bledfu; // OTA DFU service
@@ -32,7 +39,49 @@ BLEAdafruitTone bleTone;
BLEAdafruitAddressablePixel blePixel;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(10, CPLAY_NEOPIXELPIN, NEO_GRB + NEO_KHZ800);
//------------- Circuit Playground Bluefruit -------------//
#if defined(ARDUINO_NRF52840_CIRCUITPLAY)
#include <Adafruit_CircuitPlayground.h>
#define DEVICE_NAME "CPlay"
#define NEOPIXEL_COUNT 10
uint16_t measure_temperature(uint8_t* buf, uint16_t bufsize)
{
float temp = CircuitPlayground.temperature();
memcpy(buf, &temp, 4);
return 4;
}
uint16_t measure_accel(uint8_t* buf, uint16_t bufsize)
{
float* accel_buf = (float*) buf;
accel_buf[0] = CircuitPlayground.motionX();
accel_buf[1] = CircuitPlayground.motionY();
accel_buf[2] = CircuitPlayground.motionZ();
return 3*sizeof(float); // 12
}
uint16_t measure_light(uint8_t* buf, uint16_t bufsize)
{
float lux;
lux = CircuitPlayground.lightSensor();
memcpy(buf, &lux, 4);
return 4;
}
uint16_t measure_gyro(uint8_t* buf, uint16_t bufsize)
{
}
uint16_t measure_magnetic(uint8_t* buf, uint16_t bufsize)
{
}
uint16_t measure_button(uint8_t* buf, uint16_t bufsize)
{
@@ -46,41 +95,164 @@ uint16_t measure_button(uint8_t* buf, uint16_t bufsize)
return 4;
}
//------------- CLUE & Feather Sense -------------//
#elif defined(ARDUINO_NRF52840_CLUE) || defined(ARDUINO_NRF52840_FEATHER_SENSE)
#include <Adafruit_APDS9960.h>
#include <Adafruit_LSM6DS33.h>
#include <Adafruit_LIS3MDL.h>
#include <Adafruit_BMP280.h>
#include <Adafruit_SHT31.h>
#if defined(ARDUINO_NRF52840_CLUE)
#define DEVICE_NAME "CLUE"
#else
#define DEVICE_NAME "Sense"
#endif
#define NEOPIXEL_COUNT 1
BLEAdafruitGyro bleGyro;
BLEAdafruitMagnetic bleMagnetic;
BLEAdafruitHumid bleHumid;
BLEAdafruitBaro bleBaro;
Adafruit_APDS9960 apds9960; // Proximity, Light, Gesture, Color
Adafruit_LSM6DS33 lsm6ds33; // Gyro and Accel
Adafruit_LIS3MDL lis3mdl; // Magnetometer
Adafruit_BMP280 bmp280; // Temperature, Barometric
Adafruit_SHT31 sht30; // Humid
uint16_t measure_temperature(uint8_t* buf, uint16_t bufsize)
{
float temp = CircuitPlayground.temperature();
float temp = bmp280.readTemperature();
memcpy(buf, &temp, 4);
return 4;
}
uint16_t measure_light_sensor(uint8_t* buf, uint16_t bufsize)
{
float lux = CircuitPlayground.lightSensor();
uint16_t measure_accel(uint8_t* buf, uint16_t bufsize)
{
float* float_buf = (float*) buf;
sensors_event_t accel, gyro, temp;
(void) gyro; (void) temp;
lsm6ds33.getEvent(&accel, &gyro, &temp);
float_buf[0] = accel.acceleration.x;
float_buf[1] = accel.acceleration.y;
float_buf[2] = accel.acceleration.z;
return 12;
}
uint16_t measure_light(uint8_t* buf, uint16_t bufsize)
{
float lux;
uint16_t r, g, b, c;
apds9960.getColorData(&r, &g, &b, &c);
lux = c;
memcpy(buf, &lux, 4);
return 4;
}
uint16_t measure_accel(uint8_t* buf, uint16_t bufsize)
{
float accel[3];
accel[0] = CircuitPlayground.motionX();
accel[1] = CircuitPlayground.motionY();
accel[2] = CircuitPlayground.motionZ();
uint16_t measure_gyro(uint8_t* buf, uint16_t bufsize)
{
float* float_buf = (float*) buf;
memcpy(buf, accel, sizeof(accel));
return sizeof(accel);
sensors_event_t accel, gyro, temp;
(void) accel; (void) temp;
lsm6ds33.getEvent(&accel, &gyro, &temp);
float_buf[0] = gyro.gyro.x;
float_buf[1] = gyro.gyro.y;
float_buf[2] = gyro.gyro.z;
return 12;
}
uint16_t measure_magnetic(uint8_t* buf, uint16_t bufsize)
{
float* float_buf = (float*) buf;
sensors_event_t mag;
lis3mdl.getEvent(&mag);
float_buf[0] = mag.magnetic.x;
float_buf[1] = mag.magnetic.y;
float_buf[2] = mag.magnetic.z;
return 12;
}
uint16_t measure_button(uint8_t* buf, uint16_t bufsize)
{
// Button is active LOW on most board except CPlay
// No slide switch
uint32_t button = 0;
button |= ( digitalRead(PIN_BUTTON1) ? 0x00 : 0x02 );
button |= ( digitalRead(PIN_BUTTON2) ? 0x00 : 0x04 );
memcpy(buf, &button, 4);
return 4;
}
uint16_t measure_humid(uint8_t* buf, uint16_t bufsize)
{
float humid = sht30.readHumidity();
memcpy(buf, &humid, 4);
return 4;
}
uint16_t measure_baro(uint8_t* buf, uint16_t bufsize)
{
float baro = bmp280.readPressure()/100;
memcpy(buf, &baro, 4);
return 4;
}
#else
#error "Board is not supported"
#endif
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NEOPIXEL_COUNT, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
//------------- Setup -------------//
void setup()
{
Serial.begin(115200);
//while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 BLEUART Example");
Serial.println("---------------------------\n");
#if defined ARDUINO_NRF52840_CIRCUITPLAY
CircuitPlayground.begin();
#else
// Button
pinMode(PIN_BUTTON1, INPUT_PULLUP);
pinMode(PIN_BUTTON2, INPUT_PULLUP);
// Buzzer Speaker
pinMode(PIN_BUZZER, OUTPUT);
apds9960.begin();
apds9960.enableColor(true);
lsm6ds33.begin_I2C();
bmp280.begin();
lis3mdl.begin_I2C();
sht30.begin(0x44);
#endif
Serial.begin(115200);
// while(!Serial) delay(10); // wait for native USB
Serial.println("Bluefruit Playground Example");
Serial.println("---------------------------\n");
// Setup the BLE LED to be enabled on CONNECT
// Note: This is actually the default behaviour, but provided
// here in case you want to control this LED manually via PIN 19
@@ -92,8 +264,8 @@ void setup()
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");
Bluefruit.setTxPower(8); // Check bluefruit.h for supported values
Bluefruit.setName(DEVICE_NAME);
//Bluefruit.setName(getMcuUniqueID()); // useful testing with multiple central connections
Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
@@ -103,7 +275,6 @@ void setup()
// Configure and Start Device Information Service
bledis.setManufacturer("Adafruit Industries");
bledis.setModel("Bluefruit Feather52");
bledis.begin();
// Configure and Start BLE Uart Service
@@ -121,17 +292,32 @@ void setup()
bleAccel.setMeasureCallback(measure_accel);
bleLight.begin();
bleLight.setMeasureCallback(measure_light_sensor);
bleLight.setMeasureCallback(measure_light);
bleButton.begin();
bleButton.setMeasureCallback(measure_button);
bleButton.setPeriod(0); // only notify if there is changes with buttons
bleTone.begin(CPLAY_BUZZER);
bleTone.begin(PIN_BUZZER);
strip.begin();
blePixel.begin(&strip);
// CPB doesn't support these on-board sensor
#ifndef ARDUINO_NRF52840_CIRCUITPLAY
bleGyro.begin();
bleGyro.setMeasureCallback(measure_gyro);
bleMagnetic.begin();
bleMagnetic.setMeasureCallback(measure_magnetic);
bleHumid.begin();
bleHumid.setMeasureCallback(measure_humid);
bleBaro.begin();
bleBaro.setMeasureCallback(measure_baro);
#endif
// Set up and start advertising
startAdv();
@@ -160,9 +346,8 @@ void startAdv(void)
Bluefruit.Advertising.addManufacturerData(&mfr_adv, sizeof(mfr_adv));
// Secondary Scan Response packet (optional)
// Since there is no room for 'Name' in Advertising packet
Bluefruit.ScanResponse.addName();
// Add name to advertising, since there is enough room
Bluefruit.Advertising.addName();
/* Start Advertising
* - Enable auto advertising if disconnected
@@ -18,53 +18,54 @@
/* This sketch demonstrates the "Image Upload" feature of Bluefruit Mobile App.
* Following TFT Display are supported
* - https://www.adafruit.com/product/3315
* - https://www.adafruit.com/product/3651
* - https://www.adafruit.com/product/4367
* - TFT 3.5" : FeatherWing https://www.adafruit.com/product/3651
* - TFT 2.4" : FeatherWing https://www.adafruit.com/product/3315
* - TFT Gizmo : https://www.adafruit.com/product/4367
* - Adafruit CLUE : https://www.adafruit.com/product/4500
*/
#define TFT_35_FEATHERWING 1
#define TFT_24_FEATHERWING 2
#define TFT_GIZMO 3
// [Configurable] Please select one of above supported Display to match your hardware setup
#define TFT_IN_USE TFT_35_FEATHERWING
#if defined(ARDUINO_NRF52832_FEATHER)
// Feather nRF52832
#define TFT_DC 11
#define TFT_CS 31
#elif defined(ARDUINO_NRF52840_CIRCUITPLAY)
// Circuit Playground Bluefruit for use with TFT 1.5" GIZMO
#define TFT_DC 1
#define TFT_CS 0
#if defined(ARDUINO_NRF52840_CIRCUITPLAY)
// Circuit Playground Bluefruit use with TFT GIZMO
#define TFT_BACKLIGHT A3
#else
// Default for others
#define TFT_DC 10
#define TFT_CS 9
#endif
#if TFT_IN_USE == TFT_35_FEATHERWING
#include "Adafruit_HX8357.h"
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC);
#elif TFT_IN_USE == TFT_24_FEATHERWING
#include <Adafruit_ILI9341.h>
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
#elif TFT_IN_USE == TFT_GIZMO
#include "Adafruit_ST7789.h"
Adafruit_ST7789 tft = Adafruit_ST7789(&SPI, TFT_CS, TFT_DC, -1);
#else
#error "TFT display is not supported"
#endif
Adafruit_ST7789 tft = Adafruit_ST7789(&SPI, 0, 1, -1); // CS = 0, DC = 1
#elif defined(ARDUINO_NRF52840_CLUE)
// CLUE use on-board TFT
#include "Adafruit_ST7789.h"
Adafruit_ST7789 tft = Adafruit_ST7789(&SPI1, 31, 32, 33); // CS = 31, DC = 32, RST = 33
#else
#define TFT_35_FEATHERWING 1
#define TFT_24_FEATHERWING 2
// [Configurable] For other boards please select which external display to match your hardware setup
#define TFT_IN_USE TFT_35_FEATHERWING
#if defined(ARDUINO_NRF52832_FEATHER)
// Feather nRF52832 pin map is different from others
#define TFT_DC 11
#define TFT_CS 31
#else
// Default for others
#define TFT_DC 10
#define TFT_CS 9
#endif // 832
#if TFT_IN_USE == TFT_35_FEATHERWING
#include "Adafruit_HX8357.h"
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC);
#elif TFT_IN_USE == TFT_24_FEATHERWING
#include <Adafruit_ILI9341.h>
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
#else
#error "TFT display is not supported"
#endif // TFT
#endif // board variants
// Universal color
#define COLOR_WHITE 0xFFFF
#define COLOR_BLACK 0x0000
#define COLOR_YELLOW 0xFFE0
@@ -110,11 +111,22 @@ void setup()
{
Serial.begin(115200);
#if TFT_IN_USE == TFT_GIZMO
#if defined(ARDUINO_NRF52840_CIRCUITPLAY)
tft.init(240, 240);
tft.setRotation(2);
pinMode(TFT_BACKLIGHT, OUTPUT);
digitalWrite(TFT_BACKLIGHT, HIGH); // Backlight on
// turn backlight on
uint8_t backlight = A3;
pinMode(backlight, OUTPUT);
digitalWrite(backlight, HIGH);
#elif defined(ARDUINO_NRF52840_CLUE)
tft.init(240, 240);
tft.setRotation(1);
// Screen refresh rate control (datasheet 9.2.18, FRCTRL2)
uint8_t rtna = 0x01;
tft.sendCommand(0xC6, &rtna, 1);;
#else
tft.begin();
+1 -9
View File
@@ -122,10 +122,7 @@ static void nrf_error_cb(uint32_t id, uint32_t pc, uint32_t info)
LOG_LV1("SD Err", "assert at %s : %d", assert_info->p_file_name, assert_info->line_num);
}
while(1)
{
yield();
}
while(1) yield();
#endif
}
@@ -189,11 +186,6 @@ AdafruitBluefruit::AdafruitBluefruit(void)
.kdist_own = { .enc = 1, .id = 1},
.kdist_peer = { .enc = 1, .id = 1},
});
COMMENT_OUT(
_auth_type = BLE_GAP_AUTH_KEY_TYPE_NONE;
varclr(_pin);
)
}
void AdafruitBluefruit::configServiceChanged(bool changed)
+6 -1
View File
@@ -36,7 +36,12 @@
#define BLE_GATT_ATT_MTU_MAX 247
#define BLE_MAX_CONNECTION 20 // SD support up to 20 connections
#define CFG_SD_ATTR_TABLE_SIZE 0xC00
// Allocate more memory for GATT table for 840
#ifdef NRF52840_XXAA
#define CFG_SD_ATTR_TABLE_SIZE 0x1000
#else
#define CFG_SD_ATTR_TABLE_SIZE 0xC00
#endif
#include "BLEUuid.h"
#include "BLEAdvertising.h"
@@ -43,10 +43,10 @@ BLEDis::BLEDis(void)
memclr(_strarr, sizeof(_strarr));
memclr(_strarr_length, sizeof(_strarr_length));
#ifdef NRF52840_XXAA
this->setModel("Bluefruit Feather nRF52840");
#ifdef USB_PRODUCT
this->setModel(USB_PRODUCT);
#else
this->setModel("Bluefruit Feather nRF52832");
this->setModel("Feather nRF52832");
#endif
this->setSoftwareRev(ARDUINO_BSP_VERSION);
@@ -54,14 +54,17 @@ extern "C"
#define LED_STATE_ON 1 // State when LED is litted
// Buttons
#define PIN_BUTTON1 (4)
#define PIN_BUTTON2 (5)
#define PIN_BUTTON1 (4) // Button A (Left)
#define PIN_BUTTON2 (5) // Button B (Right)
// Microphone
#define PIN_PDM_DIN 24
#define PIN_PDM_CLK 25
#define PIN_PDM_PWR -1 // not used
// Buzzer
#define PIN_BUZZER 12
/*
* Analog pins
*/
+5 -2
View File
@@ -52,14 +52,17 @@ extern "C"
#define LED_STATE_ON 1 // State when LED is litted
// Buttons
#define PIN_BUTTON1 (5)
#define PIN_BUTTON2 (11)
#define PIN_BUTTON1 (5) // Button A
#define PIN_BUTTON2 (11) // Button B
// Microphone
#define PIN_PDM_DIN 35
#define PIN_PDM_CLK 36
#define PIN_PDM_PWR -1 // not used
// Buzzer
#define PIN_BUZZER 46
/*
* Analog pins
*/