Skip to content

Instantly share code, notes, and snippets.

@shirriff
Last active January 8, 2018 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirriff/05d8a44ab844f959db86b28d8d27fb28 to your computer and use it in GitHub Desktop.
Save shirriff/05d8a44ab844f959db86b28d8d27fb28 to your computer and use it in GitHub Desktop.
Fragment of PRU code to output Manchester-encoded data.
for (bit_count = 0; bit_count < 8; bit_count++) {
if (byte & 0x80) {
wait_for_pwm_timer();
__R30 = HIGH << WRITE_PIN;
wait_for_pwm_timer();
__R30 = LOW << WRITE_PIN;
} else {
wait_for_pwm_timer();
__R30 = LOW << WRITE_PIN;
wait_for_pwm_timer();
__R30 = HIGH << WRITE_PIN;
}
byte <<= 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment