Last active
January 8, 2018 21:33
-
-
Save shirriff/05d8a44ab844f959db86b28d8d27fb28 to your computer and use it in GitHub Desktop.
Fragment of PRU code to output Manchester-encoded data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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