void mrf_init(void) { mrf_gpio_init(); // Set up p14 and p21 mrf_spi_init(8, 0, 500000); // 8-bit transfers, CPOL=0/CPHA=0, sclk = 500kHz mrf_reset(); // Hard and soft reset, configure for Tx/Rx // Only enable interrupts after the radio is configured mrf_gpioint_init(); }
int main(void) { init(); printf_P(PSTR("woke up...woo\n")); mrf_reset(&MRF_RESET_PORT, MRF_RESET_PIN); mrf_init(&MRF_CS_PORT, MRF_CS_PIN); mrf_pan_write(0xcafe); mrf_address16_write(0x1111); //mrf_promiscuous(1); sei(); uint32_t roughness = 0; while (1) { roughness++; mrf_check_flags(&handle_rx, &handle_tx); // about a second or so... if (roughness > 0x50000) { printf_P(PSTR("txxxing...\n")); mrf_send16(0x4202, 4, "abcd"); roughness = 0; } } }