From 189218cc91b606cd51274131b406320ab52c9953 Mon Sep 17 00:00:00 2001 From: Charles Javerliat <charles.javerliat@insa-lyon.fr> Date: Thu, 15 Oct 2020 22:46:39 +0300 Subject: [PATCH] Update readme --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e1a18ae..86f2145 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,14 @@ This library provides a way to frame and send data safely over serial, this incl ### Framing data ```python +from sfp.sfp import frame_data +import binascii + # The data to be framed data = bytearray([0x12, 0x34, 0x56]) # Frame and store the result in framed_data -framed_data = bytearray() -frame_data(data, framed_data) +framed_data = frame_data(data) # Print the hexadecimal representation of the result # This will return b'7e0003123456bf127f' @@ -30,12 +32,14 @@ In those bytes: ### Unframing data ```python +from sfp.sfp import unframe_data +import binascii + # The frame to unframe the data from framed_data = bytearray([0x7e, 0x0, 0x3, 0x12, 0x34, 0x56, 0xbf, 0x12, 0x7f]) # Unframe and store the result in unframed_data -unframed_data = bytearray() -unframe_data(framed_data, unframed_data) +unframed_data = unframe_data(framed_data) # Print the hexadecimal representation of the result # This will return b'123456' -- GitLab