Browse Source

make sure we filp back to rx after we're done tx'ing...

eliminate the strobe code as it isn't used, this just pushes
packets back and forth..
irr_shared
John-Mark Gurney 3 years ago
parent
commit
0875be381d
1 changed files with 1 additions and 54 deletions
  1. +1
    -54
      main.c

+ 1
- 54
main.c View File

@@ -36,7 +36,6 @@


/* lora-irr headers */ /* lora-irr headers */
#include <misc.h> #include <misc.h>
#include <strobe_rng_init.h>




char * char *
@@ -67,6 +66,7 @@ txdone(void)
{ {


usb_printf("txdone\r\n"); usb_printf("txdone\r\n");
Radio.Rx(0);
} }


void void
@@ -186,64 +186,14 @@ 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
}

static void
analog_seed_rng(void)
{
#if 1
uint16_t v;
int i;

for (i = 0; i < 256 / 2; i++) {
/*
* Capture some ADC data. If pin is floating, 0xfff
* happens frequently, if pin is grounded, 0 happens
* frequently, filter these values out.
*/
do {
v = AdcReadChannel(&Adc, ADC_CHANNEL_21);
} while (v == 0 || v == 0xfff);
strobe_seed_prng((uint8_t *)&v, sizeof v);
}
#endif
}

int int
main(void) main(void)
{ {
uint8_t bytes[8];

strobe_rng_init();


BoardInitMcu(); BoardInitMcu();


Radio.Init(&revents); Radio.Init(&revents);


analog_seed_rng();

radio_seed_rng();

strobe_rng_save();

/* turn on LED */ /* turn on LED */
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8, GPIO_PIN_SET);


@@ -252,9 +202,6 @@ main(void)


usb_printf("starting...\r\n"); usb_printf("starting...\r\n");


bare_strobe_randomize(bytes, sizeof bytes);
hexdump(bytes, sizeof bytes);
usb_printf("\r\n");
#endif #endif


uint32_t v; uint32_t v;


Loading…
Cancel
Save