From 3a993eef825775110a387645a6c800e47a63954a Mon Sep 17 00:00:00 2001 From: Evgenii Meshcheriakov Date: Wed, 5 Oct 2022 15:38:46 +0300 Subject: [PATCH 1/6] PressureWrapper init --- .mcuxpressoide_packages_support/info.properties | 8 ++++---- DigitalIoPin/.settings/language.settings.xml | 4 ++-- esp-vent-main/.settings/language.settings.xml | 6 +++--- .../.settings/language.settings.xml | 6 +++--- lpc_chip_15xx/.settings/language.settings.xml | 4 ++-- periph_blinky/.settings/language.settings.xml | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.mcuxpressoide_packages_support/info.properties b/.mcuxpressoide_packages_support/info.properties index 0eacd38..9cd82ab 100644 --- a/.mcuxpressoide_packages_support/info.properties +++ b/.mcuxpressoide_packages_support/info.properties @@ -1,5 +1,5 @@ #MCUXpresso IDE -#Wed Sep 14 11:02:46 EEST 2022 -product.name=MCUXpresso IDE v11.5.0 [Build 7232] [2022-01-11] -product.version=11.5.0 -product.build=7232 +#Wed Oct 05 15:28:44 EEST 2022 +product.name=MCUXpresso IDE v11.6.0 [Build 8187] [2022-07-13] +product.version=11.6.0 +product.build=8187 diff --git a/DigitalIoPin/.settings/language.settings.xml b/DigitalIoPin/.settings/language.settings.xml index 1a41d3e..55f49bb 100644 --- a/DigitalIoPin/.settings/language.settings.xml +++ b/DigitalIoPin/.settings/language.settings.xml @@ -4,7 +4,7 @@ - + @@ -15,7 +15,7 @@ - + diff --git a/esp-vent-main/.settings/language.settings.xml b/esp-vent-main/.settings/language.settings.xml index 5645974..19be77b 100644 --- a/esp-vent-main/.settings/language.settings.xml +++ b/esp-vent-main/.settings/language.settings.xml @@ -3,8 +3,8 @@ - - + + @@ -15,7 +15,7 @@ - + diff --git a/lpc_board_nxp_lpcxpresso_1549/.settings/language.settings.xml b/lpc_board_nxp_lpcxpresso_1549/.settings/language.settings.xml index 48af2ca..bb6fb83 100644 --- a/lpc_board_nxp_lpcxpresso_1549/.settings/language.settings.xml +++ b/lpc_board_nxp_lpcxpresso_1549/.settings/language.settings.xml @@ -3,8 +3,8 @@ - - + + @@ -15,7 +15,7 @@ - + diff --git a/lpc_chip_15xx/.settings/language.settings.xml b/lpc_chip_15xx/.settings/language.settings.xml index 168be13..7285754 100644 --- a/lpc_chip_15xx/.settings/language.settings.xml +++ b/lpc_chip_15xx/.settings/language.settings.xml @@ -4,7 +4,7 @@ - + @@ -15,7 +15,7 @@ - + diff --git a/periph_blinky/.settings/language.settings.xml b/periph_blinky/.settings/language.settings.xml index 5d2dd35..28247cc 100644 --- a/periph_blinky/.settings/language.settings.xml +++ b/periph_blinky/.settings/language.settings.xml @@ -4,7 +4,7 @@ - + @@ -15,7 +15,7 @@ - + From 8282b23235bb8511dbadbd2d4e31d95d1b5cf30c Mon Sep 17 00:00:00 2001 From: Evgenii Meshcheriakov Date: Mon, 10 Oct 2022 14:26:59 +0300 Subject: [PATCH 2/6] PressureWrapper init --- PressureWrapper/Debug/makefile | 77 ++++++++++++++++++++ PressureWrapper/Debug/objects.mk | 8 ++ PressureWrapper/Debug/sources.mk | 28 +++++++ PressureWrapper/Debug/src/PressureWrapper.su | 3 + PressureWrapper/Debug/src/subdir.mk | 31 ++++++++ PressureWrapper/inc/PressureWrapper.h | 31 ++++++++ PressureWrapper/src/PressureWrapper.cpp | 18 +++++ 7 files changed, 196 insertions(+) create mode 100644 PressureWrapper/Debug/makefile create mode 100644 PressureWrapper/Debug/objects.mk create mode 100644 PressureWrapper/Debug/sources.mk create mode 100644 PressureWrapper/Debug/src/PressureWrapper.su create mode 100644 PressureWrapper/Debug/src/subdir.mk create mode 100644 PressureWrapper/inc/PressureWrapper.h create mode 100644 PressureWrapper/src/PressureWrapper.cpp diff --git a/PressureWrapper/Debug/makefile b/PressureWrapper/Debug/makefile new file mode 100644 index 0000000..b3a89c6 --- /dev/null +++ b/PressureWrapper/Debug/makefile @@ -0,0 +1,77 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include src/subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C++_DEPS)),) +-include $(C++_DEPS) +endif +ifneq ($(strip $(CC_DEPS)),) +-include $(CC_DEPS) +endif +ifneq ($(strip $(CPP_DEPS)),) +-include $(CPP_DEPS) +endif +ifneq ($(strip $(CXX_DEPS)),) +-include $(CXX_DEPS) +endif +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +ifneq ($(strip $(C_UPPER_DEPS)),) +-include $(C_UPPER_DEPS) +endif +endif + +-include ../makefile.defs + +OPTIONAL_TOOL_DEPS := \ +$(wildcard ../makefile.defs) \ +$(wildcard ../makefile.init) \ +$(wildcard ../makefile.targets) \ + + +BUILD_ARTIFACT_NAME := PressureWrapper +BUILD_ARTIFACT_EXTENSION := a +BUILD_ARTIFACT_PREFIX := lib +BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ARTIFACT_EXTENSION),.$(BUILD_ARTIFACT_EXTENSION),) + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: + +@$(MAKE) --no-print-directory main-build && $(MAKE) --no-print-directory post-build + +# Main-build Target +main-build: libPressureWrapper.a + +# Tool invocations +libPressureWrapper.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) + @echo 'Building target: $@' + @echo 'Invoking: MCU Archiver' + arm-none-eabi-ar -r "libPressureWrapper.a" $(OBJS) $(USER_OBJS) $(LIBS) + @echo 'Finished building target: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) libPressureWrapper.a + -@echo ' ' + +post-build: + -@echo 'Performing post-build steps' + -arm-none-eabi-size "libPressureWrapper.a" ; # arm-none-eabi-objdump -h -S "libPressureWrapper.a" >"libPressureWrapper.lss" + -@echo ' ' + +.PHONY: all clean dependents main-build post-build + +-include ../makefile.targets diff --git a/PressureWrapper/Debug/objects.mk b/PressureWrapper/Debug/objects.mk new file mode 100644 index 0000000..742c2da --- /dev/null +++ b/PressureWrapper/Debug/objects.mk @@ -0,0 +1,8 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := + diff --git a/PressureWrapper/Debug/sources.mk b/PressureWrapper/Debug/sources.mk new file mode 100644 index 0000000..ff3de3d --- /dev/null +++ b/PressureWrapper/Debug/sources.mk @@ -0,0 +1,28 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +ASM_SRCS := +C++_SRCS := +CC_SRCS := +CPP_SRCS := +CXX_SRCS := +C_SRCS := +C_UPPER_SRCS := +OBJ_SRCS := +O_SRCS := +S_SRCS := +S_UPPER_SRCS := +ARCHIVES := +C++_DEPS := +CC_DEPS := +CPP_DEPS := +CXX_DEPS := +C_DEPS := +C_UPPER_DEPS := +OBJS := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +src \ + diff --git a/PressureWrapper/Debug/src/PressureWrapper.su b/PressureWrapper/Debug/src/PressureWrapper.su new file mode 100644 index 0000000..2659eb8 --- /dev/null +++ b/PressureWrapper/Debug/src/PressureWrapper.su @@ -0,0 +1,3 @@ +../src/PressureWrapper.cpp:10:1:PressureWrapper::PressureWrapper() 16 static +../src/PressureWrapper.cpp:15:1:PressureWrapper::~PressureWrapper() 16 static +../src/PressureWrapper.cpp:15:1:virtual PressureWrapper::~PressureWrapper() 16 static diff --git a/PressureWrapper/Debug/src/subdir.mk b/PressureWrapper/Debug/src/subdir.mk new file mode 100644 index 0000000..59024df --- /dev/null +++ b/PressureWrapper/Debug/src/subdir.mk @@ -0,0 +1,31 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/PressureWrapper.cpp + +CPP_DEPS += \ +./src/PressureWrapper.d + +OBJS += \ +./src/PressureWrapper.o + + +# Each subdirectory must supply rules for building sources it contributes +src/%.o: ../src/%.cpp src/subdir.mk + @echo 'Building file: $<' + @echo 'Invoking: MCU C++ Compiler' + arm-none-eabi-c++ -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -D__USE_LPCOPEN -D__LPC15XX__ -I"/Users/evgenymeshcheryakov/Documents/Metropolia/3rd/Embedded Systems Programming TX00CI61-3011/ESP-Ventilation/PressureWrapper/inc" -I"/Users/evgenymeshcheryakov/Documents/Metropolia/3rd/Embedded Systems Programming TX00CI61-3011/ESP-Ventilation/lpc_board_nxp_lpcxpresso_1549/inc" -I"/Users/evgenymeshcheryakov/Documents/Metropolia/3rd/Embedded Systems Programming TX00CI61-3011/ESP-Ventilation/lpc_chip_15xx/inc" -I"/Users/evgenymeshcheryakov/Documents/Metropolia/3rd/Embedded Systems Programming TX00CI61-3011/ESP-Ventilation/DigitalIoPin/inc" -I"/Users/evgenymeshcheryakov/Documents/Metropolia/3rd/Embedded Systems Programming TX00CI61-3011/ESP-Ventilation/I2C/inc" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map="$( + +PressureWrapper::PressureWrapper() +{ + // TODO Auto-generated constructor stub +} + +PressureWrapper::~PressureWrapper() +{ + // TODO Auto-generated destructor stub +} From 0492700f3ccca630df667e218769fd20a3192ec1 Mon Sep 17 00:00:00 2001 From: Vasily Davydov Date: Mon, 10 Oct 2022 14:33:59 +0300 Subject: [PATCH 3/6] pressure-wrapper: format code --- PressureWrapper/inc/PressureWrapper.h | 16 +++++++++++----- PressureWrapper/src/PressureWrapper.cpp | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/PressureWrapper/inc/PressureWrapper.h b/PressureWrapper/inc/PressureWrapper.h index 2a904b3..54aec80 100644 --- a/PressureWrapper/inc/PressureWrapper.h +++ b/PressureWrapper/inc/PressureWrapper.h @@ -18,14 +18,20 @@ class PressureWrapper { public: - PressureWrapper(); - bool getStatus(); - int16_t getPressure(); + PressureWrapper (); + /** + * @brief Get the Status object + * + * @return true + * @return false + */ + bool getStatus (); + int16_t getPressure (); - virtual ~PressureWrapper(); + virtual ~PressureWrapper (); private: - I2C *i2c; + I2C *i2c; }; #endif /* PRESSUREWRAPPER_H_ */ diff --git a/PressureWrapper/src/PressureWrapper.cpp b/PressureWrapper/src/PressureWrapper.cpp index d09633f..48288a9 100644 --- a/PressureWrapper/src/PressureWrapper.cpp +++ b/PressureWrapper/src/PressureWrapper.cpp @@ -7,12 +7,12 @@ #include -PressureWrapper::PressureWrapper() +PressureWrapper::PressureWrapper () { - // TODO Auto-generated constructor stub + // TODO Auto-generated constructor stub } -PressureWrapper::~PressureWrapper() +PressureWrapper::~PressureWrapper () { - // TODO Auto-generated destructor stub + // TODO Auto-generated destructor stub } From 76e63e9a22c8ee226dc454fd7122b3309f258780 Mon Sep 17 00:00:00 2001 From: Evgenii Meshcheriakov Date: Mon, 10 Oct 2022 14:51:07 +0300 Subject: [PATCH 4/6] PressureWrapper add static projects --- PressureWrapper/.cproject | 256 +++++++++++++++++++++++++++++++++++ PressureWrapper/.project | 30 ++++ PressureWrapper/liblinks.xml | 32 +++++ 3 files changed, 318 insertions(+) create mode 100644 PressureWrapper/.cproject create mode 100644 PressureWrapper/.project create mode 100644 PressureWrapper/liblinks.xml diff --git a/PressureWrapper/.cproject b/PressureWrapper/.cproject new file mode 100644 index 0000000..3270851 --- /dev/null +++ b/PressureWrapper/.cproject @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <?xml version="1.0" encoding="UTF-8"?> +<TargetConfig> +<Properties property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="100300"/> +<infoList vendor="NXP"> +<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen"> +<chip> +<name>LPC1549</name> +<family>LPC15xx</family> +<vendor>NXP (formerly Philips)</vendor> +<reset board="None" core="Real" sys="Real"/> +<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/> +<memory can_program="true" id="Flash" is_ro="true" type="Flash"/> +<memory id="RAM" type="RAM"/> +<memory id="Periph" is_volatile="true" type="Peripheral"/> +<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/> +<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/> +<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/> +<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/> +</chip> +<processor> +<name gcc_name="cortex-m3">Cortex-M3</name> +<family>Cortex-M</family> +</processor> +</info> +</infoList> +</TargetConfig> + + + LPCXpresso1549 + + + + \ No newline at end of file diff --git a/PressureWrapper/.project b/PressureWrapper/.project new file mode 100644 index 0000000..4688e60 --- /dev/null +++ b/PressureWrapper/.project @@ -0,0 +1,30 @@ + + + PressureWrapper + + + lpc_chip_15xx + DigitalIoPin + I2C + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/PressureWrapper/liblinks.xml b/PressureWrapper/liblinks.xml new file mode 100644 index 0000000..1dc1803 --- /dev/null +++ b/PressureWrapper/liblinks.xml @@ -0,0 +1,32 @@ + + + + + ${MacroStart}workspace_loc:/${ProjName}/inc${MacroEnd} + + + ${MacroStart}workspace_loc:/${ProjName}/inc${MacroEnd} + + + ${ProjName} + + + ${MacroStart}workspace_loc:/${ProjName}/Debug${MacroEnd} + + + ${MacroStart}workspace_loc:/${ProjName}/Release${MacroEnd} + + + ${ProjName} + + + From 98ae07bc18013fddbdb4f219d29b90d4c6362f46 Mon Sep 17 00:00:00 2001 From: Evgenii Meshcheriakov Date: Mon, 17 Oct 2022 10:40:14 +0300 Subject: [PATCH 5/6] pressure-wrapper: add structure for pressure_data --- PressureWrapper/inc/PressureWrapper.h | 10 ++++++++-- PressureWrapper/src/PressureWrapper.cpp | 17 +++++++++++++++-- esp-vent-main/.cproject | 10 ++++++++++ esp-vent-main/.project | 1 + esp-vent-main/src/esp-vent-main.cpp | 13 +++++++++++-- 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/PressureWrapper/inc/PressureWrapper.h b/PressureWrapper/inc/PressureWrapper.h index 54aec80..77c5e84 100644 --- a/PressureWrapper/inc/PressureWrapper.h +++ b/PressureWrapper/inc/PressureWrapper.h @@ -15,10 +15,15 @@ #define READADD 0x81 #define WRITEADD 0x80 +typedef struct _PRESSURE{ + uint8_t rBuffer[2]; + uint8_t crc; +}PRESSURE_DATA; + class PressureWrapper { public: - PressureWrapper (); + PressureWrapper (I2C *i2c); /** * @brief Get the Status object * @@ -26,12 +31,13 @@ public: * @return false */ bool getStatus (); - int16_t getPressure (); + PRESSURE_DATA* getPressure (); virtual ~PressureWrapper (); private: I2C *i2c; + PRESSURE_DATA data = {{0, 0}, 0}; }; #endif /* PRESSUREWRAPPER_H_ */ diff --git a/PressureWrapper/src/PressureWrapper.cpp b/PressureWrapper/src/PressureWrapper.cpp index 48288a9..5f92992 100644 --- a/PressureWrapper/src/PressureWrapper.cpp +++ b/PressureWrapper/src/PressureWrapper.cpp @@ -7,12 +7,25 @@ #include -PressureWrapper::PressureWrapper () +PressureWrapper::PressureWrapper (I2C *i2c) : i2c(i2c) { - // TODO Auto-generated constructor stub + } PressureWrapper::~PressureWrapper () { // TODO Auto-generated destructor stub } + +bool PressureWrapper::getStatus() { + uint8_t control_register = 0x01; + uint8_t status = 0; + i2c->transaction(ADDRESS, &control_register, 1, &status, 1); +} + +PRESSURE_DATA* PressureWrapper::getPressure () { + uint8_t getMeasurementComm = 0xF1; + i2c->transaction(ADDRESS, &getMeasurementComm, 1, data.rBuffer, 3); + //i2c->transaction(ADDRESS, &getMeasurementComm, 1, data.crc, 1); + return &data; +} diff --git a/esp-vent-main/.cproject b/esp-vent-main/.cproject index 521b9f6..208bd18 100644 --- a/esp-vent-main/.cproject +++ b/esp-vent-main/.cproject @@ -46,6 +46,7 @@ + @@ -126,6 +129,7 @@ + @@ -280,6 +288,7 @@ +