Manchester encoding/decoding in LibHiJack

The hijack iPhone library implements Manchester encoding for digital communication.  Manchester encoding maps 0 to high-low transition, and 1 to low-high transition.

The iPhone library generates the transitions using full or half period of a sine wave, using a full period when a bit run is detected. An example of this is shown below.

Manchester encoding of 0110011101 by libHiJack

Detection of Manchester encoding is relatively simple: first the signal is regenerated into a square wave by setting all values above 0 to 1 and 0 otherwise. The number of samples between transitions (0 to 1 or 1 to 0) is then measured. When this interval is within an acceptable range (as determined by the baud rate) the bit is read simply by taking the value of the regenerated square wave immediately after the transition. This works out nicely because 1 maps to a low-high transition, and the value immediately after transition is 1, while 0 maps to high-low transition, and the value immediately after transition is 0.

The important thing to note is that detection of a bit occurs at the transition from one bit to the next, and the code ignores transitions during a bit period. Specifically a transition must occur between 3/4 and 3/2 bit periods from last bit detection, otherwise it is ignored.

For example the transition between sample 64 and 96 is ignored because it occurs 1/2 a bit period since the last bit detection at sample 64.

Finally, the UART frame used consists of a start bit, eight data bits, one parity bits and one stop bit. Note my example doesn't include the parity bit since I reimplemented the encoding algorithm in python to produce the graph.



Brendanites of the Brendanverse

Of all Brendanites, the worst off are the criminals and other malcontents. Water-boarding is par-for-course as is other cruel and unusual punishments, like electric-clamps-on-nipples and listening to boy bands non-stop. By the O'Neill doctrine, if it worked before then whatever it is is OK now and forever. Amen.

While criminals have it bad in Brendanverse, the entrepreneurs have it easy. Starting business in Brendanverse is simple: find a market and setup shop. No need to worry about established competition, they won't do things like undercut your prices or bad mouth you in front of their customers. No siree, that's not how Brendanverse works. 

You see, in Brendanverse a company that owns, say 70% of the market, will do nothing like leverage their market share and resources to drive out, hinder or crush their competitors. In fact, calling them competitors is a misnomer: it implies competition and we can't have that. Companies are more like friends, happily coexisting and sharing their toys, aka customers.

Even more blessed than the entrepreneurs are the Chosen - the Journalists (not the Jews). They have all the right the Government has, including and not limited to reading people's emails and tapping their phones. These are rights that, by the O'Neil Doctrine, the Government owes to journalist, because unlike the Government, a Journalist is the epitome of integrity and honesty. They rise above the law and accountability and other trifling matters like FOI requests.

Whoever they are though, every Brendanite is a completely rational human being unswayed by emotional rhetorics, who gives every opinion their due weight before making a decision.

What a brave new world, with such people in it.


Having had a glimpse of the mind of Brendan O'Neil, I can't help but think he is someone who when confronted with an uncomfortable question latches on to the nearest superficial answer and runs with it.

Some people call him a "passionate defender of free speech" which brings to mind the following quote by Jascha Heifetz:

“No matter what side of an argument you're on, you always find some people on your side that wish you were on the other side.”

I wonder if he supports the right of people to yell fire in theatres...