2010-11-24 11:20:27 +01:00
|
|
|
#include <stdio.h>
|
2010-11-19 20:10:09 +01:00
|
|
|
#include <shell.h>
|
|
|
|
#include <board_uart0.h>
|
|
|
|
#include <posix_io.h>
|
|
|
|
#include <thread.h>
|
|
|
|
#include <board.h>
|
|
|
|
#include <hwtimer.h>
|
2010-11-24 11:20:27 +01:00
|
|
|
#include <msg.h>
|
|
|
|
#include <transceiver.h>
|
2010-11-19 20:10:09 +01:00
|
|
|
|
|
|
|
#define SHELL_STACK_SIZE (4096)
|
2010-11-24 11:20:27 +01:00
|
|
|
#define RADIO_STACK_SIZE (4096)
|
2010-11-19 20:10:09 +01:00
|
|
|
|
2010-11-24 11:20:27 +01:00
|
|
|
int radio_pid;
|
2010-11-19 20:10:09 +01:00
|
|
|
char shell_stack_buffer[SHELL_STACK_SIZE];
|
2010-11-24 11:20:27 +01:00
|
|
|
char radio_stack_buffer[RADIO_STACK_SIZE];
|
|
|
|
|
|
|
|
void trans_run(char *unused);
|
|
|
|
void trans_register(char *unused);
|
2010-11-19 20:10:09 +01:00
|
|
|
|
|
|
|
shell_t shell;
|
2010-11-24 11:20:27 +01:00
|
|
|
const shell_command_t sc[] = {
|
|
|
|
{"trun", "Run the transceiver thread", trans_run},
|
|
|
|
{"treg", "Register application for CC1100", trans_register},
|
|
|
|
{NULL, NULL, NULL}};
|
|
|
|
|
|
|
|
void trans_run(char *unused) {
|
|
|
|
puts("NOP");
|
|
|
|
}
|
|
|
|
|
|
|
|
void trans_register(char *unused) {
|
|
|
|
transceiver_register(TRANSCEIVER_CC1100, active_thread->pid);
|
|
|
|
}
|
2010-11-19 20:10:09 +01:00
|
|
|
|
|
|
|
void shell_runner(void) {
|
|
|
|
shell_init(&shell, sc, uart0_readc, uart0_putc);
|
|
|
|
posix_open(uart0_handler_pid, 0);
|
|
|
|
shell_run(&shell);
|
|
|
|
}
|
|
|
|
|
2010-11-24 11:20:27 +01:00
|
|
|
void radio(void) {
|
|
|
|
msg m;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
msg_receive(&m);
|
|
|
|
printf("Received message of type %i: %lX\n", m.type, m.content.value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-19 20:10:09 +01:00
|
|
|
int main(void) {
|
|
|
|
thread_create(shell_stack_buffer, SHELL_STACK_SIZE, PRIORITY_MAIN-1, CREATE_STACKTEST, shell_runner, "shell");
|
2010-11-24 11:20:27 +01:00
|
|
|
thread_create(radio_stack_buffer, RADIO_STACK_SIZE, PRIORITY_MAIN-2, CREATE_STACKTEST, radio, "radio");
|
|
|
|
transceiver_init(TRANSCEIVER_CC1100);
|
|
|
|
transceiver_start();
|
2010-11-19 20:10:09 +01:00
|
|
|
|
|
|
|
while (1) {
|
2010-11-24 11:20:27 +01:00
|
|
|
// LED_GREEN_TOGGLE;
|
2010-11-19 20:10:09 +01:00
|
|
|
hwtimer_wait(1000 * 1000);
|
|
|
|
}
|
|
|
|
}
|