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.
Diff: DataControl.cpp
- Revision:
- 1:d37d53d33f0d
- Parent:
- 0:65149aeacbcc
- Child:
- 2:d8bfeadb944e
--- a/DataControl.cpp Tue Aug 23 16:59:41 2022 +0000
+++ b/DataControl.cpp Fri Sep 30 04:30:22 2022 +0000
@@ -8,7 +8,7 @@
}
-//bit cotrol--------------------------------------------------------//
+/*---bit cotrol---*/
void DataControl::dataSeparate(uint16_t data, char* array)
{
@@ -16,7 +16,8 @@
array[1] = (data & 0xFF00) >> 8;
}
-int DataControl::dataCombine(unsigned char *array, int _data_size){
+int DataControl::dataCombine(unsigned char *array, int _data_size)
+{
for(int i=0; i<5; i++) dataBuff[i] = 0;
for(int i=0; i<_data_size; i++) {
dataBuff[i] = array[i];
@@ -25,11 +26,12 @@
return dataBuff[4];
}
-//------------------------------------------------------------------//
+/*---end---*/
-//function to return------------------------------------------------//
+/*---dataSet function---*/
+
void DataControl::dataSet(int data, char *data_array)
{
separated_data_size = sizeof(data); // 4
@@ -43,4 +45,11 @@
separated_data_size = sizeof(data); // 2
dataSeparate(data, data_array);
}
-//------------------------------------------------------------------//
+
+void DataControl::dataSet(char data, char *data_array)
+{
+ separated_data_size = sizeof(data); // 1
+ data_array[0] = data;
+}
+
+/*---end---*/
\ No newline at end of file