My Project
Loading...
Searching...
No Matches
PUHub.h
Go to the documentation of this file.
1#pragma once
2
3#include <Arduino.h>
4
5#include "BLEHub.h"
6
7#define PU_REMOTECONTROL_SERVICE_UUID "00001623-1212-efde-1623-785feabcd123"
8#define PU_REMOTECONTROL_CHARACTERISTIC_UUID "00001624-1212-efde-1623-785feabcd123"
9
10#define PU_MIN_SPEED_FORWARD 0
11#define PU_MAX_SPEED_FORWARD 126
12#define PU_MAX_SPEED_REVERSE 128
13#define PU_MIN_SPEED_REVERSE 255
14
15class PUHub : public BLEHub
16{
17 public:
19 bool SetWatchdogTimeout(const uint8_t watchdogTimeOutInTensOfSeconds);
20 void DriveTaskLoop();
21 int16_t MapPwrPercToRaw(int pwrPerc);
22
30 void NotifyCallback(NimBLERemoteCharacteristic *pBLERemoteCharacteristic, uint8_t *pData, size_t length, bool isNotify);
31
32 private:
33 byte _hubLedPort;
34 int errorCount;
35
36 void parseErrorMessage(uint8_t *pData, size_t length);
37 void parsePortAction(uint8_t *pData, size_t length);
38 void parsePortMessage(uint8_t *pData);
39 void setLedColor(HubLedColor color);
40 void setLedHSVColor(int hue, double saturation, double value);
41 void setLedRGBColor(char red, char green, char blue);
42 void writeValue(byte command[], int size);
43};
Definition BLEHubConfiguration.h:46
Definition BLEHub.h:56
Definition PUHub.h:16
PUHub(BLEHubConfiguration *config)
Definition PUHub.cpp:12
void DriveTaskLoop()
Definition PUHub.cpp:37
void NotifyCallback(NimBLERemoteCharacteristic *pBLERemoteCharacteristic, uint8_t *pData, size_t length, bool isNotify)
Callback function for notifications of a specific characteristic.
Definition PUHub.cpp:123
bool SetWatchdogTimeout(const uint8_t watchdogTimeOutInTensOfSeconds)
Definition PUHub.cpp:18
int16_t MapPwrPercToRaw(int pwrPerc)
Definition PUHub.cpp:110
HubLedColor
Definition enums.h:40