int afsk_testRun(void) { int c; while ((c = fgetc(fp_adc)) != EOF) { afsk_adc_isr (&afsk_fd, (uint8_t) c); ax25_poll(&ax25); } kprintf("Messages correctly received: %d\n", msg_cnt); ASSERT(msg_cnt >= 15); char buf[256]; // start from 1 and then wrap round to 0 otherwise null termination prevents display of data for (unsigned i = 0; i < sizeof (buf); i++) buf[i] = i + 1; ax25_send(&ax25, AX25_CALL("abcdef", 0), AX25_CALL("123456", 1), buf, sizeof(buf)); do { int8_t val = afsk_dac_isr(&afsk_fd) - 128; ASSERT(fwrite(&val, 1, sizeof(val), fp_dac) == sizeof(val)); data_written++; } while (afsk_fd.sending); #define SND_DATASIZE_OFF 8 #if CPU_AVR #warning TODO: fseek? #else ASSERT(fseek(fp_dac, SND_DATASIZE_OFF, SEEK_SET) == 0); #endif data_written = cpu_to_be32(data_written); ASSERT(fwrite(&data_written, 1, sizeof(data_written), fp_dac) == sizeof(data_written)); ASSERT(fclose(fp_adc) + fclose(fp_dac) == 0); fp_adc = afsk_fileOpen("test/afsk_test_out.au"); ax25_init(&ax25, &afsk_fd.fd, messageout_hook); while ((c = fgetc(fp_adc)) != EOF) { afsk_adc_isr(&afsk_fd, (int8_t)c); ax25_poll(&ax25); } return 0; }
/* constants ================================================================ */ // Les constantes ci_dessous peuvent être modifiées au besoin par l'utilisateur // Baudrate de la liaison série en baud #define SER_BAUDRATE 38400 // Période d'envoi des trames en ms #define TX_PERIOD_MS 2000 // Station destination de la trame envoyée #define APRS_DST "tlm100" // Station source de la trame envoyée #define APRS_SRC "nocall" // Information APRS envoyé #define APRS_MSG ">Test %05u SolarPi APRS http://www.btssn.net" /* private variables ======================================================== */ static xAx25 ax25; static xAx25Node path[] = AX25_PATH(AX25_CALL(APRS_DST, 0), AX25_CALL(APRS_SRC, 0)); /* internal public functions ================================================ */ int main(void) { vLedInit(); vSerialInit (SER_BAUDRATE/100, SERIAL_DEFAULT + SERIAL_WR); vAfskInit (AFSK_MODE_NOBLOCK); vAx25Init (&ax25, &xAfskPort, &xAfskPort, NULL); sei(); for (;;) { static uint16_t usCount; char msg[80]; // Numérotation de la trame afin de suivre la perte éventuelle à la
* is the hardware abstraction layer. * We do not need transmission for now, so we set transmission DAC channel to 0. */ afsk_init(&afsk, ADC_CH, 0); /* * Here we initialize AX25 context, the channel (KFile) we are going to read messages * from and the callback that will be called on incoming messages. */ ax25_init(&ax25, &afsk.fd, message_callback); /* Initialize serial port, we are going to use it to show APRS messages*/ ser_init(&ser, SER_UART0); ser_setbaudrate(&ser, 115200L); } static AX25Call path[] = AX25_PATH(AX25_CALL("apzbrt", 0), AX25_CALL("nocall", 0), AX25_CALL("wide1", 1), AX25_CALL("wide2", 2)); #define APRS_MSG ">Test BeRTOS APRS http://www.bertos.org" int main(void) { init(); ticks_t start = timer_clock(); while (1) { /* * This function will look for new messages from the AFSK channel. * It will call the message_callback() function when a new message is received. * If there's nothing to do, this function will call cpu_relax() */
*/ afsk_init(&afsk, ADC_CH, 0); /* * Here we initialize AX25 context, the channel (KFile) we are going to read messages * from and the callback that will be called on incoming messages. */ ax25_init(&ax25, &afsk.fd, message_callback); #if 1 /* Initialize serial port, we are going to use it to show APRS messages*/ ser_init(&ser, SER_UART0); ser_setbaudrate(&ser, 115200L); #endif } static AX25Call path[] = AX25_PATH(AX25_CALL(CALL_BERTOS_APRS, 0), AX25_CALL("", 0), AX25_CALL("wide1", 1), AX25_CALL("wide2", 2)); int main(void) { init(); ticks_t start = timer_clock(); unsigned char x = 0; // FIXME memcpy(path[1].call, MYCALL, 6); path[1].ssid = MYCALL_SSID; while (1) { /* As long as CONFIG_AFSK_RXTIMEOUT is set to 0, this function won't block and return immediately. */ ax25_poll(&ax25);