You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,10 @@ Here lies the code powering my 433mhz RF transmitter. This transmitter supports
6
6
7
7
A packet is comprised of seven different bytes:
8
8
9
-
1.`U` - This, and the following char, are our training bytes. The binary value of `U` is `01010101`, which gives any receivers' data slicers a nice square wave to sync up with. This makes them more receptive to the rest of our packet, which is important because that's where our actual data is.
10
-
2.`U` - Another literal `U` training character.
9
+
1.`U` - This is our training byte. The binary value of `U` is `01010101`, which gives any receivers' data slicers a nice square wave to sync up with. This makes them more receptive to the rest of our packet, which is important because that's where our actual data is.
10
+
2.`ª` - This is the start byte, which signals to any receiver that the bytes that follow are data bytes. The binary value of 'ª' is 10101010, which should also hopefully help train the data slicers of our receivers to be more receptive to this sender.
11
11
3.`button_byte` - Each bit in this byte corresponds to the status of our 8 non-special buttons that are on the top face of the transmitter. If a bit in this byte is `1`, it means the associated button is currently pressed.
12
12
4.`misc_byte` - A byte containing a conglomerate of bits that didn't fit anywhere else. Here we have three bits corresponding to the pressed status of our left shoulder button, right shoulder button, and the button on the analog stick. We also have the two most significant bits of both the x-axis and y-axis analog stick values. The analog values of each axis are of 10-bit resolution, so rather than allocating two whole bytes for each one we instead put these MSBs here.
13
13
5.`lsb_analog_stick_x_byte` - A byte containing the 8 least significant bits of the x-analog stick value.
14
14
6.`lsb_analog_stick_y_byte` - A byte containing the 8 least significant bits of the y-analog stick values.
15
-
7.`checksum` - Finally, we have our checksum byte. The checksum is calculated by adding up all our data bytes (so no training characters). Any overflow is ignored. This gives the receiver a simple (and admittedly not perfect) way to ensure that the data they've received is valid.
15
+
7.`checksum` - Finally, we have our checksum byte. The checksum is calculated by adding up all our data bytes (so no training characters). Any overflow is ignored. This gives the receiver a simple (and admittedly not perfect) way to ensure that the data they've received is valid.
@param buffer - The buffer to fill as you construct the packet.
295
298
@param training_chars - The chars used for training the receiver to sync up with this transmitter before we start sending actual data.
296
-
@param num_training_chars - The number of training chars being passed in
299
+
@param num_training_chars - The number of training chars being passed in.
300
+
@param start_char - The char used to indicate the start of the data portion of the packet
297
301
@param data - The chars representing the data portion of the packet.
298
302
@param num_data_chars - The number of data chars being passed in.
299
303
@param null_terminated - Whether or not to null terminate this packet.
300
304
@return Buffer_Status - Returns the Buffer_Status returned by the most recent write, which allows the caller to handle buffer-related issues, such as an attempted write to a full buffer.
0 commit comments