APP 4
Dependencies: mbed CRC16 mbed-rtos
Frame.cpp@7:733d500dbe5c, 2016-02-21 (annotated)
- Committer:
- manl2003
- Date:
- Sun Feb 21 18:50:45 2016 +0000
- Revision:
- 7:733d500dbe5c
- Parent:
- 2:1250280a511b
- Child:
- 9:b937f9c6d682
Allllllo vincent
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
manl2003 | 7:733d500dbe5c | 1 | #include "Frame.h" |
manl2003 | 7:733d500dbe5c | 2 | |
manl2003 | 7:733d500dbe5c | 3 | #pragma once |
manl2003 | 7:733d500dbe5c | 4 | |
manl2003 | 7:733d500dbe5c | 5 | void FrameBuilder(bitset<640> data, char size) |
manl2003 | 7:733d500dbe5c | 6 | { |
manl2003 | 7:733d500dbe5c | 7 | bitset<FRAMESIZE> bitset; |
manl2003 | 7:733d500dbe5c | 8 | |
manl2003 | 7:733d500dbe5c | 9 | |
manl2003 | 7:733d500dbe5c | 10 | //Préambule 10101010 |
manl2003 | 7:733d500dbe5c | 11 | bitset.set(0,1); |
manl2003 | 7:733d500dbe5c | 12 | bitset.set(1,0); |
manl2003 | 7:733d500dbe5c | 13 | bitset.set(2,1); |
manl2003 | 7:733d500dbe5c | 14 | bitset.set(3,0); |
manl2003 | 7:733d500dbe5c | 15 | bitset.set(4,1); |
manl2003 | 7:733d500dbe5c | 16 | bitset.set(5,0); |
manl2003 | 7:733d500dbe5c | 17 | bitset.set(6,1); |
manl2003 | 7:733d500dbe5c | 18 | bitset.set(7,0); |
manl2003 | 7:733d500dbe5c | 19 | //Start 01111110 |
manl2003 | 7:733d500dbe5c | 20 | bitset.set(8,0); |
manl2003 | 7:733d500dbe5c | 21 | bitset.set(9,1); |
manl2003 | 7:733d500dbe5c | 22 | bitset.set(10,1); |
manl2003 | 7:733d500dbe5c | 23 | bitset.set(11,1); |
manl2003 | 7:733d500dbe5c | 24 | bitset.set(12,1); |
manl2003 | 7:733d500dbe5c | 25 | bitset.set(13,1); |
manl2003 | 7:733d500dbe5c | 26 | bitset.set(14,1); |
manl2003 | 7:733d500dbe5c | 27 | bitset.set(15,0); |
manl2003 | 7:733d500dbe5c | 28 | |
manl2003 | 7:733d500dbe5c | 29 | //8 bits de marde |
manl2003 | 7:733d500dbe5c | 30 | |
manl2003 | 7:733d500dbe5c | 31 | //length |
manl2003 | 7:733d500dbe5c | 32 | bitset.set(23, size & 10000000); |
manl2003 | 7:733d500dbe5c | 33 | bitset.set(24, size & 01000000); |
manl2003 | 7:733d500dbe5c | 34 | bitset.set(25, size & 00100000); |
manl2003 | 7:733d500dbe5c | 35 | bitset.set(26, size & 00010000); |
manl2003 | 7:733d500dbe5c | 36 | bitset.set(27, size & 00001000); |
manl2003 | 7:733d500dbe5c | 37 | bitset.set(28, size & 00000100); |
manl2003 | 7:733d500dbe5c | 38 | bitset.set(29, size & 00000010); |
manl2003 | 7:733d500dbe5c | 39 | bitset.set(30, size & 00000001); |
manl2003 | 7:733d500dbe5c | 40 | |
manl2003 | 7:733d500dbe5c | 41 | for(int i = 0; i < size; i++) |
manl2003 | 7:733d500dbe5c | 42 | { |
manl2003 | 7:733d500dbe5c | 43 | bitset.set(30+i, bitset[i]); |
manl2003 | 7:733d500dbe5c | 44 | } |
manl2003 | 7:733d500dbe5c | 45 | } |