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
// This DTS overlay sets up one input and one output pin for use by | |
// PRU0 via its Enhanced GPIO mode, which will let us access those pins | |
// by writing to R30 bit 15 or reading from R31 bit 14. | |
// Save this file wherever you want (but I recommend /lib/firmware), as | |
// "PRU-GPIO-EXAMPLE-00A0.dts". | |
// Compile with: | |
// dtc -O dtb -I dts -o /lib/firmware/PRU-GPIO-EXAMPLE-00A0.dtbo -b 0 -@ PRU-GPIO-EXAMPLE-00A0.dts | |
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
-b | |
-image | |
ROMS { | |
PAGE 0: | |
text: o = 0x0, l = 0x1000, files={text.bin} | |
PAGE 1: | |
data: o = 0x0, l = 0x1000, files={data.bin} | |
} |
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
// Loads a PRU text.bin (and optionally data.bin) file, | |
// executes it, and waits for completion. | |
// This version enables interrupt event 15 (ecap timer) | |
// | |
// Usage: | |
// $ ./loader text.bin [data.bin] | |
// | |
// Compile with: | |
// gcc -o loader loader.c -lprussdrv | |
// |
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
/* | |
* blink demo: blink LED ten times | |
* LED should be connected to P8_11 (pr1_pru0_pru_r30_15) | |
* | |
*/ | |
volatile register unsigned int __R31, __R30; | |
int main(void) { | |
unsigned int loops, delay; | |
for (loops = 0; loops < 10; loops++) { |
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
get "streams.d" | |
external | |
[ | |
Ws; | |
Wns; | |
MulFull; | |
DoubleAdd; | |
keys; | |
Gets; | |
] |
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
import re | |
data="""\ | |
10100001 10010011 01100011 => 01110111 | |
10100001 10010011 01100100 => 01110001 | |
10100001 10010011 01100101 => 01110000 | |
10100001 10010011 01100110 => 01110010 | |
10100001 10010011 01100111 => 01110011 | |
10100001 10010011 01101000 => 01111001 | |
10100001 10010011 01101001 => 01111000 |
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
- | |
- * | |
- + XX | |
- + X XXXX | |
- + XXX XXXXX | |
- * XXXXXX XXXXXXX | |
- XX XXXXXXXXXXXXXXXXX | |
- XXXX XXXXXXXXXXXXXXXXXX | |
- * XXXXXX XXXXXXXXXXXXXXXXXXX | |
- XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
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
import re | |
# Each line is 3 bytes of input and the observed 1-byte checksum | |
data="""\ | |
10100001 10010011 01100011 => 01110111 | |
10100001 10010011 01100100 => 01110001 | |
10100001 10010011 01100101 => 01110000 | |
10100001 10010011 01100110 => 01110010 | |
10100001 10010011 01100111 => 01110011 | |
10100001 10010011 01101000 => 01111001 |
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
import re | |
data="""\ | |
10100001 10010011 01100011 => 01110111 | |
10100001 10010011 01100100 => 01110001 | |
10100001 10010011 01100101 => 01110000 | |
10100001 10010011 01100110 => 01110010 | |
10100001 10010011 01100111 => 01110011 | |
10100001 10010011 01101000 => 01111001 | |
10100001 10010011 01101001 => 01111000 |
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(); |
OlderNewer