Cleanup and refactoring of the STM32w port
This is a general cleanup of things like code style issues and code structure of the STM32w port to make it more like the rest of Contiki is structured.
This commit is contained in:
parent
12b3d02ba1
commit
a5046e83c7
118 changed files with 4470 additions and 4281 deletions
|
@ -1,3 +1,8 @@
|
|||
/**
|
||||
* \addtogroup mb851-platform
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2010, STMicroelectronics.
|
||||
* All rights reserved.
|
||||
|
@ -29,7 +34,6 @@
|
|||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Shell function for temp and acc sensors.
|
||||
|
@ -49,40 +53,33 @@
|
|||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(shell_sensors_process, "sensors");
|
||||
SHELL_COMMAND(sensors_command,
|
||||
"sensors",
|
||||
"sensors {temp|acc}: get sensor value",
|
||||
&shell_sensors_process);
|
||||
"sensors",
|
||||
"sensors {temp|acc}: get sensor value", &shell_sensors_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_sensors_process, ev, data)
|
||||
{
|
||||
|
||||
char str_buf[22];
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
PROCESS_BEGIN();
|
||||
if(data == NULL) {
|
||||
shell_output_str(&sensors_command,
|
||||
"sensors {temp|acc}: a sensor must be specified", "");
|
||||
"sensors {temp|acc}: a sensor must be specified", "");
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
|
||||
if(strcmp(data,"temp")==0) {
|
||||
|
||||
|
||||
if(strcmp(data, "temp") == 0) {
|
||||
unsigned int temp = temperature_sensor.value(0);
|
||||
|
||||
snprintf(str_buf,sizeof(str_buf),"%d.%d degC",temp/10,temp-(temp/10)*10);
|
||||
|
||||
snprintf(str_buf, sizeof(str_buf), "%d.%d degC", temp / 10,
|
||||
temp - (temp / 10) * 10);
|
||||
shell_output_str(&sensors_command, "Temp: ", str_buf);
|
||||
|
||||
} else {
|
||||
if(strcmp(data, "acc") == 0) {
|
||||
snprintf(str_buf, sizeof(str_buf), "%d,%d,%d) mg",
|
||||
acc_sensor.value(ACC_X_AXIS), acc_sensor.value(ACC_Y_AXIS),
|
||||
acc_sensor.value(ACC_Z_AXIS));
|
||||
shell_output_str(&sensors_command, "(X,Y,Z): (", str_buf);
|
||||
}
|
||||
}
|
||||
else if (strcmp(data,"acc")==0) {
|
||||
|
||||
snprintf(str_buf,sizeof(str_buf),"%d,%d,%d) mg",acc_sensor.value(ACC_X_AXIS),acc_sensor.value(ACC_Y_AXIS),acc_sensor.value(ACC_Z_AXIS));
|
||||
|
||||
shell_output_str(&sensors_command, "(X,Y,Z): (", str_buf);
|
||||
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -90,7 +87,7 @@ void
|
|||
shell_sensors_init(void)
|
||||
{
|
||||
SENSORS_ACTIVATE(acc_sensor);
|
||||
|
||||
shell_register_command(&sensors_command);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue