diff options
| author | Tero K <tero.k@granitedevices.fi> | 2014-12-21 02:15:19 +0200 |
|---|---|---|
| committer | Tero K <tero.k@granitedevices.fi> | 2014-12-21 02:15:19 +0200 |
| commit | 839c41ca408bd90207bfbf17a3712578ebd6f56b (patch) | |
| tree | aa77c9d4e4fbaec69e96d7cf322a23c7a9debded | |
| parent | 6a6a9168979f045c95d1c65310fd8f03662ba7f3 (diff) | |
| download | SimpleMotionV2-839c41ca408bd90207bfbf17a3712578ebd6f56b.tar.gz SimpleMotionV2-839c41ca408bd90207bfbf17a3712578ebd6f56b.zip | |
1) protocol image added 2) added clearer names for SM subpacket types
| -rw-r--r-- | doc/SMV2Protocol.svg | 643 | ||||
| -rw-r--r-- | simplemotion_defs.h | 77 |
2 files changed, 705 insertions, 15 deletions
diff --git a/doc/SMV2Protocol.svg b/doc/SMV2Protocol.svg new file mode 100644 index 0000000..8be482b --- /dev/null +++ b/doc/SMV2Protocol.svg @@ -0,0 +1,643 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="942.66589" + height="1512.0173" + id="svg2" + version="1.1" + inkscape:version="0.48.2 r9819" + sodipodi:docname="SMV2Protocol.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.7" + inkscape:cx="658.67136" + inkscape:cy="660.87686" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + showborder="true" + inkscape:window-width="2560" + inkscape:window-height="1538" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" + fit-margin-top="55" + fit-margin-left="55" + fit-margin-right="55" + fit-margin-bottom="55"> + <inkscape:grid + type="xygrid" + id="grid3129" + empspacing="5" + visible="true" + enabled="true" + snapvisiblegridlinesonly="true" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(42.665867,417.65518)"> + <rect + style="fill:#dee3db;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3369" + width="140" + height="150" + x="700" + y="-187.63782" /> + <rect + style="fill:#ddff55;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3367" + width="170" + height="150" + x="530" + y="-187.63782" /> + <rect + style="fill:#f4eed7;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3365" + width="190" + height="150" + x="340" + y="-187.63782" /> + <rect + style="fill:#ffeeaa;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3363" + width="200" + height="150" + x="140" + y="-187.63782" /> + <rect + style="fill:#ffe680;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none" + id="rect3361" + width="120" + height="150" + x="20" + y="-187.63782" /> + <text + xml:space="preserve" + style="font-size:62.80782318px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="153.61578" + y="106.66248" + id="text2987" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan2989" + x="153.61578" + y="106.66248" + style="font-size:23.55293465px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">Subpacket 1</tspan></text> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="30.15147" + y="-156.8459" + id="text2987-1-8-7" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + id="tspan2989-7-2-1" + x="30.15147" + y="-156.8459" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">1 byte</tspan><tspan + sodipodi:role="line" + x="30.15147" + y="-130.28236" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3208">Packet</tspan><tspan + sodipodi:role="line" + x="30.15147" + y="-103.71883" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3152">type</tspan><tspan + sodipodi:role="line" + x="30.15147" + y="-77.155304" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154" /></text> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="150.75735" + y="-156.8459" + id="text2987-1-8-7-1" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + x="150.75735" + y="-156.8459" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-7">0 or 1 bytes</tspan><tspan + sodipodi:role="line" + x="150.75735" + y="-130.28236" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3206">Number of payload</tspan><tspan + sodipodi:role="line" + x="150.75735" + y="-103.71883" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3188">bytes unless</tspan><tspan + sodipodi:role="line" + x="150.75735" + y="-77.155304" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3192">fixed lenght defined </tspan><tspan + sodipodi:role="line" + x="150.75735" + y="-50.59177" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3190">by packet type</tspan></text> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="361.81763" + y="-156.8459" + id="text2987-1-8-7-6" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + id="tspan2989-7-2-1-1" + x="361.81763" + y="-156.8459" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">1 byte</tspan><tspan + sodipodi:role="line" + x="361.81763" + y="-130.28236" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-3">Target device</tspan><tspan + sodipodi:role="line" + x="361.81763" + y="-103.71883" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3247">address 1-255 </tspan><tspan + sodipodi:role="line" + x="361.81763" + y="-77.155304" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3251">or 0 if broadcast </tspan><tspan + sodipodi:role="line" + x="361.81763" + y="-50.59177" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3253">to all devices</tspan></text> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="552.77698" + y="-156.8459" + id="text2987-1-8-7-2" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + id="tspan2989-7-2-1-2" + x="552.77698" + y="-156.8459" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">0-120 bytes</tspan><tspan + sodipodi:role="line" + x="552.77698" + y="-130.28236" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-8">Payload data</tspan><tspan + sodipodi:role="line" + x="552.77698" + y="-103.71883" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3298">made of</tspan><tspan + sodipodi:role="line" + x="552.77698" + y="-77.155304" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3300">subpackets</tspan></text> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="723.63525" + y="-156.8459" + id="text2987-1-8-7-6-5" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + id="tspan2989-7-2-1-1-7" + x="723.63525" + y="-156.8459" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">2 byte</tspan><tspan + sodipodi:role="line" + x="723.63525" + y="-130.28236" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3253-9">CRC </tspan><tspan + sodipodi:role="line" + x="723.63525" + y="-103.71883" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3359">checksum</tspan></text> + <rect + style="fill:#e5ff80;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3363-2" + width="200" + height="120" + x="174" + y="128.36221" /> + <rect + style="fill:#ccff00;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none" + id="rect3361-7" + width="120" + height="120" + x="53.999996" + y="128.36221" /> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="64.323135" + y="157.56667" + id="text2987-1-8-7-9" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + id="tspan2989-7-2-1-5" + x="64.323135" + y="157.56667" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">2 bits</tspan><tspan + sodipodi:role="line" + x="64.323135" + y="184.1302" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-1">subpacket</tspan><tspan + sodipodi:role="line" + x="64.323135" + y="210.69373" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4200">type and</tspan><tspan + sodipodi:role="line" + x="64.323135" + y="237.25726" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4202">lenght</tspan></text> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="184.92902" + y="157.56667" + id="text2987-1-8-7-1-2" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + x="184.92902" + y="157.56667" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-7-3">6, 14, 22 or 30 bits</tspan><tspan + sodipodi:role="line" + x="184.92902" + y="184.1302" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3190-1">Value data</tspan><tspan + sodipodi:role="line" + x="184.92902" + y="210.69373" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4213">(write / read value</tspan><tspan + sodipodi:role="line" + x="184.92902" + y="237.25726" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4215">of parameter)</tspan></text> + <text + xml:space="preserve" + style="font-size:62.80782318px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="593.61578" + y="106.6625" + id="text2987-3" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan2989-8" + x="593.61578" + y="106.6625" + style="font-size:23.55293465px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">Subpacket N</tspan></text> + <rect + style="fill:#e5ff80;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3363-2-7" + width="200" + height="120" + x="614" + y="128.36221" /> + <rect + style="fill:#ccff00;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none" + id="rect3361-7-4" + width="120" + height="120" + x="494" + y="128.36221" /> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="506.54468" + y="157.56667" + id="text2987-1-8-7-9-2" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + id="tspan2989-7-2-1-5-7" + x="506.54468" + y="157.56667" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">2 bits</tspan><tspan + sodipodi:role="line" + x="506.54468" + y="184.1302" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-1-7">subpacket</tspan><tspan + sodipodi:role="line" + x="506.54468" + y="210.69373" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4200-9">type and</tspan><tspan + sodipodi:role="line" + x="506.54468" + y="237.25726" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4202-3">lenght</tspan></text> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="627.15057" + y="157.56667" + id="text2987-1-8-7-1-2-1" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + x="627.15057" + y="157.56667" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-7-3-9">6, 14, 22 or 30 bits</tspan><tspan + sodipodi:role="line" + x="627.15057" + y="184.1302" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3190-1-8">Value data</tspan><tspan + sodipodi:role="line" + x="627.15057" + y="210.69373" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4213-6">(write / read value</tspan><tspan + sodipodi:role="line" + x="627.15057" + y="237.25726" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4215-5">of parameter)</tspan></text> + <text + xml:space="preserve" + style="font-size:66.42854309px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="394" + y="193.36221" + id="text4296" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4298" + x="394" + y="193.36221">. . .</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="M 530,-17.637817 530,2.3621826 53.999998,88.36222 l 0,20" + id="path4302" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccc" /> + <path + style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 700,-17.637817 0,19.9999996 114,86.0000374 0,20" + id="path4304" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccc" /> + <text + xml:space="preserve" + style="font-size:62.80782318px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="180" + y="-247.63782" + id="text2987-0" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="180" + y="-247.63782" + style="font-size:23.55293465px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4327">SimpleMotion V2 outbound or inbound packet</tspan></text> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="301.42856" + y="-281.20926" + id="text4331" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan4333" + x="301.42856" + y="-281.20926"></tspan></text> + <text + xml:space="preserve" + style="font-size:53.08763885px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="340" + y="-217.63782" + id="text2987-0-8" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="340" + y="-217.63782" + style="font-size:19.90786552px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4327-6">3 - 125 bytes total</tspan></text> + <rect + style="fill:#ffe680;fill-opacity:1;stroke:#000000;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none" + id="rect3361-6" + width="820" + height="300" + x="23.999998" + y="302.36221" /> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="34.171661" + y="330.69238" + id="text2987-1-8-7-13" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + id="tspan2989-7-2-1-8" + x="34.171661" + y="330.69238" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">Packet types</tspan><tspan + sodipodi:role="line" + x="34.171661" + y="357.25592" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4450" /><tspan + sodipodi:role="line" + x="34.171661" + y="383.81946" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3152-3">Outbound (host to devices):</tspan><tspan + sodipodi:role="line" + x="34.171661" + y="410.38297" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4442">- execute payload subpackets instantly</tspan><tspan + sodipodi:role="line" + x="34.171661" + y="436.9465" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4438">- place payload subpackets in buffer executed by timed fashion</tspan><tspan + sodipodi:role="line" + x="34.171661" + y="463.51004" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4440">- get device clock value (used to sync buffered execution)</tspan><tspan + sodipodi:role="line" + x="34.171661" + y="490.07358" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4452" /><tspan + sodipodi:role="line" + x="34.171661" + y="516.63708" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4444">Inbound (device to host)</tspan><tspan + sodipodi:role="line" + x="34.171661" + y="543.20062" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4446">- Return data packets (one type for each outbound type),</tspan><tspan + sodipodi:role="line" + x="34.171661" + y="569.76416" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4448"> these contain payload data (read values) or clock value</tspan><tspan + sodipodi:role="line" + x="34.171661" + y="596.3277" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-4" /></text> + <rect + style="fill:#ccff00;fill-opacity:1;stroke:#000000;stroke-width:1.99999976;stroke-miterlimit:4;stroke-dasharray:none" + id="rect3361-7-46" + width="820" + height="396.00003" + x="23.999998" + y="642.36218" /> + <text + xml:space="preserve" + style="font-size:56.6688652px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="34.171665" + y="668.98511" + id="text2987-1-8-7-9-0" + sodipodi:linespacing="125%" + transform="scale(0.99497636,1.005049)"><tspan + sodipodi:role="line" + id="tspan2989-7-2-1-5-6" + x="34.171665" + y="668.98511" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial">Subpacket types</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="695.54865" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan3154-1-6" /><tspan + sodipodi:role="line" + x="34.171665" + y="722.11218" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4491">Outbound</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="748.67572" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4489">- set parameter address where next values are written to, 2 bytes long</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="775.23926" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4487">- write parameter value, 3 or 4 bytes long</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="801.8028" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4533" /><tspan + sodipodi:role="line" + x="34.171665" + y="828.36627" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4543">Inbound</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="854.92981" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4552">- SM bus status value, 1 byte long</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="881.49335" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4554">- read parameter value, 2, 3 or 4 bytes long</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="908.05688" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4558" /><tspan + sodipodi:role="line" + x="34.171665" + y="934.62042" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4531">Each outbound subpacket will give one inbound subpacket in return when device</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="961.18396" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4537">sends the response to a SM packet. Content of inbound subpackets are defined by</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="987.7475" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4539">writable parameters SMP_RETURN_PARAM_ADDR and </tspan><tspan + sodipodi:role="line" + x="34.171665" + y="1014.311" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4541">SMP_RETURN_PARAM_LEN.</tspan><tspan + sodipodi:role="line" + x="34.171665" + y="1040.8745" + style="font-size:21.25082588px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4202-8" /></text> + <text + xml:space="preserve" + style="font-size:98.96096039px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Audiowide;-inkscape-font-specification:Audiowide" + x="10.667066" + y="-335.63782" + id="text2987-0-4" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="10.667066" + y="-335.63782" + style="font-size:37.11036301px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial" + id="tspan4327-9">SimpleMotion V2 Protocol</tspan></text> + </g> +</svg> diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 5c726e1..06810f2 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -32,14 +32,7 @@ #endif
-//SMP command types
-#define SMPCMD_SETPARAMADDR 2
-#define SMPCMD_24B 1
-#define SMPCMD_32B 0
-#define SMPRET_OTHER 3
-#define SMPRET_16B 2
-#define SMPRET_24B 1
-#define SMPRET_32B 0
+
/*
@@ -59,15 +52,69 @@ //mask for addresses
#define SMP_ADDRESS_BITS_MASK 0x1FFF //E=1110
+/*
+ * SM payload command types and return value types.
+ */
//SMP packet header bits (2 bits). These determine content length and type
-#define SMPCMD_SET_PARAM_ADDR 2
-#define SMPCMD_24B 1
-#define SMPCMD_32B 0
-#define SMPRET_CMD_STATUS 3
-#define SMPRET_16B 2
-#define SMPRET_24B 1
-#define SMPRET_32B 0
+#define SMPCMD_SETPARAMADDR 2 //Deprecated name, dont use these. Use new names seen below
+#define SMPCMD_SET_PARAM_ADDR 2 //Deprecated name, dont use these. Use new names seen below
+#define SMPCMD_24B 1 //Deprecated name, dont use these. Use new names seen below
+#define SMPCMD_32B 0 //Deprecated name, dont use these. Use new names seen below
+#define SMPRET_CMD_STATUS 3 //Deprecated name, dont use these. Use new names seen below
+#define SMPRET_OTHER 3 //Deprecated name, dont use these. Use new names seen below
+#define SMPRET_16B 2 //Deprecated name, dont use these. Use new names seen below
+#define SMPRET_24B 1 //Deprecated name, dont use these. Use new names seen below
+#define SMPRET_32B 0 //Deprecated name, dont use these. Use new names seen below
+
+//
+//new naming for the above values (more clear meanings):
+//
+
+//OUTBOUND SM COMMAND PAYLOAD SUBPACKET TYPES
+//each SMCMD_INSTANT_CMD and SMCMD_BUFFERED_CMD payload is filled with subpackets of following types
+ //sets param address (one of SMP_ defines) where next written value goes to.
+ //consumes 2 bytes from payload buffer.
+ #define SM_SET_WRITE_ADDRESS 2
+ //writes value to previously defined address. consumes 3 bytes (24 bits) from payload buffer.
+ //can hold value size up to 22 bits. bits above 22 are clipped (transmitted as 0s)
+ #define SM_WRITE_VALUE_24B 1
+ //writes value to previously defined address. consumes 4 bytes (32 bits) from payload buffer.
+ //can hold value size up to 30 bits. bits above 30 are clipped (transmitted as 0s)
+ #define SM_WRITE_VALUE_32B 0
+
+//INBOUND SM COMMAND PAYLOAD SUBPACKET TYPES
+//each outbound subpacket will return one of these. the type and address what is being returned
+//is defined by parameters SMP_RETURN_PARAM_ADDR and SMP_RETURN_PARAM_LEN
+ //return value contains SM bus status bits (possible faults etc).
+ //consumes 1 byte from payload buffer
+ #define SM_RETURN_STATUS 3
+ //return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR
+ //consumes 2 byte from payload buffer. can contain value up to 14 bits. value greater than 14 bits is clipped (padded with 0s)
+ #define SM_RETURN_VALUE_16B 2
+ //return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR
+ //consumes 3 byte from payload buffer. can contain value up to 14 bits. value greater than 22 bits is clipped (padded with 0s)
+ #define SM_RETURN_VALUE_24B 1
+ //return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR
+ //consumes 4 byte from payload buffer. can contain value up to 30 bits. value greater than 14 bits is clipped (padded with 0s)
+ #define SM_RETURN_VALUE_32B 0
+
+/* subpacket format
+ *
+ * header:
+ * 2 bits packet type which defines also lenght of subpacket
+ * data:
+ * rest of subpacket contains the transmitted value
+ *
+ * example:
+ * SM_WRITE_VALUE_32B packet looks like this
+ *
+ * -2 first bits are 00
+ * -next 30 bits carry the value
+ *
+ * SMV2 library takes care of forming subpackets so user only needs to care about using the macros above
+ *
+ */
//if command is to set param addr to this -> NOP
#define SMP_ADDR_NOP 0x3fff
|
