Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HEV - High Energy Ventilator
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
HEV - High Energy Ventilator
Commits
ed4208be
There was an error fetching the commit references. Please try again later.
Commit
ed4208be
authored
4 years ago
by
Peter Švihra
Browse files
Options
Downloads
Patches
Plain Diff
updated spacing, missing pragma pack and corrected wrong copy
constructor
parent
25183947
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arduino/common/lib/CommsControl/CommsCommon.h
+67
-69
67 additions, 69 deletions
arduino/common/lib/CommsControl/CommsCommon.h
arduino/hev_prototype_v1/src/common.h
+1
-1
1 addition, 1 deletion
arduino/hev_prototype_v1/src/common.h
with
68 additions
and
70 deletions
arduino/common/lib/CommsControl/CommsCommon.h
+
67
−
69
View file @
ed4208be
...
@@ -94,40 +94,38 @@ struct readback_data_format {
...
@@ -94,40 +94,38 @@ struct readback_data_format {
};
};
#pragma pack()
#pragma pack()
#pragma pack(1)
struct
cycle_data_format
{
struct
cycle_data_format
{
// per breath values
// per breath values
uint8_t
version
=
HEV_FORMAT_VERSION
;
uint8_t
version
=
HEV_FORMAT_VERSION
;
uint32_t
timestamp
=
0
;
uint32_t
timestamp
=
0
;
float
respiratory_rate
=
0
;
float
respiratory_rate
=
0
;
float
tidal_volume
=
0
;
float
tidal_volume
=
0
;
float
exhaled_tidal_volume
=
0
;
float
exhaled_tidal_volume
=
0
;
float
inhaled_tidal_volume
=
0
;
float
inhaled_tidal_volume
=
0
;
float
minute_volume
=
0
;
float
minute_volume
=
0
;
float
exhaled_minute_volume
=
0
;
float
exhaled_minute_volume
=
0
;
float
inhaled_minute_volume
=
0
;
float
inhaled_minute_volume
=
0
;
float
lung_compliance
=
0
;
float
lung_compliance
=
0
;
float
static_compliance
=
0
;
float
static_compliance
=
0
;
uint16_t
inhalation_pressure
=
0
;
uint16_t
inhalation_pressure
=
0
;
uint16_t
peak_inspiratory_pressure
=
0
;
uint16_t
peak_inspiratory_pressure
=
0
;
uint16_t
plateau_pressure
=
0
;
uint16_t
plateau_pressure
=
0
;
uint16_t
mean_airway_pressure
=
0
;
uint16_t
mean_airway_pressure
=
0
;
uint8_t
fi02_percent
=
0
;
uint8_t
fi02_percent
=
0
;
uint16_t
apnea_index
=
0
;
uint16_t
apnea_index
=
0
;
uint16_t
apnea_time
=
0
;
uint16_t
apnea_time
=
0
;
uint8_t
mandatory_breath
=
0
;
uint8_t
mandatory_breath
=
0
;
};
};
#pragma pack()
#pragma pack(1)
#pragma pack(1)
struct
cmd_format
{
struct
cmd_format
{
...
@@ -167,19 +165,19 @@ public:
...
@@ -167,19 +165,19 @@ public:
Payload
(
PAYLOAD_TYPE
type
=
PAYLOAD_TYPE
::
UNSET
)
{
_type
=
type
;
}
//data_ = nullptr; cmd_ = nullptr; alarm_ = nullptr; }
Payload
(
PAYLOAD_TYPE
type
=
PAYLOAD_TYPE
::
UNSET
)
{
_type
=
type
;
}
//data_ = nullptr; cmd_ = nullptr; alarm_ = nullptr; }
Payload
(
const
Payload
&
other
)
{
Payload
(
const
Payload
&
other
)
{
_type
=
other
.
_type
;
_type
=
other
.
_type
;
memcpy
(
&
_fast_data
,
&
other
.
_fast_data
,
sizeof
(
fast_data_format
));
memcpy
(
&
_fast_data
,
&
other
.
_fast_data
,
sizeof
(
fast_data_format
));
memcpy
(
&
_fast
_data
,
&
other
.
_fast
_data
,
sizeof
(
readback_data_format
));
memcpy
(
&
_readback
_data
,
&
other
.
_readback
_data
,
sizeof
(
readback_data_format
));
memcpy
(
&
_fast_data
,
&
other
.
_fast
_data
,
sizeof
(
cycle_data_format
));
memcpy
(
&
_cycle_data
,
&
other
.
_cycle
_data
,
sizeof
(
cycle_data_format
));
memcpy
(
&
_cmd
,
&
other
.
_cmd
,
sizeof
(
cmd_format
));
memcpy
(
&
_cmd
,
&
other
.
_cmd
,
sizeof
(
cmd_format
));
memcpy
(
&
_alarm
,
&
other
.
_alarm
,
sizeof
(
alarm_format
));
memcpy
(
&
_alarm
,
&
other
.
_alarm
,
sizeof
(
alarm_format
));
}
}
Payload
&
operator
=
(
const
Payload
&
other
)
{
Payload
&
operator
=
(
const
Payload
&
other
)
{
_type
=
other
.
_type
;
_type
=
other
.
_type
;
memcpy
(
&
_fast_data
,
&
other
.
_fast_data
,
sizeof
(
fast_data_format
));
memcpy
(
&
_fast_data
,
&
other
.
_fast_data
,
sizeof
(
fast_data_format
));
memcpy
(
&
_fast
_data
,
&
other
.
_fast
_data
,
sizeof
(
readback_data_format
));
memcpy
(
&
_readback
_data
,
&
other
.
_readback
_data
,
sizeof
(
readback_data_format
));
memcpy
(
&
_fast_data
,
&
other
.
_fast
_data
,
sizeof
(
cycle_data_format
));
memcpy
(
&
_cycle_data
,
&
other
.
_cycle
_data
,
sizeof
(
cycle_data_format
));
memcpy
(
&
_cmd
,
&
other
.
_cmd
,
sizeof
(
cmd_format
));
memcpy
(
&
_cmd
,
&
other
.
_cmd
,
sizeof
(
cmd_format
));
memcpy
(
&
_alarm
,
&
other
.
_alarm
,
sizeof
(
alarm_format
));
memcpy
(
&
_alarm
,
&
other
.
_alarm
,
sizeof
(
alarm_format
));
return
*
this
;
return
*
this
;
}
}
...
@@ -189,25 +187,25 @@ public:
...
@@ -189,25 +187,25 @@ public:
PAYLOAD_TYPE
getType
()
{
return
_type
;
}
PAYLOAD_TYPE
getType
()
{
return
_type
;
}
// requires argument as new struct
// requires argument as new struct
void
setFastData
(
fast_data_format
*
data
)
{
_type
=
PAYLOAD_TYPE
::
FASTDATA
;
memcpy
(
&
_fast_data
,
data
,
sizeof
(
fast_data_format
));
}
void
setFastData
(
fast_data_format
*
data
)
{
_type
=
PAYLOAD_TYPE
::
FASTDATA
;
memcpy
(
&
_fast_data
,
data
,
sizeof
(
fast_data_format
));
}
void
setReadbackData
(
readback_data_format
*
data
)
{
_type
=
PAYLOAD_TYPE
::
READBACKDATA
;
memcpy
(
&
_readback_data
,
data
,
sizeof
(
readback_data_format
));
}
void
setReadbackData
(
readback_data_format
*
data
)
{
_type
=
PAYLOAD_TYPE
::
READBACKDATA
;
memcpy
(
&
_readback_data
,
data
,
sizeof
(
readback_data_format
));
}
void
setCycleData
(
cycle_data_format
*
data
)
{
_type
=
PAYLOAD_TYPE
::
CYCLEDATA
;
memcpy
(
&
_cycle_data
,
data
,
sizeof
(
cycle_data_format
));
}
void
setCycleData
(
cycle_data_format
*
data
)
{
_type
=
PAYLOAD_TYPE
::
CYCLEDATA
;
memcpy
(
&
_cycle_data
,
data
,
sizeof
(
cycle_data_format
));
}
void
setCmd
(
cmd_format
*
cmd
)
{
_type
=
PAYLOAD_TYPE
::
CMD
;
memcpy
(
&
_cmd
,
cmd
,
sizeof
(
cmd_format
));
}
void
setCmd
(
cmd_format
*
cmd
)
{
_type
=
PAYLOAD_TYPE
::
CMD
;
memcpy
(
&
_cmd
,
cmd
,
sizeof
(
cmd_format
));
}
void
setAlarm
(
alarm_format
*
alarm
)
{
_type
=
PAYLOAD_TYPE
::
ALARM
;
memcpy
(
&
_alarm
,
alarm
,
sizeof
(
alarm_format
));
}
void
setAlarm
(
alarm_format
*
alarm
)
{
_type
=
PAYLOAD_TYPE
::
ALARM
;
memcpy
(
&
_alarm
,
alarm
,
sizeof
(
alarm_format
));
}
// get pointers to particular payload types
// get pointers to particular payload types
fast_data_format
*
getFastData
()
{
return
&
_fast_data
;
}
fast_data_format
*
getFastData
()
{
return
&
_fast_data
;
}
readback_data_format
*
getReadbackData
()
{
return
&
_readback_data
;
}
readback_data_format
*
getReadbackData
()
{
return
&
_readback_data
;
}
cycle_data_format
*
getCycleData
()
{
return
&
_cycle_data
;
}
cycle_data_format
*
getCycleData
()
{
return
&
_cycle_data
;
}
cmd_format
*
getCmd
()
{
return
&
_cmd
;
}
cmd_format
*
getCmd
()
{
return
&
_cmd
;
}
alarm_format
*
getAlarm
()
{
return
&
_alarm
;
}
alarm_format
*
getAlarm
()
{
return
&
_alarm
;
}
void
unsetAll
()
{
unsetFastData
();
unsetReadbackData
();
unsetCycleData
();
unsetAlarm
();
unsetCmd
();
_type
=
PAYLOAD_TYPE
::
UNSET
;
}
void
unsetAll
()
{
unsetFastData
();
unsetReadbackData
();
unsetCycleData
();
unsetAlarm
();
unsetCmd
();
_type
=
PAYLOAD_TYPE
::
UNSET
;
}
void
unsetFastData
()
{
memset
(
&
_fast_data
,
0
,
sizeof
(
fast_data_format
));
}
void
unsetFastData
()
{
memset
(
&
_fast_data
,
0
,
sizeof
(
fast_data_format
));
}
void
unsetReadbackData
()
{
memset
(
&
_readback_data
,
0
,
sizeof
(
readback_data_format
));
}
void
unsetReadbackData
(){
memset
(
&
_readback_data
,
0
,
sizeof
(
readback_data_format
));
}
void
unsetCycleData
()
{
memset
(
&
_cycle_data
,
0
,
sizeof
(
cycle_data_format
));
}
void
unsetCycleData
()
{
memset
(
&
_cycle_data
,
0
,
sizeof
(
cycle_data_format
));
}
void
unsetCmd
()
{
memset
(
&
_cmd
,
0
,
sizeof
(
cmd_format
));
}
void
unsetCmd
()
{
memset
(
&
_cmd
,
0
,
sizeof
(
cmd_format
));
}
void
unsetAlarm
()
{
memset
(
&
_alarm
,
0
,
sizeof
(
alarm_format
));
}
void
unsetAlarm
()
{
memset
(
&
_alarm
,
0
,
sizeof
(
alarm_format
));
}
void
setPayload
(
PAYLOAD_TYPE
type
,
void
*
information
)
{
void
setPayload
(
PAYLOAD_TYPE
type
,
void
*
information
)
{
setType
(
type
);
setType
(
type
);
...
@@ -217,19 +215,19 @@ public:
...
@@ -217,19 +215,19 @@ public:
void
setInformation
(
void
*
information
)
{
void
setInformation
(
void
*
information
)
{
switch
(
_type
)
{
switch
(
_type
)
{
case
PAYLOAD_TYPE
::
FASTDATA
:
case
PAYLOAD_TYPE
::
FASTDATA
:
setFastData
(
reinterpret_cast
<
fast_data_format
*>
(
information
));
setFastData
(
reinterpret_cast
<
fast_data_format
*>
(
information
));
break
;
break
;
case
PAYLOAD_TYPE
::
READBACKDATA
:
case
PAYLOAD_TYPE
::
READBACKDATA
:
setReadbackData
(
reinterpret_cast
<
readback_data_format
*>
(
information
));
setReadbackData
(
reinterpret_cast
<
readback_data_format
*>
(
information
));
break
;
break
;
case
PAYLOAD_TYPE
::
CYCLEDATA
:
case
PAYLOAD_TYPE
::
CYCLEDATA
:
setCycleData
(
reinterpret_cast
<
cycle_data_format
*>
(
information
));
setCycleData
(
reinterpret_cast
<
cycle_data_format
*>
(
information
));
break
;
break
;
case
PAYLOAD_TYPE
::
CMD
:
case
PAYLOAD_TYPE
::
CMD
:
setCmd
(
reinterpret_cast
<
cmd_format
*>
(
information
));
setCmd
(
reinterpret_cast
<
cmd_format
*>
(
information
));
break
;
break
;
case
PAYLOAD_TYPE
::
ALARM
:
case
PAYLOAD_TYPE
::
ALARM
:
setAlarm
(
reinterpret_cast
<
alarm_format
*>
(
information
));
setAlarm
(
reinterpret_cast
<
alarm_format
*>
(
information
));
break
;
break
;
default:
default:
break
;
break
;
...
@@ -240,15 +238,15 @@ public:
...
@@ -240,15 +238,15 @@ public:
void
*
getInformation
()
{
void
*
getInformation
()
{
switch
(
_type
)
{
switch
(
_type
)
{
case
PAYLOAD_TYPE
::
FASTDATA
:
case
PAYLOAD_TYPE
::
FASTDATA
:
return
reinterpret_cast
<
void
*>
(
getFastData
());
return
reinterpret_cast
<
void
*>
(
getFastData
());
case
PAYLOAD_TYPE
::
READBACKDATA
:
case
PAYLOAD_TYPE
::
READBACKDATA
:
return
reinterpret_cast
<
void
*>
(
getReadbackData
());
return
reinterpret_cast
<
void
*>
(
getReadbackData
());
case
PAYLOAD_TYPE
::
CYCLEDATA
:
case
PAYLOAD_TYPE
::
CYCLEDATA
:
return
reinterpret_cast
<
void
*>
(
getCycleData
());
return
reinterpret_cast
<
void
*>
(
getCycleData
());
case
PAYLOAD_TYPE
::
CMD
:
case
PAYLOAD_TYPE
::
CMD
:
return
reinterpret_cast
<
void
*>
(
getCmd
());
return
reinterpret_cast
<
void
*>
(
getCmd
());
case
PAYLOAD_TYPE
::
ALARM
:
case
PAYLOAD_TYPE
::
ALARM
:
return
reinterpret_cast
<
void
*>
(
getAlarm
());
return
reinterpret_cast
<
void
*>
(
getAlarm
());
default:
default:
return
nullptr
;
return
nullptr
;
}
}
...
@@ -258,15 +256,15 @@ public:
...
@@ -258,15 +256,15 @@ public:
uint8_t
getSize
()
{
uint8_t
getSize
()
{
switch
(
_type
)
{
switch
(
_type
)
{
case
PAYLOAD_TYPE
::
FASTDATA
:
case
PAYLOAD_TYPE
::
FASTDATA
:
return
static_cast
<
uint8_t
>
(
sizeof
(
fast_data_format
));
return
static_cast
<
uint8_t
>
(
sizeof
(
fast_data_format
));
case
PAYLOAD_TYPE
::
READBACKDATA
:
case
PAYLOAD_TYPE
::
READBACKDATA
:
return
static_cast
<
uint8_t
>
(
sizeof
(
readback_data_format
));
return
static_cast
<
uint8_t
>
(
sizeof
(
readback_data_format
));
case
PAYLOAD_TYPE
::
CYCLEDATA
:
case
PAYLOAD_TYPE
::
CYCLEDATA
:
return
static_cast
<
uint8_t
>
(
sizeof
(
cycle_data_format
));
return
static_cast
<
uint8_t
>
(
sizeof
(
cycle_data_format
));
case
PAYLOAD_TYPE
::
CMD
:
case
PAYLOAD_TYPE
::
CMD
:
return
static_cast
<
uint8_t
>
(
sizeof
(
cmd_format
));
return
static_cast
<
uint8_t
>
(
sizeof
(
cmd_format
));
case
PAYLOAD_TYPE
::
ALARM
:
case
PAYLOAD_TYPE
::
ALARM
:
return
static_cast
<
uint8_t
>
(
sizeof
(
alarm_format
));
return
static_cast
<
uint8_t
>
(
sizeof
(
alarm_format
));
default:
default:
return
0
;
return
0
;
}
}
...
@@ -275,11 +273,11 @@ public:
...
@@ -275,11 +273,11 @@ public:
private
:
private
:
PAYLOAD_TYPE
_type
;
PAYLOAD_TYPE
_type
;
fast_data_format
_fast_data
;
fast_data_format
_fast_data
;
readback_data_format
_readback_data
;
readback_data_format
_readback_data
;
cycle_data_format
_cycle_data
;
cycle_data_format
_cycle_data
;
cmd_format
_cmd
;
cmd_format
_cmd
;
alarm_format
_alarm
;
alarm_format
_alarm
;
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
arduino/hev_prototype_v1/src/common.h
+
1
−
1
View file @
ed4208be
...
@@ -31,7 +31,7 @@ const float MAX_VALVE_FRAC_OPEN = 0.68;
...
@@ -31,7 +31,7 @@ const float MAX_VALVE_FRAC_OPEN = 0.68;
// input params
// input params
enum
CMD_TYPE
:
uint8_t
{
enum
CMD_TYPE
:
uint8_t
{
GENERAL
=
1
,
GENERAL
=
1
,
SET_
TIMESPAN
=
2
,
SET_
DURATION
=
2
,
SET_MODE
=
3
,
SET_MODE
=
3
,
SET_THRESHOLD_MIN
=
4
,
SET_THRESHOLD_MIN
=
4
,
SET_THRESHOLD_MAX
=
5
SET_THRESHOLD_MAX
=
5
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment