Metadata-Version: 2.1
Name: manchester-code
Version: 1.1.0
Summary: Python library to encode & decode data as Manchester code
Home-page: https://github.com/fphammerle/python-manchester-code
Author: Fabian Peter Hammerle
Author-email: fabian+python-manchester-code@hammerle.me
License: GPLv3+
Project-URL: Changelog, https://github.com/fphammerle/python-manchester-code/blob/master/CHANGELOG.md
Keywords: phase encoding,radio frequency,telecommunication,transmission
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Communications
Description-Content-Type: text/markdown

# manchester-code

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![CI Pipeline Status](https://github.com/fphammerle/python-manchester-code/workflows/tests/badge.svg)](https://github.com/fphammerle/python-manchester-code/actions)
[![Last Release](https://img.shields.io/pypi/v/manchester-code.svg)](https://pypi.org/project/manchester-code/#history)
[![Compatible Python Versions](https://img.shields.io/pypi/pyversions/manchester-code.svg)](https://pypi.org/project/manchester-code/)
[![DOI](https://zenodo.org/badge/292872290.svg)](https://zenodo.org/badge/latestdoi/292872290)

Python library to encode & decode data as [Manchester code](https://en.wikipedia.org/wiki/Manchester_code)

## Setup

```sh
$ pip3 install --user --upgrade manchester-code
```

## Usage

0-bits translate to low-high, 1-bits to high-low (G. E. Thomas convention).

```python
import manchester-code

manchester_code = encode([0b00001111, 0b01101001])
print(''.join(['{:08b}'.format(m) for m in manchester_code]))
# 01010101101010100110100110010110

encode(b'msg')
# b'i\xa6jZij'

decode([0b01010101, 0b10101010, 0b01101001, 0b10010110])
# 0000111101101001

decode(b'ieiVjeiV')
# b'data'
```


