Skip to content

Commit

Permalink
nRF52: use of 16-bit HM-10 BLE UUIDs [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed May 15, 2023
1 parent 657f038 commit 6bdef45
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Binary file modified documents/images/skyview-44.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions software/firmware/source/SkyView/Platform_RP2040.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static union {
#include "uCDB.hpp"
#include "JSONHelper.h"

Adafruit_INA219 ina219;
Adafruit_INA219 ina219(INA219_ADDRESS_ALT);

#if !defined(ARDUINO_ARCH_MBED)
Adafruit_FlashTransport_RP2040 HWFlashTransport;
Expand Down Expand Up @@ -262,7 +262,7 @@ static void RP2040_setup()
Wire1.setSCL(SOC_GPIO_PIN_SCL);
Wire1.setSDA(SOC_GPIO_PIN_SDA);
Wire1.begin();
Wire1.beginTransmission(INA219_ADDRESS);
Wire1.beginTransmission(INA219_ADDRESS_ALT);
RP2040_has_CPM = (Wire1.endTransmission() == 0);
Wire1.end();

Expand Down
2 changes: 2 additions & 0 deletions software/firmware/source/SkyView/Platform_RP2040.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ enum RP2040_board_id {
#define SOC_GPIO_PIN_SDA (6u)
#define SOC_GPIO_PIN_SCL (7u)

#define INA219_ADDRESS_ALT (0x43) // 1000011 (A0=SCL, A1=GND)

/* Waveshare Pico keys mapping */
#define SOC_GPIO_PIN_KEY0 (15u)
#define SOC_GPIO_PIN_KEY1 (17u)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,24 @@
/* UART Serivce: 0000ffe0-0000-1000-8000-00805f9b34fb
* UART RW : 0000ffe1-0000-1000-8000-00805f9b34fb
*/
static const uint16_t BLEUART_HM10_UUID16_SERVICE = 0xFFE0;
static const uint16_t BLEUART_HM10_UUID16_CHR_RW = 0xFFE1;

const uint8_t BLEUART_HM10_UUID_SERVICE[] =
static const uint8_t BLEUART_HM10_UUID128_SERVICE[] =
{
0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x10, 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00,
};

const uint8_t BLEUART_HM10_UUID_CHR_RW[] =
static const uint8_t BLEUART_HM10_UUID128_CHR_RW[] =
{
0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x10, 0x00, 0x00, 0xE1, 0xFF, 0x00, 0x00,
};

// Constructor
BLEUart_HM10::BLEUart_HM10(uint16_t rx_fifo_depth, uint16_t tx_fifo_depth)
: BLEService(BLEUART_HM10_UUID_SERVICE), _rtxd(BLEUART_HM10_UUID_CHR_RW)
: BLEService(BLEUART_HM10_UUID16_SERVICE), _rtxd(BLEUART_HM10_UUID16_CHR_RW)
{
_rx_fifo = NULL;
_rx_fifo_depth = rx_fifo_depth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@

#define BLE_MAX_WRITE_CHUNK_SIZE 20

extern const uint8_t BLEUART_HM10_UUID_SERVICE[];
extern const uint8_t BLEUART_HM10_UUID_CHR_RW[];

class BLEUart_HM10 : public BLEService, public Stream
{
public:
Expand Down

0 comments on commit 6bdef45

Please sign in to comment.