a serial library to communicate with pebble time's smart strap interface
Dependents: xadow_smartstrap_for_pebble
Diff: encoding.h
- Revision:
- 0:e4dad9e53f06
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/encoding.h Wed Nov 04 09:58:41 2015 +0000 @@ -0,0 +1,17 @@ +#pragma once + +#include <stdint.h> +#include <stdbool.h> + +static const uint8_t ENCODING_FLAG = 0x7E; +static const uint8_t ENCODING_ESCAPE = 0x7D; +static const uint8_t ENCODING_ESCAPE_MASK = 0x20; + +typedef struct { + bool escape; +} EncodingStreamingContext; + +void encoding_streaming_decode_reset(EncodingStreamingContext *ctx); +bool encoding_streaming_decode(EncodingStreamingContext *ctx, uint8_t *data, bool *complete, + bool *is_invalid); +bool encoding_encode(uint8_t *data);