shithub: heymac-node

ref: ad1df2d2a01bd064e643287ff305673dfede3ce3
dir: /SX127xHsm.qm/

View raw version
<?xml version="1.0" encoding="UTF-8"?>
<model version="5.2.5" links="0">
 <framework name="qpc"/>
 <package name="net.frst.heymac" stereotype="0x02">
  <class name="SX127x" superclass="qpc::QHsm">
   <documentation>// HSM for SX127x LoRa Phy layer</documentation>
   <attribute name="timeEvt" type="QTimeEvt" visibility="0x02" properties="0x00"/>
   <attribute name="actionQueue" type="QEQueue" visibility="0x00" properties="0x00"/>
   <statechart properties="0x01">
    <initial target="../1">
     <action>QTimeEvt_armX(&amp;me-&gt;timeEvt, BSP_TICKS_PER_SEC/2, BSP_TICKS_PER_SEC/2);</action>
     <initial_glyph conn="26,6,5,0,4,6">
      <action box="0,-2,10,2"/>
     </initial_glyph>
    </initial>
    <state name="_initializing">
     <entry brief="tmout_evt.post_in(0.0)"/>
     <tran trig="_PHY_TMOUT">
      <choice target="../../../2">
       <guard brief="sx127x.open()">true</guard>
       <choice_glyph conn="36,20,4,0,8">
        <action box="-11,4,13,2"/>
       </choice_glyph>
      </choice>
      <tran_glyph conn="20,20,3,-1,16">
       <action box="0,-2,20,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="20,12,20,10">
      <entry box="1,2,19,2"/>
     </state_glyph>
    </state>
    <state name="_scheduling">
     <entry brief="post_in(delay)"/>
     <tran trig="_PHY_TMOUT">
      <choice target="../../../3">
       <guard>true</guard>
       <choice_glyph conn="36,40,5,3,6,-8,2">
        <action box="1,0,10,2"/>
       </choice_glyph>
      </choice>
      <choice target="../../../4/2">
       <guard>true</guard>
       <choice_glyph conn="36,40,4,0,6,18,8">
        <action box="1,0,10,2"/>
       </choice_glyph>
      </choice>
      <choice target="../../../4/3">
       <guard>true</guard>
       <choice_glyph conn="36,40,5,0,-10,14">
        <action box="1,0,10,2"/>
       </choice_glyph>
      </choice>
      <tran_glyph conn="20,36,3,-1,16,4">
       <action box="0,-2,10,2"/>
      </tran_glyph>
     </tran>
     <tran trig="_PHY_RQST">
      <tran_glyph conn="20,38,3,-1,12">
       <action box="0,-2,10,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="20,28,20,16">
      <entry box="1,2,18,2"/>
     </state_glyph>
    </state>
    <state name="_txing">
     <entry brief="write_opmode(TX)"/>
     <exit brief="tmout_evt.disarm()"/>
     <tran trig="_DIO_TX_DONE" target="../../2">
      <tran_glyph conn="44,36,3,0,24,-10,-30,2">
       <action box="0,-2,18,2"/>
      </tran_glyph>
     </tran>
     <tran trig="_PHY_TMOUT">
      <tran_glyph conn="44,40,3,-1,14">
       <action box="0,-2,12,2"/>
      </tran_glyph>
     </tran>
     <tran trig="_PHY_RQST">
      <tran_glyph conn="44,38,3,-1,14">
       <action box="0,-2,12,2"/>
      </tran_glyph>
     </tran>
     <tran trig="_DIO_MODE_RDY" target="../../2">
      <tran_glyph conn="44,42,3,0,24,-16,-30,2">
       <action box="0,-2,16,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="44,28,18,16">
      <entry box="1,2,16,2"/>
      <exit box="1,4,16,2"/>
     </state_glyph>
    </state>
    <state name="_lingering">
     <exit brief="write_opmode(STBY)"/>
     <tran trig="_PHY_RQST">
      <choice target="../../../2">
       <guard brief="_default_action">true</guard>
       <choice_glyph conn="34,90,5,0,34,-64,-30,2">
        <action box="1,-2,13,2"/>
       </choice_glyph>
      </choice>
      <choice>
       <guard brief="else">// not empty</guard>
       <action>// not empty 2</action>
       <choice_glyph conn="34,90,4,-1,2,26">
        <action box="1,0,10,2"/>
       </choice_glyph>
      </choice>
      <tran_glyph conn="20,90,3,-1,14">
       <action box="0,-2,12,2"/>
      </tran_glyph>
     </tran>
     <tran trig="_PHY_TMOUT" target="../../2">
      <tran_glyph conn="20,94,3,0,48,-68,-30,2">
       <action box="0,-2,12,2"/>
      </tran_glyph>
     </tran>
     <state name="_sleeping">
      <state_glyph node="50,54,10,8"/>
     </state>
     <state name="_listening">
      <entry brief="prdc_evt.post_every()"/>
      <exit brief="prdc_evt.disarm()"/>
      <tran trig="_DIO_VALID_HDR" target="../4">
       <tran_glyph conn="22,66,3,0,20,2">
        <action box="0,-2,18,2"/>
       </tran_glyph>
      </tran>
      <tran trig="_PHY_PRDC">
       <action brief="updt_noise()"/>
       <tran_glyph conn="22,64,3,-1,20">
        <action box="0,-2,20,2"/>
       </tran_glyph>
      </tran>
      <tran trig="_DIO_RX_TMOUT" target="../../../2">
       <tran_glyph conn="22,84,3,0,46,-58,-30,2">
        <action box="0,-2,14,2"/>
       </tran_glyph>
      </tran>
      <tran trig="_DIO_RX_DONE" target="../../../2">
       <tran_glyph conn="22,82,3,0,46,-56,-30,2">
        <action box="0,-2,18,2"/>
       </tran_glyph>
      </tran>
      <state name="_rxing">
       <exit brief="tmout_evt.disarm()"/>
       <tran trig="_PHY_RQST">
        <tran_glyph conn="24,76,3,-1,18">
         <action box="0,-2,10,2"/>
        </tran_glyph>
       </tran>
       <state_glyph node="24,68,22,10">
        <exit box="1,2,19,2"/>
       </state_glyph>
      </state>
      <state_glyph node="22,54,26,32">
       <entry box="1,2,19,2"/>
       <exit box="1,4,17,2"/>
      </state_glyph>
     </state>
     <state_glyph node="20,48,42,50">
      <exit box="1,2,17,2"/>
     </state_glyph>
    </state>
    <state_diagram size="95,117"/>
   </statechart>
  </class>
  <class name="ActionEvt" superclass="qpc::QEvt"/>
 </package>
 <directory name="src">
  <file name="sx127x.c">
   <text>#include &quot;qpc.h&quot;
#include &quot;bsp.h&quot;

Q_DEFINE_THIS_FILE

enum SX127x_Signals {
    _PHY_TMOUT_SIG = Q_USER_SIG,
    _PHY_RQST_SIG,
    _DIO_TX_DONE_SIG,
    _DIO_MODE_RDY_SIG,
    _DIO_VALID_HDR_SIG,
    _PHY_PRDC_SIG,
    _DIO_RX_TMOUT_SIG,
    _DIO_RX_DONE_SIG
}

/* Active object class -----------------------------------------------------*/

$declare${net.frst.heymac::ActionEvt}

$declare${net.frst.heymac::SX127x}

#define LINGER_TIME  \
    (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC)

$define${net.frst.heymac::SX127x}

$define${net.frst.heymac::ActionEvt}</text>
  </file>
  <file name="sx127x.h">
   <text>#ifndef SX127X_H
#define SX127X_H

enum SX127x_Signals {
    _PHY_TMOUT_SIG = Q_USER_SIG,
    _PHY_RQST_SIG,
    _DIO_TX_DONE_SIG,
    _DIO_MODE_RDY_SIG,
    _DIO_VALID_HDR_SIG,
    _PHY_PRDC_SIG,
    _DIO_RX_TMOUT_SIG,
    _DIO_RX_DONE_SIG
}

#endif</text>
  </file>
  <file name="main.c" properties="external"/>
 </directory>
</model>