Browse Source

use the radio RSSI for a source... we may want to shorten this as it takes

3-4 seconds to gather all this...  need to add a blinking light to this
so it's clear that it's still starting..
irr_shared
John-Mark Gurney 3 years ago
parent
commit
d0cc4dd2c9
1 changed files with 24 additions and 9 deletions
  1. +24
    -9
      main.c

+ 24
- 9
main.c View File

@@ -182,6 +182,26 @@ process_line(char *start, char *end)
usb_printf("line: %.*s", end - start, start); usb_printf("line: %.*s", end - start, start);
} }


/*
* Seed the randomness from the radio. This is not a great
* seed, and is hard to gauge how much randomness is really
* there. Assuming about 1 bit per 8 bits looks pretty safe,
* so add 256 * 8 / 32 words.
*/
static void
radio_seed_rng(void)
{
#if 1
uint32_t v;
int i;

for (i = 0; i < 256 * 8 / 32; i++) {
v = Radio.Random();
strobe_seed_prng((uint8_t *)&v, sizeof v);
}
#endif
}

int int
main(void) main(void)
{ {
@@ -191,6 +211,10 @@ main(void)


BoardInitMcu(); BoardInitMcu();


Radio.Init(&revents);

radio_seed_rng();

strobe_rng_save(); strobe_rng_save();


/* turn on LED */ /* turn on LED */
@@ -206,17 +230,8 @@ main(void)
usb_printf("\r\n"); usb_printf("\r\n");
#endif #endif


Radio.Init(&revents);

uint32_t v; uint32_t v;


v = Radio.Random();
usb_printf("rr: %#x\r\n", v);
v = Radio.Random();
usb_printf("rr: %#x\r\n", v);
v = Radio.Random();
usb_printf("rr: %#x\r\n", v);

usb_printf("gs: %#x\r\n", Radio.GetStatus()); usb_printf("gs: %#x\r\n", Radio.GetStatus());


usb_printf("set modem\r\n"); usb_printf("set modem\r\n");


Loading…
Cancel
Save