diff --git a/Hello_World/main.c b/Hello_World/main.c index 4fd813ca8542b0fa5105e03c1de13d1fbdf26381..f2063ca3bec16d9df3166a037ddb7e487d233803 100644 --- a/Hello_World/main.c +++ b/Hello_World/main.c @@ -58,6 +58,7 @@ #include "bhy_uc_driver.h" #include "pmic.h" #include "bme680.h" +#include "bma400.h" #include "bosch.h" /***** Definitions *****/ @@ -164,6 +165,19 @@ int main(void) printf("Failed to init BME680\n"); } + struct bma400_dev bma; + bma.intf_ptr = NULL; /* To attach your interface device reference */ + bma.delay_ms = card10_bosch_delay; + bma.dev_id = BMA400_I2C_ADDRESS_SDO_LOW; + bma.read = card10_bosch_i2c_read_ex; + bma.write = card10_bosch_i2c_write_ex; + bma.intf = BMA400_I2C_INTF; + + rslt = bma400_init(&bma); + if (rslt == BMA400_OK) { + printf("BMA400 found with chip ID 0x%X\r\n", bma.chip_id); + } + // Enable 32 kHz output RTC_SquareWave(MXC_RTC, SQUARE_WAVE_ENABLED, F_32KHZ, NOISE_IMMUNE_MODE, NULL); diff --git a/bmatest/.cproject b/bmatest/.cproject new file mode 100644 index 0000000000000000000000000000000000000000..6adc994794249c091c81b66fb9d4b85f52ae9f0d --- /dev/null +++ b/bmatest/.cproject @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> + <storageModule moduleId="org.eclipse.cdt.core.settings"> + <cconfiguration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1674944962"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1674944962" moduleId="org.eclipse.cdt.core.settings" name="Debug"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1674944962" name="Debug" parent="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug"> + <folderInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1674944962." name="/" resourcePath=""> + <toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug.548125692" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug"> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1448195934" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level" value="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.none" valueType="enumerated"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.989348626" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.573934961" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1195068176" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.1035348629" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.31679983" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level" value="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.max" valueType="enumerated"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.1676901946" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.1729767352" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1708484008" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.178519983" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m3" valueType="enumerated"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.956545422" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.thumb" valueType="enumerated"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.1580514969" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix" value="arm-none-eabi-" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.1246670973" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c" value="gcc" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.1674926322" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp" value="g++" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.2051566192" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar" value="ar" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.408066731" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy" value="objcopy" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.1900584936" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump" value="objdump" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.1096852527" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size" value="size" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.937347953" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make" value="make" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.1468247042" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm" value="rm" valueType="string"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1529750846" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.667765305" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize" value="true" valueType="boolean"/> + <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.786533016" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/> + <builder arguments="ECLIPSE=1" buildPath="${workspace_loc:/Hello_World}" command="make" id="ilg.gnuarmeclipse.managedbuild.cross.builder.592880777" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1648672385" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler"> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1969112665" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/> + <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.507854261" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/> + </tool> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1576427906" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler"> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.1576427906" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath"> + <listOptionValue builtIn="false" value=""${MAXIM_PATH}/Firmware/MAX32665/Libraries/CMSIS/Device/Maxim/MAX32665/Include""/> + <listOptionValue builtIn="false" value=""${MAXIM_PATH}/Firmware/MAX32665/Libraries/MAX32665PeriphDriver/Include""/> + <listOptionValue builtIn="false" value=""${MAXIM_PATH}/Firmware/MAX32665/Libraries/Boards/EvKit_V1/Include""/> + <listOptionValue builtIn="false" value=""${MAXIM_PATH}/Firmware/MAX32665/Libraries/Boards/Include""/> + <listOptionValue builtIn="false" value=""${MAXIM_PATH}/Firmware/MAX32665/Libraries/CMSIS/Include""/> + <listOptionValue builtIn="false" value=""${MAXIM_PATH}/Toolchain/arm-none-eabi/include""/> + <listOptionValue builtIn="false" value=""${MAXIM_PATH}/Toolchain/arm-none-eabi/include/sys""/> + <listOptionValue builtIn="false" value=""${MAXIM_PATH}/Toolchain/lib/gcc/arm-none-eabi/6.3.1/include""/> + </option> + <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.68945223" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/> + </tool> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.794996645" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler"/> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.675776866" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker"> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.185399645" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" value="true" valueType="boolean"/> + <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.input.246156916" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.391142733" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker"> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.2099090970" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" value="true" valueType="boolean"/> + </tool> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.399743328" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver"/> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.822983655" name="Cross ARM GNU Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash"/> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.1050446219" name="Cross ARM GNU Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting"> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.335976671" name="Display source (--source|-S)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders.964898349" name="Display all headers (--all-headers|-x)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle.972868647" name="Demangle names (--demangle|-C)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers.890608562" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers" value="true" valueType="boolean"/> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide.1669392057" name="Wide lines (--wide|-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide" value="true" valueType="boolean"/> + </tool> + <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.403251962" name="Cross ARM GNU Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize"> + <option id="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format.1919947275" name="Size format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format"/> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + </cconfiguration> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <project id="Hello_World.ilg.gnuarmeclipse.managedbuild.cross.target.elf.737306620" name="Executable" projectType="ilg.gnuarmeclipse.managedbuild.cross.target.elf"/> + </storageModule> + <storageModule moduleId="scannerConfiguration"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1674944962;ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1674944962.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1576427906;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.68945223"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> + <storageModule moduleId="refreshScope" versionNumber="2"> + <configuration configurationName="Debug"> + <resource resourceType="PROJECT" workspacePath="/Hello_World"/> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> +</cproject> diff --git a/bmatest/.gdbinit b/bmatest/.gdbinit new file mode 100644 index 0000000000000000000000000000000000000000..85b92cf79c0f29f412a886e093c13da55dfc1bcc --- /dev/null +++ b/bmatest/.gdbinit @@ -0,0 +1,3 @@ +file build/max32665.elf +target remote localhost:3333 + diff --git a/bmatest/.project b/bmatest/.project new file mode 100644 index 0000000000000000000000000000000000000000..035be64a6097ba5f35d529e1406bc4d010e9732b --- /dev/null +++ b/bmatest/.project @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Hello_World</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <triggers>clean,full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> + </natures> +</projectDescription> diff --git a/bmatest/.settings/language.settings.xml b/bmatest/.settings/language.settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..e5a1647610f97197abe406e8ef1bb9e62065f5a1 --- /dev/null +++ b/bmatest/.settings/language.settings.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<project> + <configuration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1674944962" name="Debug"> + <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> + <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> + <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> + <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> + </extension> + </configuration> +</project> diff --git a/bmatest/Makefile b/bmatest/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..4f67e2b847a9d1be39957ff39e96a2b33c721846 --- /dev/null +++ b/bmatest/Makefile @@ -0,0 +1,146 @@ +################################################################################ + # Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. + # + # Permission is hereby granted, free of charge, to any person obtaining a + # copy of this software and associated documentation files (the "Software"), + # to deal in the Software without restriction, including without limitation + # the rights to use, copy, modify, merge, publish, distribute, sublicense, + # and/or sell copies of the Software, and to permit persons to whom the + # Software is furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included + # in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + # IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + # OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + # OTHER DEALINGS IN THE SOFTWARE. + # + # Except as contained in this notice, the name of Maxim Integrated + # Products, Inc. shall not be used except as stated in the Maxim Integrated + # Products, Inc. Branding Policy. + # + # The mere transfer of this software does not imply any licenses + # of trade secrets, proprietary technology, copyrights, patents, + # trademarks, maskwork rights, or any other form of intellectual + # property whatsoever. Maxim Integrated Products, Inc. retains all + # ownership rights. + # + # $Date: 2018-09-28 18:22:39 +0000 (Fri, 28 Sep 2018) $ + # $Revision: 38193 $ + # + ############################################################################### + +# This is the name of the build output file +ifeq "$(PROJECT)" "" +PROJECT=max32665 +endif + +# Specify the target processor +ifeq "$(TARGET)" "" +TARGET=MAX32665 +endif + +# Create Target name variables +TARGET_UC:=$(shell echo $(TARGET) | tr a-z A-Z) +TARGET_LC:=$(shell echo $(TARGET) | tr A-Z a-z) + +# Select 'GCC' or 'IAR' compiler +COMPILER=GCC + +# Specify the board used +ifeq "$(BOARD)" "" +#BOARD=EvKit_V1 +BOARD=card10 +endif + +# This is the path to the CMSIS root directory +ifeq "$(MAXIM_PATH)" "" +LIBS_DIR=../sdk/Libraries +else +LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries) +endif +CMSIS_ROOT=$(LIBS_DIR)/CMSIS + +# Source files for this test (add path to VPATH below) +SRCS = main.c +SRCS += oled96.c +SRCS += fonts.c +SRCS += pmic.c +SRCS += bosch.c +SRCS += bhy_support.c bhy_uc_driver.c bhy.c +SRCS += MAX77650-Arduino-Library.c +SRCS += bme680.h +SRCS += bma400.c + +# Where to find source files for this test +VPATH = . + +# Where to find header files for this test +IPATH = . + +IPATH += ../lib/card10 +VPATH += ../lib/card10 + +IPATH += ../lib/bosch/BHy1_driver_and_MCU_solution/driver/inc +IPATH += ../lib/bosch/BHy1_driver_and_MCU_solution/examples/firmware/ +VPATH += ../lib/bosch/BHy1_driver_and_MCU_solution/driver/src + +IPATH += ../lib/maxim/MAX77650-Arduino-Library +VPATH += ../lib/maxim/MAX77650-Arduino-Library + +IPATH += ../lib/bosch/BME680_driver +VPATH += ../lib/bosch/BME680_driver + +IPATH += ../lib/bosch/BMA400-API +VPATH += ../lib/bosch/BMA400-API + +# Enable assertion checking for development +PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE + +# Specify the target revision to override default +# "A2" in ASCII +# TARGET_REV=0x4132 + +# Use this variables to specify and alternate tool path +#TOOL_DIR=/opt/gcc-arm-none-eabi-4_8-2013q4/bin + +# Use these variables to add project specific tool options +#PROJ_CFLAGS+=--specs=nano.specs +#PROJ_LDFLAGS+=--specs=nano.specs + +PROJ_CFLAGS+=-std=c99 + +# Point this variable to a startup file to override the default file +#STARTUPFILE=start.S + +# Override the default optimization level using this variable +#MXC_OPTIMIZE_CFLAGS=-O1 + +# Point this variable to a linker file to override the default file +ifneq "$(APP)" "" +LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC)_app.ld +endif + +################################################################################ +# Include external library makefiles here + +# Include the BSP +BOARD_DIR=$(LIBS_DIR)/Boards/$(BOARD) +include $(BOARD_DIR)/board.mk + +# Include the peripheral driver +PERIPH_DRIVER_DIR=$(LIBS_DIR)/$(TARGET_UC)PeriphDriver +include $(PERIPH_DRIVER_DIR)/periphdriver.mk + +################################################################################ +# Include the rules for building for this target. All other makefiles should be +# included before this one. +include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk + +# The rule to clean out all the build products. +distclean: clean + $(MAKE) -C ${PERIPH_DRIVER_DIR} clean diff --git a/bmatest/build_image b/bmatest/build_image new file mode 100755 index 0000000000000000000000000000000000000000..efcda785f8ef3137326531e085cdccaa7baac919 --- /dev/null +++ b/bmatest/build_image @@ -0,0 +1,5 @@ +make clean +make APP=1 +make build/max32665.bin +cp build/max32665.bin card10.bin +python ../bootloader/crc_patch.py card10.bin diff --git a/bmatest/main.c b/bmatest/main.c new file mode 100644 index 0000000000000000000000000000000000000000..85e277462e3454b26c15b5423ba79d768fcb7135 --- /dev/null +++ b/bmatest/main.c @@ -0,0 +1,219 @@ +/******************************************************************************* + * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + * + * $Date: 2018-09-04 22:13:32 +0000 (Tue, 04 Sep 2018) $ + * $Revision: 37649 $ + * + ******************************************************************************/ + +/** + * @file main.c + * @brief Hello World! + * @details This example uses the UART to print to a terminal and flashes an LED. + */ + +/***** Includes *****/ +#include <stdio.h> +#include <stdint.h> +#include <string.h> +#include "mxc_config.h" +#include "led.h" +#include "board.h" +#include "tmr_utils.h" +#include "i2c.h" +#include "rtc.h" +#include "spi.h" +#include "gpio.h" +#include "oled96.h" +#include "bhy.h" +#include "Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103.h" +#include "bhy_uc_driver.h" +#include "pmic.h" +#include "bme680.h" +#include "bma400.h" +#include "bosch.h" + +/***** Definitions *****/ + +/***** Globals *****/ + +/***** Functions *****/ +void print_rslt(int8_t rslt) +{ + switch (rslt) { + case BMA400_OK: + /* Do nothing */ + break; + case BMA400_E_NULL_PTR: + printf("Error [%d] : Null pointer\r\n", rslt); + break; + case BMA400_E_COM_FAIL: + printf("Error [%d] : Communication failure\r\n", rslt); + break; + case BMA400_E_DEV_NOT_FOUND: + printf("Error [%d] : Device not found\r\n", rslt); + break; + case BMA400_E_INVALID_CONFIG: + printf("Error [%d] : Invalid configuration\r\n", rslt); + break; + case BMA400_W_SELF_TEST_FAIL: + printf("Warning [%d] : Self test failed\r\n", rslt); + break; + default: + printf("Error [%d] : Unknown error code\r\n", rslt); + break; + } +} +// ***************************************************************************** +int main(void) +{ + int count = 0; + + printf("Hello World!\n"); + + //Setup the I2CM + I2C_Shutdown(MXC_I2C0_BUS0); + I2C_Init(MXC_I2C0_BUS0, I2C_FAST_MODE, NULL); + + I2C_Shutdown(MXC_I2C1_BUS0); + I2C_Init(MXC_I2C1_BUS0, I2C_FAST_MODE, NULL); + + pmic_init(); + pmic_set_led(0, 0); + pmic_set_led(1, 0); + pmic_set_led(2, 0); + TMR_Delay(MXC_TMR0, MSEC(1000), 0); + + uint8_t dummy[1] = {0}; + // "7-bit addresses 0b0000xxx and 0b1111xxx are reserved" + for (int addr = 0x8; addr < 0x78; ++addr) { + // A 0 byte write does not seem to work so always send a single byte. + int res = I2C_MasterWrite(MXC_I2C0_BUS0, addr << 1, dummy, 1, 0); + if(res == 1) { + printf("Found (7 bit) address 0x%02x on I2C0\n", addr); + } + + res = I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, dummy, 1, 0); + if(res == 1) { + printf("Found (7 bit) address 0x%02x on I2C1\n", addr); + } + } + + oledInit(0x3c, 0, 0); + oledFill(0x00); + oledWriteString(0, 0, "Hello", 0); + oledWriteString(0, 2, "my name is", 0); + oledWriteString(0, 4, "card10", 1); + + struct bma400_dev bma; + struct bma400_int_enable tap_int[2]; + struct bma400_sensor_conf conf[2]; + int8_t rslt; + uint32_t poll_period = 5, test_dur_ms = 30000; + uint16_t int_status; + + + bma.intf_ptr = NULL; /* To attach your interface device reference */ + bma.delay_ms = card10_bosch_delay; + bma.dev_id = BMA400_I2C_ADDRESS_SDO_LOW; + bma.read = card10_bosch_i2c_read_ex; + bma.write = card10_bosch_i2c_write_ex; + bma.intf = BMA400_I2C_INTF; + + rslt = bma400_init(&bma); + if (rslt == BMA400_OK) { + printf("BMA400 found with chip ID 0x%X\r\n", bma.chip_id); + } + + + print_rslt(rslt); + + rslt = bma400_soft_reset(&bma); + print_rslt(rslt); + + conf[0].type = BMA400_ACCEL; + conf[1].type = BMA400_TAP_INT; + + rslt = bma400_get_sensor_conf(conf, 2, &bma); + print_rslt(rslt); + + conf[0].param.accel.odr = BMA400_ODR_200HZ; + conf[0].param.accel.range = BMA400_4G_RANGE; + conf[0].param.accel.data_src = BMA400_DATA_SRC_ACCEL_FILT_1; + conf[0].param.accel.filt1_bw = BMA400_ACCEL_FILT1_BW_1; + + conf[1].param.tap.int_chan = BMA400_UNMAP_INT_PIN; + conf[1].param.tap.axes_sel = BMA400_Z_AXIS_EN_TAP; + conf[1].param.tap.sensitivity = BMA400_TAP_SENSITIVITY_0; + + rslt = bma400_set_sensor_conf(conf, 2, &bma); + print_rslt(rslt); + + bma.delay_ms(100); + + tap_int[0].type = BMA400_SINGLE_TAP_INT_EN; + tap_int[0].conf = BMA400_ENABLE; + + tap_int[1].type = BMA400_DOUBLE_TAP_INT_EN; + tap_int[1].conf = BMA400_ENABLE; + + rslt = bma400_enable_interrupt(tap_int, 2, &bma); + print_rslt(rslt); + + bma.delay_ms(100); + + rslt = bma400_set_power_mode(BMA400_NORMAL_MODE, &bma); + print_rslt(rslt); + + bma.delay_ms(100); + + if (rslt == BMA400_OK) { + printf("Tap configured.\r\n"); + + while (test_dur_ms) { + bma.delay_ms(poll_period); + + rslt = bma400_get_interrupt_status(&int_status, &bma); + print_rslt(rslt); + + if (int_status & BMA400_S_TAP_INT_ASSERTED) { + printf("Single tap detected!\r\n"); + } + + if (int_status & BMA400_D_TAP_INT_ASSERTED) { + printf("Double tap detected!\r\n"); + } + + test_dur_ms -= poll_period; + } + + } +}