From 37b9bbb115e4fe7a9ed28d5dd519513aedf971fe Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 8 Sep 2017 11:47:42 +0200 Subject: [PATCH] Update Demo_uPy_WithC to pass int and float to MicroPython code. --- Demo_uPy_WithC/InterfaceView.aadl | 15 +++++++++++++++ Demo_uPy_WithC/InterfaceView.md5 | 2 +- Demo_uPy_WithC/gnd/gnd.c | 14 ++++++++++---- Demo_uPy_WithC/gnd/gnd.h | 4 +++- Demo_uPy_WithC/payload/payload.py | 6 ++++-- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Demo_uPy_WithC/InterfaceView.aadl b/Demo_uPy_WithC/InterfaceView.aadl index c62be1f..2a4e2a1 100644 --- a/Demo_uPy_WithC/InterfaceView.aadl +++ b/Demo_uPy_WithC/InterfaceView.aadl @@ -24,6 +24,8 @@ FEATURES a : IN PARAMETER DataView::MyBool { Taste::encoding => NATIVE; }; +PROPERTIES + Taste::Associated_Queue_Size => 1; END PI_TM; SUBPROGRAM IMPLEMENTATION PI_TM.others @@ -34,6 +36,12 @@ FEATURES a : IN PARAMETER DataView::MyBool { Taste::encoding => NATIVE; }; + b : IN PARAMETER DataView::MyInteger { + Taste::encoding => NATIVE; + }; + c : IN PARAMETER DataView::MyReal { + Taste::encoding => NATIVE; + }; END RI_TC; SUBPROGRAM IMPLEMENTATION RI_TC.others @@ -52,6 +60,12 @@ FEATURES a : IN PARAMETER DataView::MyBool { Taste::encoding => NATIVE; }; + b : IN PARAMETER DataView::MyInteger { + Taste::encoding => NATIVE; + }; + c : IN PARAMETER DataView::MyReal { + Taste::encoding => NATIVE; + }; END PI_TC; SUBPROGRAM IMPLEMENTATION PI_TC.others @@ -90,6 +104,7 @@ FEATURES PI_TM : PROVIDES SUBPROGRAM ACCESS interfaceview::FV::GND::PI_TM.others { Taste::coordinates => "1246 1185"; Taste::RCMoperationKind => unprotected; + Taste::RCMperiod => 0 ms; Taste::Deadline => 0 ms; Taste::InterfaceName => "TM"; }; diff --git a/Demo_uPy_WithC/InterfaceView.md5 b/Demo_uPy_WithC/InterfaceView.md5 index 1b675e5..e6551b5 100644 --- a/Demo_uPy_WithC/InterfaceView.md5 +++ b/Demo_uPy_WithC/InterfaceView.md5 @@ -1 +1 @@ -44a97ceb63adbe8df866dd3740da7d6f InterfaceView.aadl +b468036a71fbc1a1e19c30c44c0f055b InterfaceView.aadl diff --git a/Demo_uPy_WithC/gnd/gnd.c b/Demo_uPy_WithC/gnd/gnd.c index 64fd033..c1628da 100644 --- a/Demo_uPy_WithC/gnd/gnd.c +++ b/Demo_uPy_WithC/gnd/gnd.c @@ -3,22 +3,28 @@ #include #include "gnd.h" -static asn1SccMyBool state; +static asn1SccMyBool stateBool; +static asn1SccMyInteger stateInt; +static asn1SccMyReal stateReal; void gnd_startup() { /* Write your initialization code here, but do not make any call to a required interface. */ printf("gnd_startup\n"); - state = false; + stateBool = false; + stateInt = 42; + stateReal = 1.23; } void gnd_PI_CYCLE() { /* Write your code here! */ printf("gnd_PI_CYCLE --->\n"); - gnd_RI_TC(&state); - state = !state; + gnd_RI_TC(&stateBool, &stateInt, &stateReal); + stateBool = !stateBool; + stateInt = 45 - stateInt; + stateReal = 1.0 / stateReal; } void gnd_PI_TM(const asn1SccMyBool *IN_a) diff --git a/Demo_uPy_WithC/gnd/gnd.h b/Demo_uPy_WithC/gnd/gnd.h index 20ad521..4472a1c 100644 --- a/Demo_uPy_WithC/gnd/gnd.h +++ b/Demo_uPy_WithC/gnd/gnd.h @@ -17,7 +17,9 @@ void gnd_PI_CYCLE(); void gnd_PI_TM(const asn1SccMyBool *); -extern void gnd_RI_TC(const asn1SccMyBool *); +extern void gnd_RI_TC(const asn1SccMyBool *, + const asn1SccMyInteger *, + const asn1SccMyReal *); #ifdef __cplusplus } diff --git a/Demo_uPy_WithC/payload/payload.py b/Demo_uPy_WithC/payload/payload.py index 7efc003..38f5022 100644 --- a/Demo_uPy_WithC/payload/payload.py +++ b/Demo_uPy_WithC/payload/payload.py @@ -11,8 +11,10 @@ def payload_startup(): print('payload_startup') micropython.heap_lock() -def payload_PI_TC(IN_a): +def payload_PI_TC(IN_a, + IN_b, + IN_c): # Write your code here! - print(' payload_PI_TC', IN_a) + print(' payload_PI_TC', IN_a, IN_b, IN_c) print(' <--/') payload_RI_TM(not IN_a) -- GitLab