-
Notifications
You must be signed in to change notification settings - Fork 1
base bms cli #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
base bms cli #49
Changes from all commits
0b2bcf4
79da43e
655b53d
65aef26
a65ffe8
6a4788b
779c9e3
4c1f1c2
4e9181c
db17efb
22fb4d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.metadata/ | ||
.vscode/settings.json | ||
RemoteSystemsTempFiles/.project | ||
.project |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* task_command_line.h | ||
* | ||
* Created on: Oct 25, 2022 | ||
* Author: lonam | ||
*/ | ||
|
||
#ifndef PHANTOM_DRIVERS_RTOS_INCLUDE_TASK_COMMAND_LINE_H_ | ||
#define PHANTOM_DRIVERS_RTOS_INCLUDE_TASK_COMMAND_LINE_H_ | ||
|
||
void initializeCommandLine(); | ||
|
||
|
||
|
||
#endif /* PHANTOM_DRIVERS_RTOS_INCLUDE_TASK_COMMAND_LINE_H_ */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* task_command_line.c | ||
* | ||
* Created on: Oct 25, 2022 | ||
* Author: lonam | ||
*/ | ||
#include "task_command_line.h" | ||
|
||
#include "FreeRTOS.h" | ||
#include "FreeRTOSConfig.h" | ||
#include "os_task.h" | ||
|
||
#include "Phantom_sci.h" | ||
#include "hwConfig.h" | ||
|
||
static uint8 previous; | ||
static xTaskHandle commandLineTaskHandle; | ||
static void CommandLineTask(void* params){ | ||
while(1){ | ||
uint8 msg; | ||
sciReceive(PC_UART, 1, &msg); | ||
if(msg==previous){ | ||
// do nothing | ||
} else if(msg=='1'){ | ||
UARTprintf("Message 1 received\r\n"); | ||
} else if(msg=='2'){ | ||
UARTprintf("Message 2 received\r\n"); | ||
} else if(msg=='3'){ | ||
UARTprintf("Message 3 received\r\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that the code is written it's easier to see that a switch statement fits more nicely with this logic.
|
||
} | ||
previous = msg; | ||
vTaskDelay(1000); | ||
} | ||
} | ||
Comment on lines
+19
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's easy to see now that there are 3 logical parts:
spacing (along with comments) can make this clearer |
||
|
||
void initializeCommandLine() | ||
{ | ||
UARTInit(PC_UART, 9600); | ||
|
||
xTaskCreate(CommandLineTask, "CommandLineTask", configMINIMAL_STACK_SIZE, ( void * ) 1, tskIDLE_PRIORITY, &commandLineTaskHandle); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when creating actual commands let's use proper macros. This makes it easier to read and change and uses no program memory because the values are placed at compile time