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
7c0b901d
Commit
7c0b901d
authored
4 years ago
by
Peter Švihra
Browse files
Options
Downloads
Patches
Plain Diff
updated lib location
parent
8898bf87
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arduino/protocol/platformio.ini
+1
-0
1 addition, 0 deletions
arduino/protocol/platformio.ini
arduino/protocol/platformio.pro
+6
-6
6 additions, 6 deletions
arduino/protocol/platformio.pro
arduino/protocol/src/protocol.cpp
+29
-8
29 additions, 8 deletions
arduino/protocol/src/protocol.cpp
with
36 additions
and
14 deletions
arduino/protocol/platformio.ini
+
1
−
0
View file @
7c0b901d
...
@@ -17,6 +17,7 @@ lib_deps =
...
@@ -17,6 +17,7 @@ lib_deps =
5390
; uCRC16Lib
5390
; uCRC16Lib
5418
; RingBuffer
5418
; RingBuffer
build_flags
=
-fpermissive -I../common/include/
build_flags
=
-fpermissive -I../common/include/
lib_extra_dirs
=
../common/lib
[env:uno]
[env:uno]
platform
=
atmelavr
platform
=
atmelavr
...
...
This diff is collapsed.
Click to expand it.
arduino/protocol/platformio.pro
+
6
−
6
View file @
7c0b901d
...
@@ -6,7 +6,7 @@ else {
...
@@ -6,7 +6,7 @@ else {
}
}
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/include"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/include"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/src"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/src"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/lib/commsControl"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/
../common/
lib/commsControl"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/.pio/libdeps/uno/uCRC16Lib_ID5390/src"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/.pio/libdeps/uno/uCRC16Lib_ID5390/src"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/.pio/libdeps/uno/RingBuffer_ID5418/src"
INCLUDEPATH
+=
"$${_PRO_FILE_PWD_}/.pio/libdeps/uno/RingBuffer_ID5418/src"
INCLUDEPATH
+=
"$${HOMEDIR}/.platformio/packages/framework-arduino-avr/cores/arduino"
INCLUDEPATH
+=
"$${HOMEDIR}/.platformio/packages/framework-arduino-avr/cores/arduino"
...
@@ -31,9 +31,9 @@ DEFINES += "__AVR_ATmega328P__"
...
@@ -31,9 +31,9 @@ DEFINES += "__AVR_ATmega328P__"
OTHER_FILES
+=
platformio
.
ini
OTHER_FILES
+=
platformio
.
ini
SOURCES
+=
src
/
protocol
.
cpp
\
SOURCES
+=
src
/
protocol
.
cpp
\
lib
/
commsControl
/
commsControl
.
cpp
\
..
/
common
/
lib
/
commsControl
/
commsControl
.
cpp
\
lib
/
commsControl
/
commsFormat
.
cpp
..
/
common
/
lib
/
commsControl
/
commsFormat
.
cpp
HEADERS
+=
lib
/
commsControl
/
commsConstants
.
h
\
HEADERS
+=
..
/
common
/
lib
/
commsControl
/
commsConstants
.
h
\
lib
/
commsControl
/
commsControl
.
h
\
..
/
common
/
lib
/
commsControl
/
commsControl
.
h
\
lib
/
commsControl
/
commsFormat
.
h
..
/
common
/
lib
/
commsControl
/
commsFormat
.
h
This diff is collapsed.
Click to expand it.
arduino/protocol/src/protocol.cpp
+
29
−
8
View file @
7c0b901d
...
@@ -21,6 +21,11 @@ bool blue_ = false;
...
@@ -21,6 +21,11 @@ bool blue_ = false;
bool
green_
=
false
;
bool
green_
=
false
;
bool
red_
=
false
;
bool
red_
=
false
;
bool
enabled_
=
false
;
uint32_t
lastTime_
=
0
;
uint32_t
offset_
=
10
;
// dirty function to switch one of the LEDs
// dirty function to switch one of the LEDs
void
switchLED
(
int
led
)
{
void
switchLED
(
int
led
)
{
...
@@ -76,23 +81,40 @@ void loop() {
...
@@ -76,23 +81,40 @@ void loop() {
}
}
previousState_
=
currentState_
;
previousState_
=
currentState_
;
}
}
// switchLED(LED_BLUE);
// counter increase on button press
if
(
enabled_
&
(
millis
()
>
(
lastTime_
+
offset_
)))
// plSend_.getData()->fsm_state += 1;
{
// comms_.writePayload(plSend_);
lastTime_
=
millis
();
plSend_
.
getData
()
->
readback_valve_air_in
=
static_cast
<
uint8_t
>
((
lastTime_
>>
24
)
&
0xFF
);
plSend_
.
getData
()
->
readback_valve_o2_in
=
static_cast
<
uint8_t
>
((
lastTime_
>>
16
)
&
0xFF
);
plSend_
.
getData
()
->
readback_valve_inhale
=
static_cast
<
uint8_t
>
((
lastTime_
>>
8
)
&
0xFF
);
plSend_
.
getData
()
->
readback_valve_exhale
=
static_cast
<
uint8_t
>
((
lastTime_
>>
0
)
&
0xFF
);
switchLED
(
LED_BLUE
);
plSend_
.
setType
(
payloadType
::
payloadData
);
plSend_
.
getData
()
->
fsm_state
+=
1
;
comms_
.
writePayload
(
plSend_
);
}
// per cycle sender
// per cycle sender
comms_
.
sender
();
comms_
.
sender
();
// per cycle receiver
// per cycle receiver
comms_
.
receiver
();
comms_
.
receiver
();
// per cycle data checker - the received entry is automatically removed from the buffer
if
(
comms_
.
readPayload
(
plReceive_
))
{
if
(
comms_
.
readPayload
(
plReceive_
))
{
switch
(
plReceive_
.
getType
())
{
switch
(
plReceive_
.
getType
())
{
case
payloadType
::
payloadCmd
:
case
payloadType
::
payloadCmd
:
switchLED
(
plReceive_
.
getCmd
()
->
cmdCode
);
if
(
plReceive_
.
getCmd
()
->
cmdCode
%
2
==
0
)
{
alarm_
.
alarmCode
=
plReceive_
.
getCmd
()
->
cmdCode
+
1
;
enabled_
=
false
;
}
else
{
enabled_
=
true
;
}
offset_
=
plReceive_
.
getCmd
()
->
param
;
alarm_
.
alarmCode
=
plReceive_
.
getCmd
()
->
cmdCode
;
alarm_
.
param
=
millis
()
&
0xFFFFFFFF
;
plSend_
.
setAlarm
(
&
alarm_
);
plSend_
.
setAlarm
(
&
alarm_
);
comms_
.
writePayload
(
plSend_
);
comms_
.
writePayload
(
plSend_
);
break
;
break
;
...
@@ -102,5 +124,4 @@ void loop() {
...
@@ -102,5 +124,4 @@ void loop() {
plReceive_
.
setType
(
payloadType
::
payloadUnset
);
plReceive_
.
setType
(
payloadType
::
payloadUnset
);
}
}
delay
(
50
);
}
}
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