Flying Silicon Sensor
fsUart.h
Go to the documentation of this file.
1
23#ifndef _FSUART_H_
24#define _FSUART_H_
25
26// Need to know the BLEUart class
27#include <bluefruit.h>
28
30#define FIFO_SZ 128
32#define USE_HM10_UUID
33
34/*
35 * NORDIC UUIDs are defined in BLEUart.h / BLEUart.cpp
36 *
37 * Service: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
38 * RXD : 6E400002-B5A3-F393-E0A9-E50E24DCCA9E
39 * TXD : 6E400003-B5A3-F393-E0A9-E50E24DCCA9E
40 *
41 * const uint8_t BLEUART_UUID_SERVICE[] = {
42 * 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0,
43 * 0x93, 0xF3, 0xA3, 0xB5, 0x01, 0x00, 0x40, 0x6E
44 * };
45 * const uint8_t BLEUART_UUID_CHR_RXD[] = {
46 * 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0,
47 * 0x93, 0xF3, 0xA3, 0xB5, 0x02, 0x00, 0x40, 0x6E
48 * };
49 * const uint8_t BLEUART_UUID_CHR_TXD[] = {
50 * 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0,
51 * 0x93, 0xF3, 0xA3, 0xB5, 0x03, 0x00, 0x40, 0x6E
52 * };
53 */
54
55/*
56 * HM10 UUIDs
57 *
58 * Service: 0000FFE0-0000-1000-8000-00805F9B34FB
59 * RXD : 0000FFE2-0000-1000-8000-00805F9B34FB
60 * TXD : 0000FFE1-0000-1000-8000-00805F9B34FB
61 */
62#ifdef USE_HM10_UUID
63static const uint8_t HM10_UUID_SERVICE[] = {
64 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
65 0x00, 0x10, 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00
66};
67static const uint8_t HM10_UUID_CHR_RXD[] = {
68 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
69 0x00, 0x10, 0x00, 0x00, 0xE2, 0xFF, 0x00, 0x00
70};
71static const uint8_t HM10_UUID_CHR_TXD[] = {
72 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
73 0x00, 0x10, 0x00, 0x00, 0xE1, 0xFF, 0x00, 0x00
74};
75#endif
76
80class FsUart : public BLEUart {
81
82public:
86 FsUart() : BLEUart(FIFO_SZ) {
87#ifdef USE_HM10_UUID
88 setUuid(HM10_UUID_SERVICE);
89 _rxd = BLECharacteristic(HM10_UUID_CHR_RXD);
90 _txd = BLECharacteristic(HM10_UUID_CHR_TXD);
91#else
92 setUuid(BLEUART_UUID_SERVICE);
93 _rxd = BLECharacteristic(BLEUART_UUID_CHR_RXD);
94 _txd = BLECharacteristic(BLEUART_UUID_CHR_TXD);
95#endif
96 };
97};
98
99#endif // _FSUART_H_
FsUart()
Definition fsUart.h:86
static const uint8_t HM10_UUID_CHR_TXD[]
Definition fsUart.h:71
static const uint8_t HM10_UUID_CHR_RXD[]
Definition fsUart.h:67
#define FIFO_SZ
Adafruit UART Tx and Rx FIFO size in bytes.
Definition fsUart.h:30
static const uint8_t HM10_UUID_SERVICE[]
Definition fsUart.h:63