Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RemoteIR m3pi mbed-rtos mbed
Diff: LightCommunication.h
- Revision:
- 10:7eaaa891ab81
- Parent:
- 9:8c5229dfab82
--- a/LightCommunication.h Wed May 10 10:01:29 2017 +0200
+++ b/LightCommunication.h Thu May 11 15:27:12 2017 +0200
@@ -10,25 +10,83 @@
#include "rtos.h"
#include "ReceiverIR.h"
-#define OWN_ID 1
+#define OWN_ID 0
+#define SPEED 0.5f //0-1
class LightCommunication {
public:
+
+ /**
+ * Constructor
+ */
LightCommunication();
- virtual ~LightCommunication();
+ /**
+ * Destructor
+ */
+ ~LightCommunication();
+
+ /**
+ * Gets the left value with a calculation done every loop
+ * @return a right value
+ */
+ float getRight(float);
+ /**
+ * Gets the left value with a calculation done every loop
+ * @return a left value
+ */
+ float getLeft(float);
+
+ /**
+ * Receives data via Serial into a buffer
+ * @deprecated using receiveData instead
+ * @param buf
+ */
void getSerial(char * buf);
+
+ /**
+ * Receives data with NEC protocol
+ * @deprecated Not using NEC anymore
+ * @param buf
+ */
void getIRStyle(uint8_t* buf);
+
+ /**
+ *
+ */
void receiveData();
- float toFloat(int8_t);
+
+ /**
+ * @deprecated checked in the controller instead
+ * @return
+ */
+ bool needsToStop();
+
+private:
float right,left;
- bool needsToStop();
- Serial * device;
+
+ /**
+ * Receives the data using NEC protocol
+ * @deprecated Not using this anymore, using serial instead
+ */
ReceiverIR * ir_rx;
+
+ /**
+ * Pointer to a device
+ */
+ Serial * device;
+
+ /**
+ * Pointer to a mutex
+ */
Mutex * mut;
- float getRight(float);
- float getLeft(float);
+
+ /**
+ * Converts a received int8_t to a float (data/100)*speed
+ * @return float value
+ */
+ float toFloat(int8_t data);
};
