mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:12:57 +01:00
* added set offset shell command for sht11
* introduced command separator for pyterm * some cosmetics
This commit is contained in:
parent
9916bd33aa
commit
88c0ec84ee
@ -17,22 +17,22 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include "tcb.h"
|
||||
#include "kernel.h"
|
||||
#include "kernel_intern.h"
|
||||
#include "sched.h"
|
||||
#include "flags.h"
|
||||
#include "cpu.h"
|
||||
#include "lpm.h"
|
||||
#include "thread.h"
|
||||
#include "hwtimer.h"
|
||||
#include <tcb.h>
|
||||
#include <kernel.h>
|
||||
#include <kernel_intern.h>
|
||||
#include <sched.h>
|
||||
#include <flags.h>
|
||||
#include <cpu.h>
|
||||
#include <lpm.h>
|
||||
#include <thread.h>
|
||||
#include <hwtimer.h>
|
||||
|
||||
#ifdef MODULE_AUTO_INIT
|
||||
#include <auto_init.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_DEBUG
|
||||
#include "debug.h"
|
||||
#include <debug.h>
|
||||
|
||||
volatile tcb *sched_threads[MAXTHREADS];
|
||||
volatile tcb *active_thread;
|
||||
|
@ -9,8 +9,8 @@
|
||||
#ifndef __LPC2387_H
|
||||
#define __LPC2387_H
|
||||
|
||||
#include "lpc23xx.h"
|
||||
#include "bitarithm.h"
|
||||
#include <lpc23xx.h>
|
||||
#include <bitarithm.h>
|
||||
|
||||
#define F_CCO 288000000
|
||||
#define CL_CPU_DIV 4 ///< CPU clock divider
|
||||
|
@ -55,22 +55,14 @@ static enum lpm_mode lpm;
|
||||
extern void init_clks1(void);
|
||||
extern void init_clks2(void);
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
#define ENABLE_DEBUG 1
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
void
|
||||
lpm_init(void)
|
||||
{
|
||||
void lpm_init(void) {
|
||||
lpm = LPM_ON;
|
||||
}
|
||||
|
||||
#define LPM_DEBUG 0
|
||||
#define LPM_DEBUG 1
|
||||
|
||||
void lpm_begin_awake(void) {
|
||||
if (lpm >= LPM_SLEEP ) { // wake up from deep sleep
|
||||
@ -118,8 +110,8 @@ enum lpm_mode lpm_set(enum lpm_mode target) {
|
||||
|
||||
lpm = target;
|
||||
|
||||
#if DEBUG
|
||||
PRINTF("# LPM power down %u -> %u", lpm, target);
|
||||
#if iENABLE_DEBUG
|
||||
DEBUG("# LPM power down %u -> %u", lpm, target);
|
||||
#endif
|
||||
|
||||
PCON |= target_flags; // set target power mode
|
||||
|
@ -13,6 +13,7 @@ extern void _date_handler(char* now);
|
||||
extern void _get_temperature_handler(char* unused);
|
||||
extern void _get_humidity_handler(char* unused);
|
||||
extern void _get_weather_handler(char* unused);
|
||||
extern void _set_offset_handler(char* offset);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_LTC4150
|
||||
@ -31,6 +32,7 @@ const shell_command_t _shell_command_list[] = {
|
||||
{"temp", "Prints measured temperature.", _get_temperature_handler},
|
||||
{"hum", "Prints measured humidity.", _get_humidity_handler},
|
||||
{"weather", "Prints measured humidity and temperature.", _get_weather_handler},
|
||||
{"offset", "Set temperature offset.", _set_offset_handler},
|
||||
#endif
|
||||
#ifdef MODULE_LTC4150
|
||||
{"cur", "Prints current and average power consumption.", _get_current_handler},
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <sht11.h>
|
||||
#include <string.h>
|
||||
|
||||
extern float sht11_temperature_offset;
|
||||
|
||||
void _get_humidity_handler(char* unused) {
|
||||
uint8_t success;
|
||||
@ -39,3 +42,12 @@ void _get_weather_handler(char* unused) {
|
||||
}
|
||||
}
|
||||
|
||||
void _set_offset_handler(char* offset) {
|
||||
if (strlen(offset) == 6) {
|
||||
puts("Usage: offset <OFFSET>");
|
||||
}
|
||||
else {
|
||||
sscanf(offset, "offset %f", &sht11_temperature_offset);
|
||||
printf("Temperature offset set to %f\n", sht11_temperature_offset);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ from datetime import datetime
|
||||
class MyCmd(cmd.Cmd):
|
||||
|
||||
def default(self, line):
|
||||
self.stdout.write(line + "\n")
|
||||
for tok in line.split(';'):
|
||||
self.stdout.write(tok.strip() + "\n")
|
||||
|
||||
def do_help(self, line):
|
||||
self.stdout.write("help\n")
|
||||
|
Loading…
Reference in New Issue
Block a user