My Project
Loading...
Searching...
No Matches
BuWizz2Hub.h
Go to the documentation of this file.
1#pragma once
2
3#include <Arduino.h>
4
5#include "BLEHub.h"
6
7#define BUWIZZ2_REMOTECONTROL_SERVICE_UUID "4e050000-74fb-4481-88b3-9919b1676e93"
8#define BUWIZZ2_REMOTECONTROL_CHARACTERISTIC_UUID "000092d1-0000-1000-8000-00805f9b34fb"
9
10#define BUWIZZ2_MIN_SPEED_FORWARD 0
11#define BUWIZZ2_MAX_SPEED_FORWARD 0x7f
12#define BUWIZZ2_MAX_SPEED_REVERSE 0x81
13#define BUWIZZ2_MIN_SPEED_REVERSE 255
14
15const int8_t SET_MOTOR_DATA = 0x10;
16const int8_t SET_POWER_LEVEL = 0x11;
17
18class BuWizz2Hub : public BLEHub
19{
20 public:
22 bool SetWatchdogTimeout(const uint8_t watchdogTimeOutInTensOfSeconds);
23 void DriveTaskLoop();
24 int16_t MapPwrPercToRaw(int pwrPerc);
25 void setPowerLevel(uint8_t newLevel);
27 uint8_t status;
28 uint8_t powerLevel;
29 uint8_t defaultPowerLevel; // will be configuarable
30
38 void NotifyCallback(NimBLERemoteCharacteristic *pBLERemoteCharacteristic, uint8_t *pData, size_t length, bool isNotify);
39
40 private:
41 void parseDeviceSatusMessage(uint8_t *pData, size_t length);
42};
const int8_t SET_POWER_LEVEL
Definition BuWizz2Hub.h:16
const int8_t SET_MOTOR_DATA
Definition BuWizz2Hub.h:15
Definition BLEHubConfiguration.h:46
Definition BLEHub.h:56
Definition BuWizz2Hub.h:19
uint8_t status
Definition BuWizz2Hub.h:27
void setPowerLevel(uint8_t newLevel)
Definition BuWizz2Hub.cpp:239
uint8_t powerLevel
Definition BuWizz2Hub.h:28
int16_t MapPwrPercToRaw(int pwrPerc)
Definition BuWizz2Hub.cpp:153
double batteryVoltage
Definition BuWizz2Hub.h:26
void NotifyCallback(NimBLERemoteCharacteristic *pBLERemoteCharacteristic, uint8_t *pData, size_t length, bool isNotify)
Callback function for notifications of a specific characteristic.
Definition BuWizz2Hub.cpp:171
BuWizz2Hub(BLEHubConfiguration *config)
Definition BuWizz2Hub.cpp:12
void DriveTaskLoop()
Definition BuWizz2Hub.cpp:71
uint8_t defaultPowerLevel
Definition BuWizz2Hub.h:29
bool SetWatchdogTimeout(const uint8_t watchdogTimeOutInTensOfSeconds)
Definition BuWizz2Hub.cpp:21