contiki/tests/rftest-rx.c

52 lines
993 B
C
Raw Normal View History

2010-02-26 22:44:39 +00:00
#include <mc1322x.h>
#include <board.h>
2010-03-03 18:39:14 +00:00
#include <stdio.h>
2010-02-26 22:44:39 +00:00
#include "tests.h"
#include "config.h"
2009-04-02 18:54:02 +00:00
#define LED LED_GREEN
void maca_rx_callback(volatile packet_t *p) {
(void)p;
2010-03-17 02:03:38 +00:00
gpio_data_set(1ULL<< LED);
gpio_data_reset(1ULL<< LED);
}
2010-03-08 23:12:31 +00:00
void main(void) {
2010-03-07 02:47:22 +00:00
volatile packet_t *p;
2009-04-02 18:54:02 +00:00
2010-03-17 02:03:38 +00:00
gpio_data(0);
gpio_pad_dir_set( 1ULL << LED );
/* read from the data register instead of the pad */
/* this is needed because the led clamps the voltage low */
2010-03-17 02:03:38 +00:00
gpio_data_sel( 1ULL << LED);
/* trim the reference osc. to 24MHz */
trim_xtal();
2010-03-09 23:23:40 +00:00
uart_init(INC, MOD, SAMP);
2010-03-07 02:47:22 +00:00
2009-04-11 21:17:37 +00:00
vreg_init();
maca_init();
2010-03-01 18:01:51 +00:00
2010-03-08 22:36:42 +00:00
/* sets up tx_on, should be a board specific item */
2010-03-17 02:03:38 +00:00
// *GPIO_FUNC_SEL2 = (0x01 << ((44-16*2)*2));
gpio_pad_dir_set( 1ULL << 44 );
set_power(0x0f); /* 0dbm */
set_channel(0); /* channel 11 */
print_welcome("rftest-rx");
2009-04-02 18:54:02 +00:00
while(1) {
2010-03-07 02:47:22 +00:00
if((p = rx_packet())) {
/* print and free the packet */
printf("rftest-rx --- ");
print_packet(p);
free_packet(p);
}
2010-03-07 02:47:22 +00:00
}
}