Commit a56a4bff authored by Guillaume Gonnet's avatar Guillaume Gonnet
Browse files

Continue command module.

parent 21e7c6c5
...@@ -11,7 +11,7 @@ This project is under the MIT license ...@@ -11,7 +11,7 @@ This project is under the MIT license
// Debug "d" command. // Debug "d" command.
int cmds_debug(int argc, char **argv) int cmd_debug(int argc, char **argv)
{ {
// TODO. // TODO.
...@@ -21,7 +21,7 @@ int cmds_debug(int argc, char **argv) ...@@ -21,7 +21,7 @@ int cmds_debug(int argc, char **argv)
// Reset "r" command. // Reset "r" command.
int cmds_reset(int argc, char **argv) int cmd_reset(int argc, char **argv)
{ {
// TODO. // TODO.
......
...@@ -14,8 +14,8 @@ This project is under the MIT license ...@@ -14,8 +14,8 @@ This project is under the MIT license
// All command entries. // All command entries.
static app_cmd_ent_t cmd_entries[] = { static app_cmd_ent_t cmd_entries[] = {
{ "d", cmds_debug }, { "d", cmd_debug },
{ "r", cmds_reset }, { "r", cmd_reset },
}; };
// Number of entries. // Number of entries.
......
...@@ -44,6 +44,9 @@ enum { ...@@ -44,6 +44,9 @@ enum {
// Parse a command. // Parse a command.
int cmds_parse(char *line); int cmds_parse(char *line);
// Initialize command module.
void cmds_init(void);
// All application commands. // All application commands.
int cmds_debug(int argc, char **argv); int cmd_debug(int argc, char **argv);
int cmds_reset(int argc, char **argv); int cmd_reset(int argc, char **argv);
/*
Received from LoRaWAN or UART RX.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
#include "commands.h"
#include "lorariot.h"
#include <thread.h>
#include <msg.h>
// Message queue of receive thread.
#define MSG_QUEUE_SIZE (4U)
static msg_t msg_queue[MSG_QUEUE_SIZE];
// LoRaRIOT event loop.
#define RECV_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
static char recv_stack[RECV_STACKSIZE];
// Thread that receive commands.
static void *recv_thread(void *args)
{
(void)args;
msg_init_queue(msg_queue, MSG_QUEUE_SIZE);
while (true) {
msg_t msg;
msg_receive(&msg);
switch (msg.type) {
// TODO.
}
}
return NULL;
}
// Initialize command module.
void cmds_init(void)
{
kernel_pid_t pid = thread_create(recv_stack, sizeof(recv_stack),
THREAD_PRIORITY_MAIN + 3, THREAD_CREATE_STACKTEST,
recv_thread, NULL, "recv-thread");
lorariot_set_recv_thread(pid);
}
...@@ -9,6 +9,7 @@ This project is under the MIT license ...@@ -9,6 +9,7 @@ This project is under the MIT license
#include "lorariot.h" #include "lorariot.h"
#include "providers/providers.h" #include "providers/providers.h"
#include "commands/commands.h"
#include <stdio.h> #include <stdio.h>
...@@ -17,6 +18,7 @@ This project is under the MIT license ...@@ -17,6 +18,7 @@ This project is under the MIT license
int main(void) int main(void)
{ {
lorariot_init(); lorariot_init();
cmds_init();
#if RESET_ON_START #if RESET_ON_START
// If enable, reset all providers when the application starts. // If enable, reset all providers when the application starts.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment