From 4e773191d447ac434536262a6f204dd991d4ad77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 11 Nov 2015 15:26:01 +0100 Subject: tmp --- KNOWN-PROBLEMS.md | 4 ++-- adc.h | 9 +++++++++ conffile | 4 ++-- examples/dht22usart/dht22.c | 2 +- examples/dht22usart/makefile | 3 ++- sensor_dht22.h | 6 +++--- src/sensor_dht22.c | 9 +++++---- tasks.h | 9 +++++++++ 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/KNOWN-PROBLEMS.md b/KNOWN-PROBLEMS.md index a5862c8..65a126b 100644 --- a/KNOWN-PROBLEMS.md +++ b/KNOWN-PROBLEMS.md @@ -2,5 +2,5 @@ USART ----- * Third char is lost when USART is used with output buffer. Probably buffer problem or some synchronization problem. This happens only after start. So - problem is probably connected with buffers initialization. But simulation not - revealed any problem. + problem is probably connected with buffers initialization. But simulation didn't + reveale any problems. diff --git a/adc.h b/adc.h index e69de29..3eaea41 100644 --- a/adc.h +++ b/adc.h @@ -0,0 +1,9 @@ +#include +#include +#include + +#ifndef _IOE_ADC_H_ +#define _IOE_ADC_H_ + + +#endif /* _IOE_ADC_H_ */ diff --git a/conffile b/conffile index b8f280c..6342804 100644 --- a/conffile +++ b/conffile @@ -4,8 +4,8 @@ MCU:: menu "MCU name" F_CPU:: - type int - default 16000000 + type float + default 16 menu "CPU frequency" ################################################################################# diff --git a/examples/dht22usart/dht22.c b/examples/dht22usart/dht22.c index 97a91ee..ec643aa 100644 --- a/examples/dht22usart/dht22.c +++ b/examples/dht22usart/dht22.c @@ -3,7 +3,7 @@ #include #include #include "../../usart.h" -#include "../../sensor_dht22.h" +//#include "../../sensor_dht22.h" void rec(uint8_t data) { if (data == '\r') { diff --git a/examples/dht22usart/makefile b/examples/dht22usart/makefile index 214aa63..fb69068 100644 --- a/examples/dht22usart/makefile +++ b/examples/dht22usart/makefile @@ -15,7 +15,8 @@ IOE_CFLAGS = -Os -ffunction-sections -fdata-sections -fshort-enums -Wall \ -DCONFIG_IOE_USART_STOPBIT=USART_STOPBIT_SINGLE \ -DCONFIG_IOE_USART_DATABITS=8 \ -DCONFIG_IOE_TIMERS \ - -DCONFIG_IOE_SENSOR_DHT22 + -DCONFIG_IOE_SENSOR_DHT22 \ + -DCONFIG_IOE_SENSOR_DHT22_TIMER=COUNTER0_PWM all: dht22.hex @echo Now you can flash dht22.hex to your chip. diff --git a/sensor_dht22.h b/sensor_dht22.h index 0776b77..6ddcf9c 100644 --- a/sensor_dht22.h +++ b/sensor_dht22.h @@ -5,8 +5,8 @@ #include "tasks.h" #include "timer.h" -#ifndef _DHT22_H_ -#define _DHT22_H_ +#ifndef _IOE_SENSOR_DHT22_H_ +#define _IOE_SENSOR_DHT22_H_ struct dht22_value { uint8_t integral; @@ -36,4 +36,4 @@ void dht22_init(uint8_t port); int8_t dht22_read(uint8_t portindex, struct dht22_value *rh, struct dht22_value *t); -#endif /* _DHT22_H_ */ +#endif /* _IOE_SENSOR_DHT22_H_ */ diff --git a/src/sensor_dht22.c b/src/sensor_dht22.c index 0ae7c01..7791060 100644 --- a/src/sensor_dht22.c +++ b/src/sensor_dht22.c @@ -35,7 +35,7 @@ inline void dht22_init(uint8_t pi) { inline void dht22_read_deac(uint8_t status) { - dht22_measurement.status = status; + dht22_measurement.status = status; // Disable pin change interrupt *(PPP.PCMSK) &= ~PPP.PCMSK_MASK; timer_disable(CONFIG_IOE_SENSOR_DHT22_TIMER); @@ -65,8 +65,8 @@ void dht22_read_pcint(void) { } break; default: - if (((*(PPP.PIN) & PPP.MASK) && dht22_measurement.port_status == 3) || - !(*(PPP.PIN & PPP.MASK))) + if (((*(PPP.PIN) & PPP.MASK) && dht22_measurement.port_status == 3) + || !(*(PPP.PIN & PPP.MASK))) return; dht22_measurement.port_status--; } @@ -89,7 +89,8 @@ int8_t dht22_read(uint8_t pi, struct dht22_value *rh, _delay_us(500); // Initialize timer timer_init(CONFIG_IOE_SENSOR_DHT22_TIMER, TIMER_DIVIDER_64); - timer_sethook(CONFIG_IOE_SENSOR_DHT22_TIMER, dht22_read_timer_overflow); + timer_sethook(CONFIG_IOE_SENSOR_DHT22_TIMER, + dht22_read_timer_overflow); // Set pin change interrupt *(PP.PCMSK) |= PP.PCMSK_MASK; // Set port as output and pull-up resistor diff --git a/tasks.h b/tasks.h index f773e17..60653b3 100644 --- a/tasks.h +++ b/tasks.h @@ -25,6 +25,15 @@ int8_t taskDelayTillT(int8_t *boolean, uin16_t us); void taskDelayTillF(int8_t (*fnc)(void)); void taskDelayTillFT(int8_t (*fnc)(void), uint16_t us); +struct Mutex { +}; +void takeMutex(void); +int8_t takeMutexT(uint16_t timeout); +void giveMutex(void); + +struct Semaphore { +}; + #else /* CONFIG_IOE_TASKS */ #define taskDelay(US) _delay_us(US) -- cgit v1.2.3