add s command to disable mcusleep
This commit is contained in:
parent
31ec8687e4
commit
0b24e047c5
|
@ -79,23 +79,39 @@ extern resource_t res_event, res_separate;
|
||||||
#endif /* PLATFORM_HAS_BUTTON */
|
#endif /* PLATFORM_HAS_BUTTON */
|
||||||
|
|
||||||
volatile uint8_t mcusleepcycleval;
|
volatile uint8_t mcusleepcycleval;
|
||||||
|
/* 0 dont sleep; 1 sleep */
|
||||||
|
uint8_t mcusleep;
|
||||||
|
|
||||||
/*-------------- enabled sleep mode ----------------------------------------*/
|
/*-------------- enabled sleep mode ----------------------------------------*/
|
||||||
void
|
void
|
||||||
mcu_sleep_init(void)
|
mcu_sleep_init(void)
|
||||||
{
|
{
|
||||||
mcusleepcycleval=mcusleepcycle;
|
mcusleepcycleval=mcusleepcycle;
|
||||||
|
mcu_sleep_enable();
|
||||||
|
}
|
||||||
|
void
|
||||||
|
mcu_sleep_disable(void)
|
||||||
|
{
|
||||||
|
mcusleep=0;
|
||||||
|
mcu_sleep_off();
|
||||||
|
}
|
||||||
|
void
|
||||||
|
mcu_sleep_enable(void)
|
||||||
|
{
|
||||||
|
mcusleep=1;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
mcu_sleep_on(void)
|
mcu_sleep_on(void)
|
||||||
{
|
{
|
||||||
mcusleepcycle= mcusleepcycleval;
|
if(mcusleep){
|
||||||
|
mcusleepcycle= mcusleepcycleval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*--------------- disable sleep mode ---------------------------------------*/
|
/*--------------- disable sleep mode ---------------------------------------*/
|
||||||
void
|
void
|
||||||
mcu_sleep_off(void)
|
mcu_sleep_off(void)
|
||||||
{
|
{
|
||||||
mcusleepcycle=0;
|
mcusleepcycle=0;
|
||||||
}
|
}
|
||||||
/*---------------- set duty cycle value ------------------------------------*/
|
/*---------------- set duty cycle value ------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -52,8 +52,12 @@
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
|
||||||
/*--------------- enable sleep mode ---------------------------------------*/
|
/*--------------- enable sleep mode ---------------------------------------*/
|
||||||
void mcu_sleep_on(void);
|
void mcu_sleep_enable(void);
|
||||||
/*--------------- disable sleep mode ---------------------------------------*/
|
/*--------------- disable sleep mode ---------------------------------------*/
|
||||||
|
void mcu_sleep_disable(void);
|
||||||
|
/*--------------- sleep mode on---------------------------------------*/
|
||||||
|
void mcu_sleep_on(void);
|
||||||
|
/*--------------- sleep mode off---------------------------------------*/
|
||||||
void mcu_sleep_off(void);
|
void mcu_sleep_off(void);
|
||||||
/*---------------- set sleep value ------------------------------------*/
|
/*---------------- set sleep value ------------------------------------*/
|
||||||
void mcu_sleep_set(uint8_t value);
|
void mcu_sleep_set(uint8_t value);
|
||||||
|
|
|
@ -43,8 +43,8 @@
|
||||||
#include "sys/cc.h"
|
#include "sys/cc.h"
|
||||||
#include "dev/radio.h"
|
#include "dev/radio.h"
|
||||||
#include "shell-merkur.h"
|
#include "shell-merkur.h"
|
||||||
//#include "extended-rf-api.h"
|
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
|
#include "arduino-process.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS(shell_txpower_process, "txpower");
|
PROCESS(shell_txpower_process, "txpower");
|
||||||
|
@ -77,7 +77,30 @@ SHELL_COMMAND(saverfparam_command,
|
||||||
"saverfparam",
|
"saverfparam",
|
||||||
"saverfparam <> save radio parameters txpower, channel, panid to eeprom settingsmanager",
|
"saverfparam <> save radio parameters txpower, channel, panid to eeprom settingsmanager",
|
||||||
&shell_saverfparam_process);
|
&shell_saverfparam_process);
|
||||||
|
PROCESS(shell_s_process, "s");
|
||||||
|
SHELL_COMMAND(s_command,
|
||||||
|
"s",
|
||||||
|
"s disable mcu_sleep",
|
||||||
|
&shell_s_process);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
PROCESS_THREAD(shell_s_process, ev, data)
|
||||||
|
{
|
||||||
|
// radio_value_t value;
|
||||||
|
const char *newptr;
|
||||||
|
|
||||||
|
PROCESS_BEGIN();
|
||||||
|
shell_strtolong(data, &newptr);
|
||||||
|
|
||||||
|
if(newptr == data) {
|
||||||
|
mcu_sleep_disable();
|
||||||
|
shell_output_str(&txpower_command, "disable mcusleep", 0);
|
||||||
|
} else {
|
||||||
|
mcu_sleep_enable();
|
||||||
|
shell_output_str(&txpower_command, "enable mcusleep", 0);
|
||||||
|
}
|
||||||
|
PROCESS_END();
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(shell_txpower_process, ev, data)
|
PROCESS_THREAD(shell_txpower_process, ev, data)
|
||||||
{
|
{
|
||||||
|
@ -232,6 +255,6 @@ shell_merkur_init(void)
|
||||||
shell_register_command(&panid_command);
|
shell_register_command(&panid_command);
|
||||||
shell_register_command(&macconf_command);
|
shell_register_command(&macconf_command);
|
||||||
shell_register_command(&saverfparam_command);
|
shell_register_command(&saverfparam_command);
|
||||||
|
shell_register_command(&s_command);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
//#define RDC_CONF_PT_YIELD_OFF
|
//#define RDC_CONF_PT_YIELD_OFF
|
||||||
|
|
||||||
/* For Debug: Dont allow MCU sleeping between channel checks */
|
/* For Debug: Dont allow MCU sleeping between channel checks */
|
||||||
#undef RDC_CONF_MCU_SLEEP
|
//#undef RDC_CONF_MCU_SLEEP
|
||||||
#define RDC_CONF_MCU_SLEEP 0
|
//#define RDC_CONF_MCU_SLEEP 0
|
||||||
|
|
||||||
/* Disabling RDC for demo purposes. Core updates often require more memory. */
|
/* Disabling RDC for demo purposes. Core updates often require more memory. */
|
||||||
/* For projects, optimize memory and enable RDC again. */
|
/* For projects, optimize memory and enable RDC again. */
|
||||||
|
|
Loading…
Reference in a new issue