Skip to content

Commit

Permalink
Добавлена работа таймеров и запись-чтение по I2C eeprom
Browse files Browse the repository at this point in the history
  • Loading branch information
g_tanchin committed Jul 8, 2016
1 parent 4bad4af commit 9f3bc6e
Show file tree
Hide file tree
Showing 24 changed files with 892 additions and 458 deletions.
12 changes: 6 additions & 6 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,18 @@
</tool>
</toolChain>
</folderInfo>
<fileInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.290790354.1275434884" name="stm32f0xx_rtc.c" rcbsApplicability="disable" resourcePath="system/src/stm32f0-stdperiph/stm32f0xx_rtc.c" toolsToInvoke="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1132819807.1870307104">
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1132819807.1870307104" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1132819807"/>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.557045612" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1569674405" name="Resource Custom Build Step Input Type">
<fileInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.290790354.609845339" name="stm32f0xx_i2c.c" rcbsApplicability="disable" resourcePath="system/src/stm32f0-stdperiph/stm32f0xx_i2c.c" toolsToInvoke="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1132819807.1960962378">
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1132819807.1960962378" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1132819807"/>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.275580609" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1135229212" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1856605519" name="Resource Custom Build Step Output Type"/>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1473454069" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<sourceEntries>
<entry excluding="onewire.0.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry excluding="src/stm32f0-stdperiph/stm32f0xx_cec.c|src/stm32f0-stdperiph/stm32f0xx_flash.c|src/stm32f0-stdperiph/stm32f0xx_spi.c|src/stm32f0-stdperiph/stm32f0xx_adc.c|src/stm32f0-stdperiph/stm32f0xx_can.c|src/stm32f0-stdperiph/stm32f0xx_exti.c|src/stm32f0-stdperiph/stm32f0xx_iwdg.c|src/stm32f0-stdperiph/stm32f0xx_crc.c|src/stm32f0-stdperiph/stm32f0xx_i2c.c|src/stm32f0-stdperiph/stm32f0xx_pwr.c|src/stm32f0-stdperiph/stm32f0xx_wwdg.c|src/stm32f0-stdperiph/stm32f0xx_dac.c|src/stm32f0-stdperiph/stm32f0xx_misc.c|src/stm32f0-stdperiph/stm32f0xx_dbgmcu.c|src/stm32f0-stdperiph/stm32f0xx_crs.c|src/stm32f0-stdperiph/stm32f0xx_comp.c|src/stm32f0-stdperiph/stm32f0xx_tim.c|src/stm32f0-stdperiph/stm32f0xx_syscfg.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/>
<entry excluding="src/stm32f0-stdperiph/stm32f0xx_cec.c|src/stm32f0-stdperiph/stm32f0xx_flash.c|src/stm32f0-stdperiph/stm32f0xx_spi.c|src/stm32f0-stdperiph/stm32f0xx_adc.c|src/stm32f0-stdperiph/stm32f0xx_can.c|src/stm32f0-stdperiph/stm32f0xx_exti.c|src/stm32f0-stdperiph/stm32f0xx_iwdg.c|src/stm32f0-stdperiph/stm32f0xx_crc.c|src/stm32f0-stdperiph/stm32f0xx_pwr.c|src/stm32f0-stdperiph/stm32f0xx_wwdg.c|src/stm32f0-stdperiph/stm32f0xx_dac.c|src/stm32f0-stdperiph/stm32f0xx_misc.c|src/stm32f0-stdperiph/stm32f0xx_dbgmcu.c|src/stm32f0-stdperiph/stm32f0xx_crs.c|src/stm32f0-stdperiph/stm32f0xx_comp.c|src/stm32f0-stdperiph/stm32f0xx_tim.c|src/stm32f0-stdperiph/stm32f0xx_syscfg.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="system"/>
</sourceEntries>
</configuration>
</storageModule>
Expand Down
Binary file modified Debug/expedition.bin
Binary file not shown.
Binary file removed Debug/expedition.elf
Binary file not shown.
1,119 changes: 715 additions & 404 deletions Debug/expedition.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Debug/src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ src/main.o: ../src/main.c \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_dma.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h \
Expand Down Expand Up @@ -39,6 +40,8 @@ src/main.o: ../src/main.c \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:
Expand Down
3 changes: 3 additions & 0 deletions Debug/src/my_function.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ src/my_function.o: ../src/my_function.c \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_dma.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h \
Expand Down Expand Up @@ -37,6 +38,8 @@ src/my_function.o: ../src/my_function.c \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:
Expand Down
3 changes: 3 additions & 0 deletions Debug/src/stm32xx_it.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ src/stm32xx_it.o: ../src/stm32xx_it.c \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_dma.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h \
Expand Down Expand Up @@ -37,6 +38,8 @@ src/stm32xx_it.o: ../src/stm32xx_it.c \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:
Expand Down
3 changes: 3 additions & 0 deletions Debug/src/subdir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/_write.c \
../src/eeprom.c \
../src/init.c \
../src/logger.c \
../src/main.c \
Expand All @@ -15,6 +16,7 @@ C_SRCS += \

OBJS += \
./src/_write.o \
./src/eeprom.o \
./src/init.o \
./src/logger.o \
./src/main.o \
Expand All @@ -25,6 +27,7 @@ OBJS += \

C_DEPS += \
./src/_write.d \
./src/eeprom.d \
./src/init.d \
./src/logger.d \
./src/main.d \
Expand Down
3 changes: 3 additions & 0 deletions Debug/system/src/cmsis/system_stm32f0xx.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ system/src/cmsis/system_stm32f0xx.o: \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_dma.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h
Expand All @@ -34,6 +35,8 @@ system/src/cmsis/system_stm32f0xx.o: \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:
Expand Down
3 changes: 3 additions & 0 deletions Debug/system/src/cortexm/_initialize_hardware.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ system/src/cortexm/_initialize_hardware.o: \
/home/jet/work/workspace/expedition/system/inc/cmsis/stm32f0xx.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h
Expand Down Expand Up @@ -40,6 +41,8 @@ system/src/cortexm/_initialize_hardware.o: \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:
Expand Down
3 changes: 3 additions & 0 deletions Debug/system/src/cortexm/_reset_hardware.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ system/src/cortexm/_reset_hardware.o: \
/home/jet/work/workspace/expedition/system/inc/cmsis/stm32f0xx.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h
Expand Down Expand Up @@ -40,6 +41,8 @@ system/src/cortexm/_reset_hardware.o: \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:
Expand Down
3 changes: 3 additions & 0 deletions Debug/system/src/cortexm/exception_handlers.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ system/src/cortexm/exception_handlers.o: \
/home/jet/work/workspace/expedition/system/inc/cmsis/stm32f0xx.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h \
Expand Down Expand Up @@ -45,6 +46,8 @@ system/src/cortexm/exception_handlers.o: \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:
Expand Down
3 changes: 3 additions & 0 deletions Debug/system/src/stm32f0-stdperiph/stm32f0xx_gpio.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ system/src/stm32f0-stdperiph/stm32f0xx_gpio.o: \
/home/jet/work/workspace/expedition/inc/stm32f0xx_conf.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_dma.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h
Expand All @@ -34,6 +35,8 @@ system/src/stm32f0-stdperiph/stm32f0xx_gpio.o: \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rcc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:
Expand Down
3 changes: 3 additions & 0 deletions Debug/system/src/stm32f0-stdperiph/stm32f0xx_rcc.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ system/src/stm32f0-stdperiph/stm32f0xx_rcc.o: \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_dma.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_exti.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h \
/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h

Expand All @@ -36,6 +37,8 @@ system/src/stm32f0-stdperiph/stm32f0xx_rcc.o: \

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_gpio.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_i2c.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_rtc.h:

/home/jet/work/workspace/expedition/system/inc/stm32f0-stdperiph/stm32f0xx_usart.h:
3 changes: 3 additions & 0 deletions Debug/system/src/stm32f0-stdperiph/subdir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@
C_SRCS += \
../system/src/stm32f0-stdperiph/stm32f0xx_dma.c \
../system/src/stm32f0-stdperiph/stm32f0xx_gpio.c \
../system/src/stm32f0-stdperiph/stm32f0xx_i2c.c \
../system/src/stm32f0-stdperiph/stm32f0xx_rcc.c \
../system/src/stm32f0-stdperiph/stm32f0xx_rtc.c \
../system/src/stm32f0-stdperiph/stm32f0xx_usart.c

OBJS += \
./system/src/stm32f0-stdperiph/stm32f0xx_dma.o \
./system/src/stm32f0-stdperiph/stm32f0xx_gpio.o \
./system/src/stm32f0-stdperiph/stm32f0xx_i2c.o \
./system/src/stm32f0-stdperiph/stm32f0xx_rcc.o \
./system/src/stm32f0-stdperiph/stm32f0xx_rtc.o \
./system/src/stm32f0-stdperiph/stm32f0xx_usart.o

C_DEPS += \
./system/src/stm32f0-stdperiph/stm32f0xx_dma.d \
./system/src/stm32f0-stdperiph/stm32f0xx_gpio.d \
./system/src/stm32f0-stdperiph/stm32f0xx_i2c.d \
./system/src/stm32f0-stdperiph/stm32f0xx_rcc.d \
./system/src/stm32f0-stdperiph/stm32f0xx_rtc.d \
./system/src/stm32f0-stdperiph/stm32f0xx_usart.d
Expand Down
26 changes: 21 additions & 5 deletions inc/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
#define LOGGER_H_

#include "onewire.h"
#include "my_time.h"

typedef struct {
uint32_t time;
tXtime xTime;
uint16_t toData[TO_DEV_NUM];
};
} tToLogUnit;

typedef struct {
tXtime xTime;
uint16_t ddData;
} tDdLogUnit;

typedef struct {
uint8_t begin;
Expand All @@ -24,15 +30,25 @@ typedef struct {
uint32_t len;
} tLogBuf;

#define TO_LOG_RECORD_NUM 10080
#define TO_LOG_RECORD_SIZE sizeof(tToLogUnit)
#define TO_LOG_START_ADDR 512
#define TO_LOG_END_ADDR (TO_LOG_START_ADDR + (TO_LOG_RECORD_NUM * TO_LOG_RECORD_SIZE) - 1)

#define DD_LOG_RECORD_NUM 1600
#define DD_LOG_RECORD_SIZE sizeof(tDdLogUnit)
#define DD_LOG_START_ADDR (TO_LOG_END_ADDR + 1)
#define DD_LOG_END_ADDR (DD_LOG_START_ADDR + (DD_LOG_RECORD_NUM * DD_LOG_RECORD_SIZE) - 1)

extern tLogBuf toLogBuff;
extern tLogBuf ddLogBuff;

// Записывает байт в буфер
int8_t logWriteBuff( tLogBuf * buf, uint8_t * data );

// Считывает байт из буфера. Если буфер пуст - возвращает (-1)
int16_t logReadBuff( tLogBuf * buf, uint8_t * data, uint16_t len );
int16_t logReadBuff( tLogBuf * buf, uint8_t * data );

int8_t sendEprom( uint32_t addr, uint8_t * data, uint16_t len);
int8_t readEprom( uint32_t addr, uint8_t * data, uint16_t len);
int8_t toLogWrite( void );

#endif /* LOGGER_H_ */
12 changes: 7 additions & 5 deletions inc/onewire.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@


#define OW_PORT GPIOA
#define OW_TX_PIN GPIO_Pin_9
#define OW_TX_PIN_NUM 9
#define OW_RX_PIN GPIO_Pin_10
#define OW_RX_PIN_NUM 10
#define OW_TX_PIN GPIO_Pin_2
#define OW_TX_PIN_NUM 2
#define OW_RX_PIN GPIO_Pin_3
#define OW_RX_PIN_NUM 3

#define TO_DEV_NUM 4 // Количество термометров
#define DD_DEV_NUM 1 // Количество Датчиков Дверей (DD)
Expand Down Expand Up @@ -63,7 +63,7 @@ typedef struct {
typedef struct {
uint64_t addr; // Адрес устройства
uint32_t readTout;
uint32_t prevData; // Действующее значение датчика двери
uint32_t ddData; // Действующее значение датчика двери
eOwStatus devStatus;
} tOwDdDev;

Expand Down Expand Up @@ -106,5 +106,7 @@ extern tOwDdDev owDdDev[]; // Массив структур Датчиков
uint8_t OW_Init();
uint8_t OW_Send(uint8_t sendReset, uint8_t *command, uint8_t cLen, uint8_t *data, uint8_t dLen, uint8_t readStart);
uint8_t OW_Scan(uint8_t *buf, uint8_t num);
void toReadTemperature( void );
void ddReadDoor( void );

#endif /* ONEWIRE_H_ */
2 changes: 1 addition & 1 deletion inc/stm32f0xx_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
//#include "stm32f10x_flash.h"
//#include "stm32f10x_fsmc.h"
#include "stm32f0xx_gpio.h"
//#include "stm32f10x_i2c.h"
#include "stm32f0xx_i2c.h"
/* #include "stm32f10x_iwdg.h" */
/* #include "stm32f10x_pwr.h" */
#include "stm32f0xx_rcc.h"
Expand Down
36 changes: 32 additions & 4 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@

#include <string.h>
#include "stm32xx_it.h"
#include "init.h"
#include "onewire.h"
#include "logger.h"
#include "eeprom.h"
#include "init.h"

uint32_t toLogTout; // Таймаут для логгирования температуры
uint32_t toLogTimer;
uint32_t toReadTout; // Таймаут для считывания температуры
uint32_t toReadTimer;
uint32_t toMesgTout; // Таймаут для предачи температуры
uint32_t toMesgTimer;

uint32_t ddReadTout; // Таймаут для считывания температуры
uint32_t ddReadTimer;

eOwStatus owInit( void ) {

Expand Down Expand Up @@ -55,12 +62,18 @@ eOwStatus owInit( void ) {
}
// Устанавливаем таймаут сбора информации
toLogTout = TO_LOG_TOUT;
toLogTimer = TO_LOG_TOUT;

toReadTout = TO_READ_TOUT;
toReadTimer = TO_READ_TOUT;

toMesgTout = TO_MESG_TOUT;
toMesgTimer = TO_MESG_TOUT;

// Установки для датчиков дверей
// Устанавливаем таймаут сбора информации
ddReadTout = DD_READ_TOUT;
ddReadTimer = DD_READ_TOUT;

return OW_OK;
}
Expand Down Expand Up @@ -105,11 +118,26 @@ eOwStatus owToDevInit( uint8_t toDev ) {
return err;
}

void logInit( void ){
//TODO
int8_t logInit( void ){
// Инициализация Логирования TO
toLogBuff.begin = 0;
toLogBuff.end = 0;
toLogBuff.full = 0;
toLogBuff.size = TO_LOG_RECORD_SIZE;
toLogBuff.bufAddr = TO_LOG_START_ADDR;
toLogBuff.len = TO_LOG_RECORD_NUM;
// Инициализация Логирования DD
ddLogBuff.begin = 0;
ddLogBuff.end = 0;
ddLogBuff.full = 0;
ddLogBuff.size = DD_LOG_RECORD_SIZE;
ddLogBuff.bufAddr = DD_LOG_START_ADDR;
ddLogBuff.len = DD_LOG_RECORD_NUM;

// Иициализация EEPROM
return eepromInit();
}


// Задержка в мс
void myDelay( uint32_t del ){
uint32_t finish = myTick + del;
Expand Down
Loading

0 comments on commit 9f3bc6e

Please sign in to comment.