a serial library to communicate with pebble time's smart strap interface

Dependents:   xadow_smartstrap_for_pebble

encoding.h

Committer:
KillingJacky
Date:
2015-11-04
Revision:
0:e4dad9e53f06

File content as of revision 0:e4dad9e53f06:

#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);