diff --git a/.travis.yml b/.travis.yml
index 29497502..3da1dce8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,36 +1,39 @@
language: python
python:
- "2.7"
+
+sudo: required
branches:
- only:
- master
+ only:
+ - tle94112
+
env:
global:
- - USR_NAME="mhoechner"
- - USR_EMAIL="Moritz.Hoechner@infineon.com"
- # new token needs to be generated & encrypted
- - secure: OLSYr2ioMsqS+l43+s+yzfaVeCTK0Z1ky+Tm31bHdU66Ahq8+ZiDNX4fVDuziJtuHJWR3pEmqnYdSqSqcuByObM+I7uW3RaV2fOAtvCnWQcar5jt0+TYHuuLbfLu7vsL6ntBkQJXWibLO3JlVFp8ZVNd33WUE0mrnNdR7xormwy6EV7Ry9X/j43G+zHGjAKXxcfWIKs279pHvhtye4Vhlg3U8MkEwlkgpGiMbpWmk5CaePTi82KuoIOAceVZ8ixssuqpt4DgCnl7m6t1D+8MnjXxPLISvOr0pHNHTJ+3/gv1dGUrxENyPiW9d1q8OnrKyD9CniqC6Rklj+g5mhR+v+FJvjfa2k85SXVvFYikkqUyXkIVZkJu+PxZX0mfY18SbI7GB8mOkjgcusI9KhzNhZJQxUzza/DBe2MOR72mHVdpHlsOtx/1PjaUjJtS6lFBBZw1gCKYsFkGU3UfY+Jr3yajU1veCICgde0gm3SfhCDsQVymi7hsfnbBj8YhrY1K5+YJ6JHk5Wu6x2SsT8Al2/YSZoDdUDCZZ8Y4WNO+ZY2vF0ZU3jOcK/JSuLV6W7VzXAhSaYHVAHq2fXNgW7EWkRaLeFGtjgwvZIkhQ1Mrsl6oObMJhFhaD6vP4MlwvTWKp0MB8NdFWsgR2ITU80sREp4RBzJVSQIvLiBCIwi0upY=
+ - USR_NAME="Dr Olaf Filies (IFAG DES MDP PSA)"
+ - USR_EMAIL="Olaf.Filies@infineon.com"
matrix:
- - PLATFORMIO_CI_SRC=examples/Control2Motors
+ - PLATFORMIO_CI_SRC=examples/Control2Motors
- PLATFORMIO_CI_SRC=examples/rampSpeedTest
- PLATFORMIO_CI_SRC=examples/rampTest
- - PLATFORMIO_CI_SRC=examples/speedControl
+ - PLATFORMIO_CI_SRC=examples/speedControll
install:
+ # build with stable core
- pip install -U platformio
- - platformio platform install https://github.com/Infineon/platformio-infineonxmc.git
+ - platformio platform install -f infineonxmc
+
script:
- - platformio ci --lib="." --board=xmc1100_xmc2go --board=xmc1100_boot_kit --board=xmc1100_h_bridge2go --board=xmc1300_boot_kit --board=xmc4700_relax_kit --project-option="lib_deps=Wire"
+ - platformio ci --lib="." --board=xmc1100_xmc2go --board=xmc1100_boot_kit --board=xmc4700_relax_kit --board=uno
after_success:
# only build once (after one job by checking id, however this does not work reliably)
- # - |
- # if [ $(($TRAVIS_JOB_ID - $TRAVIS_BUILD_ID)) -eq 2 ]; then
- # export REPO_NAME=${TRAVIS_REPO_SLUG#*/}
- # git clone https://github.com/Infineon/InfineonDoxyGenerator.git
- # cd well-automated-documentation/docs
- # # cd $TRAVIS_BUILD_DIR/docs
- # chmod +x publish_pdf.sh
- # ./publish_pdf.sh
- # fi
\ No newline at end of file
+ - |
+ if [ $(($TRAVIS_JOB_ID - $TRAVIS_BUILD_ID)) -eq 2 ]; then
+ export REPO_NAME=${TRAVIS_REPO_SLUG#*/}
+ #git clone https://github.com/Infineon/InfineonDoxyGenerator.git
+ cd InfineonDoxyGenerator/docs
+ chmod +x publish_pdf.sh
+ ./publish_pdf.sh
+ fi
\ No newline at end of file
diff --git a/LICENSE.md b/LICENSE.md
index 8e68c46d..9a7d5033 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -6,7 +6,7 @@ license of the respective file and putting it under the same license (except
stated otherwise by the license).
All rights of the respective copyright holders shall be reserved.
Brands and product names are trademarks of their respective owners.
-Referred and linked files/pages are out-of-scope of this repository and underly
+Referred and linked files/pages are out-of-scope of this repository and underlay
their respective licenses.
```
In case of deviating information in this repository, license information
@@ -16,31 +16,37 @@ valid in the scope of the repository (not if statement here is not applicable).
## License
*********************************************************************************************************************
- * Copyright (c) 2017, Infineon Technologies AG
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
- * following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the distribution.
- *
- * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with
- * Infineon Technologies AG.
+ Copyright (c) 2017, Infineon Technologies AG
+ All rights reserved.
+
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ following conditions are met:
+
+
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+ disclaimer.
+
+
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the distribution.
+
+
+ Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior written permission.
+
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with
+ Infineon Technologies AG.
*********************************************************************************************************************
diff --git a/README.md b/README.md
index 2762da13..4c7dcc54 100644
--- a/README.md
+++ b/README.md
@@ -2,12 +2,17 @@
[![Build Status](https://travis-ci.org/Infineon/DC-Motor-Control-TLE94112EL.svg?branch=master)](https://travis-ci.org/Infineon/DC-Motor-Control-TLE94112EL)
-
-Library of Infineon's [DC Motor Shield with TLE94112EL](https://www.infineon.com/cms/en/product/productType.html?productType=5546d46259d9a4bf015a369885a95505) for Arduino.
+
+
+
+Library of Infineon's [DC Motor Shield with TLE94112EL](https://www.infineon.com/cms/en/product/evaluation-boards/tle94112el_shield/) for Arduino.
## Summary
-The DC motor shield is a small evaluation board equipped with TLE94112EL for use with Arduino. The TLE94112EL is capable to drive up to 6 small DC motors in parallel mode or up to 11 DC motors in cascaded mode. All outputs can drive up to 0.9A. The outputs can be used stand-alone or combined to increase driving capability up to 3.6A. The implemented integrated [TLE94112EL](https://www.infineon.com/cms/en/product/power/motor-control-and-gate-driver-ics/intelligent-motor-control-ics/multi-half-bridge-driver/TLE94112EL/productType.html?productType=5546d46254e133b4015538ca99e552a1) is a protected twelve-fold half-bridge driver designed especially for automotive motion control applications such as Heating, Ventilation and Air Conditioning (HVAC) flap DC motor control.
+The DC motor shield is a small evaluation board equipped with TLE94112EL for use with Arduino. The TLE94112EL is capable to drive up to 6
+small DC motors in parallel mode or up to 11 DC motors in cascaded mode. All outputs can drive up to 0.9A. The outputs can be used stand-alone
+or combined to increase driving capability up to 3.6A. The implemented integrated [TLE94112EL](https://www.infineon.com/cms/en/product/power/motor-control-ics/intelligent-motor-control-ics/multi-half-bridge-ics/tle94112el/)
+is a protected twelve-fold half-bridge driver designed especially for automotive motion control applications such as Heating, Ventilation and Air Conditioning (HVAC) flap DC motor control.
## Key Features and Benefits
* Driver with 12 half-bridge outputs to drive DC motors, resistive or inductive loads
@@ -19,6 +24,8 @@ The DC motor shield is a small evaluation board equipped with TLE94112EL for use
* Efficient design for multi-motor applications
* Less communication with µC through integrated PWM generator and zero clock diagnosis
* Reducing external components to meet EMC requirements
+* The board is stackable if you change the position of a resistor, [see here](https://raw.githubusercontent.com/infineon/assets/master/Pictures/TLE94112_Arduino_Shield_Pin_out.png)
+* LED driver on the first half-bridge
## Target Applications:
* Multi-motor applications
@@ -27,17 +34,18 @@ The DC motor shield is a small evaluation board equipped with TLE94112EL for use
* HVAC systems
## Installation
-First of all, please download this repository from GitHub by clicking on the following field in the [releases](https://github.com/Infineon/DC-Motor-Control-TLE94112EL/releases) of this repository.
+For the description of library [installation](docs/Installation.md)
-![Download Library](https://raw.githubusercontent.com/infineon/assets/master/Pictures/DL_DC_Mot_Rel-TLE94112EL.png)
+## Examples
+For the description of the [examples](docs/Examples.md)
-To install the DC motor control library in the Arduino IDE, please go now to **Sketch** > **Include Library** > **Add .ZIP Library...** in the Arduino IDE and navigate to the downloaded .ZIP file of this repository release. The library will be installed in your Arduino sketch folder in libraries and you can select as well as include this one to your project under **Sketch** > **Include Library** > **TLE94112**.
+## Library documentation
+The doxygen [library documentation](https://infineon.github.io/DC-Motor-Control-TLE94112EL/).
-![Install Library](https://raw.githubusercontent.com/infineon/assets/master/Pictures/Library_Install_ZIP.png)
-
-## Usage
-Please follow the example sketches in the /examples directory in this library to learn more about the usage of the library.
## Board Information, Datasheet and Additional Information
-A PDF summarizing the features and layout of the DC motor control shield is stored on the Infineon homepage [here](https://www.infineon.com/dgdl/Infineon-DC_Motor_Control_Shield_with_TLE94112EL_UserManual-UM-v01_00-EN.pdf?fileId=5546d46259d9a4bf015a4755351304ac).
-The datasheet for the TLE94112EL can be found here [TLE94112EL Datasheet](https://www.infineon.com/dgdl/Infineon-TLE94112EL-DS-v01_00-EN.pdf?fileId=5546d462576f347501579a2795837d3e) while the respective application note is located here [TLE941xy Application Note](https://www.infineon.com/dgdl/Infineon-TLE941xy-AN-v01_00-EN-AN-v01_00-EN-AN-v01_00-EN.pdf?fileId=5546d4625b62cd8a015bc8db26c831e3).
+* A PDF summarizing the features and layout of the DC motor control shield is stored on the Infineon homepage [here](https://www.infineon.com/dgdl/Infineon-DC_Motor_Control_Shield_with_TLE94112EL_UserManual-UM-v01_00-EN.pdf?fileId=5546d46259d9a4bf015a4755351304ac).
+* The datasheet for the TLE94112EL can be found here [TLE94112EL Datasheet](https://www.infineon.com/dgdl/Infineon-TLE94112EL-DS-v01_00-EN.pdf?fileId=5546d462576f347501579a2795837d3e)
+* The respective application note is located here [TLE941xy Application Note](https://www.infineon.com/dgdl/Infineon-TLE941xy-AN-v01_00-EN-AN-v01_00-EN-AN-v01_00-EN.pdf?fileId=5546d4625b62cd8a015bc8db26c831e3).
+* There is a pinout picture [Tle94112el pintout](https://raw.githubusercontent.com/infineon/assets/master/Pictures/TLE94112_Arduino_Shield_Pin_out.png)
+
diff --git a/docs/Examples.md b/docs/Examples.md
new file mode 100644
index 00000000..09b6cc01
--- /dev/null
+++ b/docs/Examples.md
@@ -0,0 +1,13 @@
+# Examples2Go
+
+## List of examples
+To run this examples use either the Arduino IDE or something similar like the [PlatformIO](https://platformio.org/platformio-ide?utm_source=github&utm_medium=xmc-for-arduino) module for [code](https://code.visualstudio.com/) or [atom](https://atom.io/)
+* examples/Control2Motors/Control2Motors.ino
+* examples/rampSpeedTest/rampSpeedTest.ino
+* examples/rampTest/rampTest.ino
+* examples/speedControl/speedControl.ino
+
+## DIY-projects
+* there are two Lego robots using the TLE94112 shields for controlling motors.
+ * a [Lego rama driving robot](https://www.infineon.com/cms/en/tools/landing/infineon-for-makers/diy-projects/)
+ * a [Lego six axes robot](https://www.infineon.com/cms/en/tools/landing/infineon-for-makers/diy-projects/)
diff --git a/docs/Installation.md b/docs/Installation.md
new file mode 100644
index 00000000..6db62334
--- /dev/null
+++ b/docs/Installation.md
@@ -0,0 +1,28 @@
+# Installation
+
+## Integration of Library
+Please download the required repository from GitHub by clicking on the following field in the latest [release](https://github.com/Infineon/DC-Motor-Control-TLE94112EL/releases) of this repository:
+
+![Download Library](https://raw.githubusercontent.com/infineon/assets/master/Pictures/Releases_Generic.jpg)
+
+To install the TLE94112 motor control library in the Arduino IDE, please go now to **Sketch** > **Include Library** > **Add .ZIP Library...** in
+the Arduino IDE and navigate to the downloaded .ZIP file of this repository. The library will be installed in your Arduino sketch folder
+in libraries and you can select as well as include this one to your project under **Sketch** > **Include Library** > **TLE94112**.
+
+![Install Library](https://raw.githubusercontent.com/infineon/assets/master/Pictures/Library_Install_ZIP.png)
+
+## Usage
+Please follow the example sketches in the /examples directory in this library to learn more about the usage of the library.
+For proper work of the TLE94112 the following tips may help:
+* the TLE94112 works properly in the range of min 5.5V to max 40V Vbat
+* the max current on one half bridge is 0.9 A, if you need more you have to cascade more half bridges, see [manual](https://www.infineon.com/dgdl/Infineon-TLE94112EL-DS-v01_00-EN.pdf?fileId=5546d462576f347501579a2795837d3e) and pin out picture
+* the shield is stackable if you change the 0 \Omega resistor from R7/R8. There is also a hack to stack a max number of three TLE94112 (please ask if you need this)
+* the first two ports can be directly used also for LEDs but with the help of right dimensioned resistors, any half bridge can be used
+for LEDs or other stuff falling in the voltage and current limits of the board
+* there is a handy [pin out picture](https://raw.githubusercontent.com/infineon/assets/master/Pictures/TLE94112_Arduino_Shield_Pin_out.png)
+
+
+## Installation of XMC
+If you use any Infineon XMC microcontroller like the XMC1100 Boot Kit or the XMC4700 Relax Kit, than you must also
+install the [XMC-for-Arduino library from here](https://github.com/Infineon/XMC-for-Arduino).
+
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 00000000..612d7251
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,49 @@
+##################################################################################
+# documentation build files
+# - generates the html doxygen documentation
+# needed software:
+# - graphviz dot
+# - doxygen 1.8.15 or higher
+
+# Directories
+SRC_DIR ?= ../
+DOC_DIR ?= ./
+DOC_IMG_DIR ?= ./img
+DOC_BUILD_DIR ?= ./
+DOT_PATH ?= /usr/bin/dot
+# General settings
+DOXYFILE ?= doxyfile_html
+WORKING_DOXYFILE ?= temp_doxyfile
+PROJECT_LOGO ?= ./img/ifx_logo.png
+DOXYGEN_WARNING ?= warn.log
+
+# Tools
+CD ?= cd
+ECHO ?= echo
+DOXYGEN_ECHO ?= echo
+RM ?= rm
+RM_DIR ?= rm -rf
+COPY ?= cp
+DOXYGEN ?= ${DOXY_BIN_PATH}/doxygen
+
+html:
+ @$(ECHO) Generating $@
+ @$(COPY) $(DOXYFILE) $(WORKING_DOXYFILE)
+ @$(DOXYGEN_ECHO) >> $(WORKING_DOXYFILE)
+ @$(DOXYGEN_ECHO) INPUT=$(SRC_DIR) >> $(WORKING_DOXYFILE)
+ @$(DOXYGEN_ECHO) PROJECT_NAME= "Tle94112" >> $(WORKING_DOXYFILE)
+ @$(DOXYGEN_ECHO) OUTPUT_DIRECTORY = $(DOC_BUILD_DIR) >> $(WORKING_DOXYFILE)
+ @$(DOXYGEN_ECHO) PROJECT_LOGO = $(PROJECT_LOGO) >> $(WORKING_DOXYFILE)
+ @$(DOXYGEN_ECHO) IMAGE_PATH = $(DOC_IMG_DIR) >> $(WORKING_DOXYFILE)
+ @$(DOXYGEN_ECHO) DOT_PATH = "$(DOT_PATH)" >> $(WORKING_DOXYFILE)
+ @$(DOXYGEN) $(WORKING_DOXYFILE)
+
+clean:
+ @$(ECHO) Removing build directory
+ @$(RM_DIR) $(DOC_BUILD_DIR)
+ @$(ECHO) Removing temporary files
+ @$(RM) $(DOXYGEN_WARNING)
+ @$(RM) $(WORKING_DOXYFILE)
+ @$(RM) $(LIBRARY_NAME).pdf
+
+.PHONY: lib_doc clean
\ No newline at end of file
diff --git a/docs/doxyfile_html b/docs/doxyfile_html
new file mode 100644
index 00000000..2d77d89d
--- /dev/null
+++ b/docs/doxyfile_html
@@ -0,0 +1,381 @@
+# Doxyfile 1.8.16
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = "TLE94112EL"
+PROJECT_NUMBER = 1.4.1
+PROJECT_BRIEF =
+PROJECT_LOGO = https://raw.githubusercontent.com/infineon/assets/master/Pictures/ifx_logo.png
+OUTPUT_DIRECTORY = ./docs
+CREATE_SUBDIRS = YES
+ALLOW_UNICODE_NAMES = NO
+OUTPUT_LANGUAGE = English
+OUTPUT_TEXT_DIRECTION = None
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = YES
+INLINE_INHERITED_MEMB = YES
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+QT_AUTOBRIEF = YES
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = YES
+TAB_SIZE = 4
+ALIASES =
+TCL_SUBST =
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_FOR_FORTRAN = NO
+OPTIMIZE_OUTPUT_VHDL = NO
+OPTIMIZE_OUTPUT_SLICE = NO
+EXTENSION_MAPPING = ino=c
+MARKDOWN_SUPPORT = YES
+TOC_INCLUDE_HEADINGS = 0
+AUTOLINK_SUPPORT = YES
+BUILTIN_STL_SUPPORT = YES
+CPP_CLI_SUPPORT = YES
+SIP_SUPPORT = YES
+IDL_PROPERTY_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+GROUP_NESTED_COMPOUNDS = NO
+SUBGROUPING = YES
+INLINE_GROUPED_CLASSES = YES
+INLINE_SIMPLE_STRUCTS = YES
+TYPEDEF_HIDES_STRUCT = NO
+LOOKUP_CACHE_SIZE = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_PRIV_VIRTUAL = NO
+EXTRACT_PACKAGE = YES
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = YES
+EXTRACT_ANON_NSPACES = YES
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = YES
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+HIDE_COMPOUND_REFERENCE= NO
+SHOW_INCLUDE_FILES = YES
+SHOW_GROUPED_MEMB_INC = YES
+FORCE_LOCAL_INCLUDES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES = NO
+SORT_BY_SCOPE_NAME = NO
+STRICT_PROTO_MATCHING = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_FILES = YES
+SHOW_NAMESPACES = YES
+FILE_VERSION_FILTER =
+LAYOUT_FILE =
+CITE_BIB_FILES =
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_AS_ERROR = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE = warn.log
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ../
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.ino \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.idl \
+ *.ddl \
+ *.odl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.cs \
+ *.d \
+ *.php \
+ *.php4 \
+ *.php5 \
+ *.phtml \
+ *.qml \
+ *.inc \
+ *.m \
+ *.markdown \
+ *.md \
+ *.mm \
+ *.dox \
+ *.py \
+ *.pyw \
+ *.f90 \
+ *.f95 \
+ *.f03 \
+ *.f08 \
+ *.f \
+ *.for \
+ *.tcl \
+ *.vhd \
+ *.vhdl \
+ *.ucf \
+ *.qsf
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE = ../README.md
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = YES
+INLINE_SOURCES = YES
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_FILES =
+HTML_COLORSTYLE_HUE = 220
+HTML_COLORSTYLE_SAT = 100
+HTML_COLORSTYLE_GAMMA = 80
+HTML_TIMESTAMP = YES
+HTML_DYNAMIC_MENUS = YES
+HTML_DYNAMIC_SECTIONS = YES
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET = YES
+DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_BUNDLE_ID = org.doxygen.Project
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME = InfineonTechnologiesAG
+GENERATE_HTMLHELP = YES
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+CHM_INDEX_ENCODING =
+BINARY_TOC = NO
+TOC_EXPAND = NO
+GENERATE_QHP = YES
+QCH_FILE =
+QHP_NAMESPACE = org.doxygen.Project
+QHP_VIRTUAL_FOLDER = doc
+QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
+QHG_LOCATION =
+GENERATE_ECLIPSEHELP = YES
+ECLIPSE_DOC_ID = org.doxygen.Project
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = YES
+ENUM_VALUES_PER_LINE = 4
+TREEVIEW_WIDTH = 250
+EXT_LINKS_IN_WINDOW = NO
+FORMULA_FONTSIZE = 10
+FORMULA_TRANSPARENT = YES
+USE_MATHJAX = NO
+MATHJAX_FORMAT = HTML-CSS
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS =
+MATHJAX_CODEFILE =
+SEARCHENGINE = YES
+SERVER_BASED_SEARCH = NO
+EXTERNAL_SEARCH = NO
+SEARCHENGINE_URL =
+SEARCHDATA_FILE = searchdata.xml
+EXTERNAL_SEARCH_ID =
+EXTRA_SEARCH_MAPPINGS =
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = build/latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+LATEX_MAKEINDEX_CMD = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4
+EXTRA_PACKAGES =
+LATEX_HEADER =
+LATEX_FOOTER =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+LATEX_SOURCE_CODE = NO
+LATEX_BIB_STYLE = plain
+LATEX_TIMESTAMP = NO
+LATEX_EMOJI_DIRECTORY =
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+RTF_SOURCE_CODE = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_SUBDIR =
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_PROGRAMLISTING = YES
+XML_NS_MEMB_FILE_SCOPE = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK = NO
+DOCBOOK_OUTPUT = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+EXTERNAL_PAGES = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+MSCGEN_PATH =
+DIA_PATH =
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = YES
+DOT_NUM_THREADS = 0
+DOT_FONTNAME = Helvetica
+DOT_FONTSIZE = 10
+DOT_FONTPATH =
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = YES
+UML_LIMIT_NUM_FIELDS = 10
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = YES
+CALLER_GRAPH = YES
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+INTERACTIVE_SVG = YES
+DOT_PATH =
+DOTFILE_DIRS =
+MSCFILE_DIRS =
+DIAFILE_DIRS =
+PLANTUML_JAR_PATH =
+PLANTUML_CFG_FILE =
+PLANTUML_INCLUDE_PATH =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = YES
+DOT_MULTI_TARGETS = YES
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
diff --git a/docs/doxyfile_latex b/docs/doxyfile_latex
new file mode 100644
index 00000000..c1bda78d
--- /dev/null
+++ b/docs/doxyfile_latex
@@ -0,0 +1,381 @@
+# Doxyfile 1.8.16
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = "TLE94112"
+PROJECT_NUMBER = 1.0
+PROJECT_BRIEF = "TLE94112 DC motor control shield"
+PROJECT_LOGO = ./img/ifx_logo.png
+OUTPUT_DIRECTORY = ./docs
+CREATE_SUBDIRS = NO
+ALLOW_UNICODE_NAMES = NO
+OUTPUT_LANGUAGE = English
+OUTPUT_TEXT_DIRECTION = None
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = NO
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 4
+ALIASES =
+TCL_SUBST =
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_FOR_FORTRAN = NO
+OPTIMIZE_OUTPUT_VHDL = NO
+OPTIMIZE_OUTPUT_SLICE = NO
+EXTENSION_MAPPING = ino=c
+MARKDOWN_SUPPORT = YES
+TOC_INCLUDE_HEADINGS = 0
+AUTOLINK_SUPPORT = YES
+BUILTIN_STL_SUPPORT = YES
+CPP_CLI_SUPPORT = YES
+SIP_SUPPORT = YES
+IDL_PROPERTY_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+GROUP_NESTED_COMPOUNDS = NO
+SUBGROUPING = YES
+INLINE_GROUPED_CLASSES = YES
+INLINE_SIMPLE_STRUCTS = YES
+TYPEDEF_HIDES_STRUCT = NO
+LOOKUP_CACHE_SIZE = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_PRIV_VIRTUAL = NO
+EXTRACT_PACKAGE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = YES
+EXTRACT_ANON_NSPACES = YES
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+HIDE_COMPOUND_REFERENCE= NO
+SHOW_INCLUDE_FILES = YES
+SHOW_GROUPED_MEMB_INC = NO
+FORCE_LOCAL_INCLUDES = NO
+INLINE_INFO = NO
+SORT_MEMBER_DOCS = NO
+SORT_BRIEF_DOCS = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES = NO
+SORT_BY_SCOPE_NAME = NO
+STRICT_PROTO_MATCHING = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_FILES = YES
+SHOW_NAMESPACES = YES
+FILE_VERSION_FILTER =
+LAYOUT_FILE =
+CITE_BIB_FILES =
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_AS_ERROR = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE = warn.log
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ./
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.ino \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.idl \
+ *.ddl \
+ *.odl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.cs \
+ *.d \
+ *.php \
+ *.php4 \
+ *.php5 \
+ *.phtml \
+ *.qml \
+ *.inc \
+ *.m \
+ *.markdown \
+ *.md \
+ *.mm \
+ *.dox \
+ *.py \
+ *.pyw \
+ *.f90 \
+ *.f95 \
+ *.f03 \
+ *.f08 \
+ *.f \
+ *.for \
+ *.tcl \
+ *.vhd \
+ *.vhdl \
+ *.ucf \
+ *.qsf
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE = ./README.md
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = NO
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS = NO
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = NO
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_FILES =
+HTML_COLORSTYLE_HUE = 220
+HTML_COLORSTYLE_SAT = 100
+HTML_COLORSTYLE_GAMMA = 80
+HTML_TIMESTAMP = YES
+HTML_DYNAMIC_MENUS = YES
+HTML_DYNAMIC_SECTIONS = YES
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET = YES
+DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_BUNDLE_ID = org.doxygen.Project
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME = InfineonTechnologiesAG
+GENERATE_HTMLHELP = YES
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+CHM_INDEX_ENCODING =
+BINARY_TOC = NO
+TOC_EXPAND = NO
+GENERATE_QHP = YES
+QCH_FILE =
+QHP_NAMESPACE = org.doxygen.Project
+QHP_VIRTUAL_FOLDER = doc
+QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
+QHG_LOCATION =
+GENERATE_ECLIPSEHELP = YES
+ECLIPSE_DOC_ID = org.doxygen.Project
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = YES
+ENUM_VALUES_PER_LINE = 4
+TREEVIEW_WIDTH = 250
+EXT_LINKS_IN_WINDOW = NO
+FORMULA_FONTSIZE = 10
+FORMULA_TRANSPARENT = YES
+USE_MATHJAX = NO
+MATHJAX_FORMAT = HTML-CSS
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS =
+MATHJAX_CODEFILE =
+SEARCHENGINE = YES
+SERVER_BASED_SEARCH = NO
+EXTERNAL_SEARCH = NO
+SEARCHENGINE_URL =
+SEARCHDATA_FILE = searchdata.xml
+EXTERNAL_SEARCH_ID =
+EXTRA_SEARCH_MAPPINGS =
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = YES
+LATEX_OUTPUT = build/latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+LATEX_MAKEINDEX_CMD = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4
+EXTRA_PACKAGES =
+LATEX_HEADER = ./docs/build/latexfiles/header.tex
+LATEX_FOOTER = ./docs/build/latexfiles/footer.tex
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+LATEX_SOURCE_CODE = NO
+LATEX_BIB_STYLE = plain
+LATEX_TIMESTAMP = NO
+LATEX_EMOJI_DIRECTORY =
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+RTF_SOURCE_CODE = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_SUBDIR =
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_PROGRAMLISTING = YES
+XML_NS_MEMB_FILE_SCOPE = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK = NO
+DOCBOOK_OUTPUT = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+EXTERNAL_PAGES = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+MSCGEN_PATH =
+DIA_PATH =
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = YES
+DOT_NUM_THREADS = 0
+DOT_FONTNAME = Helvetica
+DOT_FONTSIZE = 10
+DOT_FONTPATH =
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = YES
+UML_LIMIT_NUM_FIELDS = 10
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = YES
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+INTERACTIVE_SVG = YES
+DOT_PATH =
+DOTFILE_DIRS =
+MSCFILE_DIRS =
+DIAFILE_DIRS =
+PLANTUML_JAR_PATH =
+PLANTUML_CFG_FILE =
+PLANTUML_INCLUDE_PATH =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = YES
+DOT_MULTI_TARGETS = YES
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
diff --git a/docs/img/TLE94112_Arduino_Shield_Pin_out.png b/docs/img/TLE94112_Arduino_Shield_Pin_out.png
new file mode 100644
index 00000000..f35d0f91
Binary files /dev/null and b/docs/img/TLE94112_Arduino_Shield_Pin_out.png differ
diff --git a/docs/img/TLE94112_Arduino_Shield_Pin_out.svg b/docs/img/TLE94112_Arduino_Shield_Pin_out.svg
new file mode 100644
index 00000000..1ec722ae
--- /dev/null
+++ b/docs/img/TLE94112_Arduino_Shield_Pin_out.svg
@@ -0,0 +1,9245 @@
+
+
+
+
diff --git a/docs/img/tle94112_top.png b/docs/img/tle94112_top.png
new file mode 100644
index 00000000..3c643724
Binary files /dev/null and b/docs/img/tle94112_top.png differ
diff --git a/docs/img/tle94112_top.xcf b/docs/img/tle94112_top.xcf
new file mode 100644
index 00000000..ff755c51
Binary files /dev/null and b/docs/img/tle94112_top.xcf differ
diff --git a/examples/Control2Motors/Control2Motors.ino b/examples/Control2Motors/Control2Motors.ino
index 5532d396..6d7c2281 100644
--- a/examples/Control2Motors/Control2Motors.ino
+++ b/examples/Control2Motors/Control2Motors.ino
@@ -1,3 +1,29 @@
+/*!
+ * \name Control2Motors
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief
+ * This example demonstrates how to control two motors, their speed and direction
+ * with the TLE94112 shield
+ * \detail
+ * By attaching a Tle94112 controller object to two Tle94112Motor objects, we can generate
+ * an easy to handle motor object for each motor. We can easily attach this motor object
+ * two any of the halfbridges and to any of the PWM units. This is done in the setup part.
+ * Keep in mind that you have to initialize the Tle94112 controller and each motor object,
+ * which is done in the setup function.
+ * After that we can take the motor start, stop and setSpeed function to easily control
+ * each motor.
+ *
+ * \attention Motors have depending on there size a very big latency until a motor has
+ * fully started or is stoped to 0. Specially the time between a start and stop and vice versa
+ * is much higher than higher than the processing speed of any microcontroller. This
+ * is solved in this example with the delay command, but there are better solutions than that.
+ * This delays are needed because a direct switch between start and stop will lead to high currents
+ * and the TLE94112 will signal an overcurrent.
+ *
+ */
+
#include
#include
@@ -78,4 +104,4 @@ void loop()
motor1.stop(255);
delay(5000);
-}
\ No newline at end of file
+}
diff --git a/examples/rampSpeedTest/rampSpeedTest.ino b/examples/rampSpeedTest/rampSpeedTest.ino
index 63fd94f0..a29f1858 100644
--- a/examples/rampSpeedTest/rampSpeedTest.ino
+++ b/examples/rampSpeedTest/rampSpeedTest.ino
@@ -1,8 +1,25 @@
+/*!
+ * \name rampSpeedTest
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief
+ * This example measure the rampspeed of an attached motor with the TLE94112 shield
+ * \detail
+ * By attaching a motor to the TLE94112 and running a testcase scenario, we can measure the
+ * optimal values for the rampSpeed function. This function allows us to smoothly start, stop,
+ * raise or break the motor.
+ *
+ * \attention A free running motor ramps very different that the same motor with load attached.
+ * So you have to measure different scenarios.
+ *
+ */
+
#include
#include
-// Tle94112 Object on Shiled 1
+// Tle94112 Object on Shield 1
Tle94112 controller1 = Tle94112();
// Tle94112Motor Objects on controller1
@@ -15,6 +32,7 @@ typedef struct {
uint16_t slope;
} RampMeasurement_t, *RampMeasurement_p;
+// lets define an array with different
#define NUM_TESTS 6
RampMeasurement_t testcases[NUM_TESTS] = {
{ 0, 255, 5000 },
@@ -78,4 +96,4 @@ void loop() {
{
measureRampTime(i);
}
-}
\ No newline at end of file
+}
diff --git a/examples/rampTest/rampTest.ino b/examples/rampTest/rampTest.ino
index 9e19f60c..47310e81 100644
--- a/examples/rampTest/rampTest.ino
+++ b/examples/rampTest/rampTest.ino
@@ -1,111 +1,122 @@
-#include
-#include
-/*
- ============================================================================
- Name : Lego Robot III
- Author : Dr. Olaf Filies, Marcus Gordon Filies
- Version : 0.9
- Description : ramping the motor speed of a high current motor
- ============================================================================
- */
-
-// Tle94112 Object on Shield 1
-Tle94112 controller1 = Tle94112();
-
-// Tle94112Motor Objects on controller1
-Tle94112Motor motor1(controller1);
-
-
-void setup() {
- Serial.begin(115200); // Switch on comunication
- Serial.println("Init ready");
-
- // Enable MotorController on all Shields and Motors
- // Note: Required to be done before starting to configure the motor
- // controller1 is set to default CS1 pin
- controller1.begin();
-
- //-Motor1-high current motor between out1/out2 = HB1/HB2 and out3/out4 = HB3/HB4-------------------
-
- // Connect motor1 to HB1/HB2 highside and HB3/HB4 lowside
- // IMPORTANT connect PWM to Lowside as higside is active Free wheeling
- motor1.initConnector(motor1.HIGHSIDE, controller1.TLE_NOPWM, controller1.TLE_HB1, controller1.TLE_HB2, controller1.TLE_NOHB, controller1.TLE_NOHB);
- motor1.initConnector(motor1.LOWSIDE, controller1.TLE_PWM1, controller1.TLE_HB3, controller1.TLE_HB4, controller1.TLE_NOHB, controller1.TLE_NOHB);
-
- // start motor1
- motor1.begin();
-}
-
-void loop() {
-
- motor1.coast();
- delay(1000);
-
-// max forward/backward
- Serial.println("max forward/backward");
- motor1.start(255);
- delay(1000);
- motor1.coast();
- delay(1000);
- motor1.start(-255);
- delay(1000);
- motor1.coast();
- delay(1000);
-
-// ramp rippel forward/backward
- Serial.println("ramp rippel forward/backward");
- motor1.start(255);
- delay(1000);
- motor1.rampSpeed(0,5000);
- delay(1000);
- motor1.start(-255);
- delay(1000);
- motor1.rampSpeed(0,5000);
- delay(1000);
-
-// ramp up/down forward
- Serial.println("ramp up/down forward");
- motor1.start(50); // start above 0 to allow motor to start
- motor1.rampSpeed(255,5000);
- delay(1000);
- motor1.rampSpeed(100,5000);
- delay(1000);
- motor1.rampSpeed(255,5000);
- delay(1000);
- motor1.rampSpeed(0,5000);
-
-// ramp up/down backward
- Serial.println("ramp up/down backward");
- motor1.start(50);
- motor1.rampSpeed(-255,5000);
- delay(1000);
- motor1.rampSpeed(-100,5000);
- delay(1000);
- motor1.rampSpeed(-255,5000);
- delay(1000);
- motor1.rampSpeed(0,5000);
-
-// ramp transient
- Serial.println("ramp transient");
- motor1.rampSpeed(-255,1000);
- delay(1000);
- motor1.rampSpeed(255,1000);
- delay(1000);
- motor1.rampSpeed(-255,1000);
- delay(1000);
- motor1.rampSpeed(0,1000);
- delay(1000);
-
-// stop and coast
- Serial.println("stop and coast");
- motor1.stop(255);
- delay(1000);
- motor1.coast();
- delay(1000);
-
-
-}
-
-
-
-
+/*!
+ * \name rampTest
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief
+ * This example to run a motor with the rampSpeed function
+ * \detail
+ * This example also demonstrats how to attach a bigger motor on 4 halfbridges with a total
+ * current of 1.8 A. Originally designed to test Lego (R) Powerfunktions or Mindstorm motors,
+ * this sketch can be used to simply run a motor smoothly with different speeds
+ * in different directions.
+ *
+ */
+
+#include
+#include
+/*
+ ============================================================================
+ Name : Lego Robot III
+ Author : Dr. Olaf Filies, Marcus Gordon Filies
+ Version : 0.9
+ Description : ramping the motor speed of a high current motor
+ ============================================================================
+ */
+
+// Tle94112 Object on Shield 1
+Tle94112 controller1 = Tle94112();
+
+// Tle94112Motor Objects on controller1
+Tle94112Motor motor1(controller1);
+
+
+void setup() {
+ Serial.begin(115200); // Switch on communications
+ Serial.println("Init ready");
+
+ // Enable MotorController on all Shields and Motors
+ // Note: Required to be done before starting to configure the motor
+ // controller1 is set to default CS1 pin
+ controller1.begin();
+
+ //-Motor1-high current motor between out1/out2 = HB1/HB2 and out3/out4 = HB3/HB4-------------------
+
+ // Connect motor1 to HB1/HB2 highside and HB3/HB4 lowside
+ // IMPORTANT connect PWM to Lowside as higside is active Free wheeling
+ motor1.initConnector(motor1.HIGHSIDE, controller1.TLE_NOPWM, controller1.TLE_HB1, controller1.TLE_HB2, controller1.TLE_NOHB, controller1.TLE_NOHB);
+ motor1.initConnector(motor1.LOWSIDE, controller1.TLE_PWM1, controller1.TLE_HB3, controller1.TLE_HB4, controller1.TLE_NOHB, controller1.TLE_NOHB);
+
+ // start motor1
+ motor1.begin();
+}
+
+void loop() {
+
+ motor1.coast();
+ delay(1000);
+
+// max forward/backward
+ Serial.println("max forward/backward");
+ motor1.start(255);
+ delay(1000);
+ motor1.coast();
+ delay(1000);
+ motor1.start(-255);
+ delay(1000);
+ motor1.coast();
+ delay(1000);
+
+// ramp ripple forward/backward
+ Serial.println("ramp ripple forward/backward");
+ motor1.start(255);
+ delay(1000);
+ motor1.rampSpeed(0,5000);
+ delay(1000);
+ motor1.start(-255);
+ delay(1000);
+ motor1.rampSpeed(0,5000);
+ delay(1000);
+
+// ramp up/down forward
+ Serial.println("ramp up/down forward");
+ motor1.start(50); // start above 0 to allow motor to start
+ motor1.rampSpeed(255,5000);
+ delay(1000);
+ motor1.rampSpeed(100,5000);
+ delay(1000);
+ motor1.rampSpeed(255,5000);
+ delay(1000);
+ motor1.rampSpeed(0,5000);
+
+// ramp up/down backward
+ Serial.println("ramp up/down backward");
+ motor1.start(50);
+ motor1.rampSpeed(-255,5000);
+ delay(1000);
+ motor1.rampSpeed(-100,5000);
+ delay(1000);
+ motor1.rampSpeed(-255,5000);
+ delay(1000);
+ motor1.rampSpeed(0,5000);
+
+// ramp transient
+ Serial.println("ramp transient");
+ motor1.rampSpeed(-255,1000);
+ delay(1000);
+ motor1.rampSpeed(255,1000);
+ delay(1000);
+ motor1.rampSpeed(-255,1000);
+ delay(1000);
+ motor1.rampSpeed(0,1000);
+ delay(1000);
+
+// stop and coast
+ Serial.println("stop and coast");
+ motor1.stop(255);
+ delay(1000);
+ motor1.coast();
+ delay(1000);
+
+
+}
diff --git a/examples/speedControl/speedControl.ino b/examples/speedControl/speedControl.ino
index 336aaf53..082d06b0 100644
--- a/examples/speedControl/speedControl.ino
+++ b/examples/speedControl/speedControl.ino
@@ -1,41 +1,58 @@
-#include
-
-// Tle94112 Object
-Tle94112 controller = Tle94112();
-
-#define pinDir 5
-#define pinSpeed A0
-//connect motor between halfbridge 1 and halfbridge 2
-
-
-void setup()
-{
- // Enable MotorController Tle94112
- // Note: Required to be done before starting to configure the motor
- controller.begin();
-
- pinMode(pinDir, INPUT);
- pinMode(pinSpeed, INPUT);
-}
-
-
-void loop() {
- // get desired direction from digital pin
- uint8_t dir = digitalRead(pinDir);
- if(dir == HIGH)
- {
- controller.configHB(controller.TLE_HB1, controller.TLE_HIGH, controller.TLE_PWM1);
- controller.configHB(controller.TLE_HB2, controller.TLE_LOW, controller.TLE_NOPWM);
- }
- else
- {
- controller.configHB(controller.TLE_HB1, controller.TLE_LOW, controller.TLE_NOPWM);
- controller.configHB(controller.TLE_HB2, controller.TLE_HIGH, controller.TLE_PWM1);
- }
-
- // get desired motor speed from analog input
- uint8_t dc = analogRead(pinSpeed) >> 2;
-
- // update motor speed
- controller.configPWM(controller.TLE_PWM1, controller.TLE_FREQ80HZ, dc);
-}
\ No newline at end of file
+/*!
+ * \name speedControl
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief
+ * This example demonstrates how to control the speed of motor by using the PWM units
+ * of the TLE94112 shield
+ * \detail
+ * Attaching a potentiometer on an analog input pin, which will than controll the
+ * setting of the TLE94112 internal PWM unit and therefore the speed of the motor.
+ * The TLE94112 has three seperat PWM units which can be attached to any combination
+ * of halfbridges. So try out to change the TLE_PWM1 to TLE_PWM2 or TLE_PWM3 to see this.
+ * You can change the motor direction by changing the HIGH/LOW status of the halfbridges
+ *
+ */
+
+#include
+
+//! Tle94112 Object
+Tle94112 controller = Tle94112();
+
+//! Select pins for speed and direction setings
+#define pinDir 5
+#define pinSpeed A0
+
+//! connect motor between halfbridge 1 and halfbridge 2
+void setup()
+{
+ // Enable MotorController Tle94112
+ // Note: Required to be done before starting to configure the motor
+ controller.begin();
+
+ pinMode(pinDir, INPUT);
+ pinMode(pinSpeed, INPUT);
+}
+
+
+void loop() {
+ // get desired direction from digital pin
+ uint8_t dir = digitalRead(pinDir);
+ if(dir == HIGH)
+ {
+ controller.configHB(controller.TLE_HB1, controller.TLE_HIGH, controller.TLE_PWM1);
+ controller.configHB(controller.TLE_HB2, controller.TLE_LOW, controller.TLE_NOPWM);
+ }
+ else
+ {
+ controller.configHB(controller.TLE_HB1, controller.TLE_LOW, controller.TLE_NOPWM);
+ controller.configHB(controller.TLE_HB2, controller.TLE_HIGH, controller.TLE_PWM1);
+ }
+
+ // get desired motor speed from analog input
+ uint8_t dc = analogRead(pinSpeed) >> 2;
+
+ // update motor speed
+ controller.configPWM(controller.TLE_PWM1, controller.TLE_FREQ80HZ, dc);
+}
diff --git a/keywords.txt b/keywords.txt
index 7bd21fe1..53e81ad4 100644
--- a/keywords.txt
+++ b/keywords.txt
@@ -3,83 +3,83 @@
#######################################
#######################################
-# Datatypes (KEYWORD1)
+# Datatypes (KEYWORD1)
#######################################
#######################################
# Methods and Functions (KEYWORD2)
#######################################
-begin KEYWORD2
-end KEYWORD2
-configHB KEYWORD2
-configPWM KEYWORD2
-getSysDiagnosis KEYWORD2
-getHBOverCurrent KEYWORD2
-getHBOpenLoad KEYWORD2
-clearErrors KEYWORD2
+begin KEYWORD2
+end KEYWORD2
+configHB KEYWORD2
+configPWM KEYWORD2
+getSysDiagnosis KEYWORD2
+getHBOverCurrent KEYWORD2
+getHBOpenLoad KEYWORD2
+clearErrors KEYWORD2
-initConnector KEYWORD2
-connect KEYWORD2
-disconnect KEYWORD2
-setPwm KEYWORD2
-setPwmFreq KEYWORD2
+initConnector KEYWORD2
+connect KEYWORD2
+disconnect KEYWORD2
+setPwm KEYWORD2
+setPwmFreq KEYWORD2
setActiveFreeWheeling KEYWORD2
-stop KEYWORD2
-coast KEYWORD2
-start KEYWORD2
-setSpeed KEYWORD2
-getSpeed KEYWORD2
-rampSpeed KEYWORD2
+stop KEYWORD2
+coast KEYWORD2
+start KEYWORD2
+setSpeed KEYWORD2
+getSpeed KEYWORD2
+rampSpeed KEYWORD2
#######################################
-# Instances (KEYWORD2)
+# Instances (KEYWORD2)
#######################################
-Tle94112 KEYWORD2
-Tle94112Motor KEYWORD2
+Tle94112 KEYWORD2
+Tle94112Motor KEYWORD2
#######################################
-# Constants (LITERAL1)
+# Constants (LITERAL1)
#######################################
-TLE_NOHB LITERAL1
-TLE_HB1 LITERAL1
-TLE_HB2 LITERAL1
-TLE_HB3 LITERAL1
-TLE_HB4 LITERAL1
-TLE_HB5 LITERAL1
-TLE_HB6 LITERAL1
-TLE_HB7 LITERAL1
-TLE_HB8 LITERAL1
-TLE_HB9 LITERAL1
-TLE_HB10 LITERAL1
-TLE_HB11 LITERAL1
-TLE_HB12 LITERAL1
+TLE_NOHB LITERAL1
+TLE_HB1 LITERAL1
+TLE_HB2 LITERAL1
+TLE_HB3 LITERAL1
+TLE_HB4 LITERAL1
+TLE_HB5 LITERAL1
+TLE_HB6 LITERAL1
+TLE_HB7 LITERAL1
+TLE_HB8 LITERAL1
+TLE_HB9 LITERAL1
+TLE_HB10 LITERAL1
+TLE_HB11 LITERAL1
+TLE_HB12 LITERAL1
-TLE_NOPWM LITERAL1
-TLE_PWM1 LITERAL1
-TLE_PWM2 LITERAL1
-TLE_PWM3 LITERAL1
+TLE_NOPWM LITERAL1
+TLE_PWM1 LITERAL1
+TLE_PWM2 LITERAL1
+TLE_PWM3 LITERAL1
-TLE_FLOATING LITERAL1
-TLE_LOW LITERAL1
-TLE_HIGH LITERAL1
+TLE_FLOATING LITERAL1
+TLE_LOW LITERAL1
+TLE_HIGH LITERAL1
-TLE_FREQOFF LITERAL1
-TLE_FREQ80HZ LITERAL1
-TLE_FREQ100HZ LITERAL1
-TLE_FREQ200HZ LITERAL1
+TLE_FREQOFF LITERAL1
+TLE_FREQ80HZ LITERAL1
+TLE_FREQ100HZ LITERAL1
+TLE_FREQ200HZ LITERAL1
-TLE_SPI_ERROR LITERAL1
-TLE_LOAD_ERROR LITERAL1
-TLE_UNDER_VOLTAGE LITERAL1
-TLE_OVER_VOLTAGE LITERAL1
-TLE_POWER_ON_RESET LITERAL1
-TLE_TEMP_SHUTDOWN LITERAL1
-TLE_TEMP_WARNING LITERAL1
+TLE_SPI_ERROR LITERAL1
+TLE_LOAD_ERROR LITERAL1
+TLE_UNDER_VOLTAGE LITERAL1
+TLE_OVER_VOLTAGE LITERAL1
+TLE_POWER_ON_RESET LITERAL1
+TLE_TEMP_SHUTDOWN LITERAL1
+TLE_TEMP_WARNING LITERAL1
-TLE_STATUS_OK LITERAL1
+TLE_STATUS_OK LITERAL1
-LOWSIDE LITERAL1
-HIGHSIDE LITERAL1
\ No newline at end of file
+LOWSIDE LITERAL1
+HIGHSIDE LITERAL1
\ No newline at end of file
diff --git a/library.properties b/library.properties
index 0b1255b9..6446eee0 100644
--- a/library.properties
+++ b/library.properties
@@ -1,10 +1,10 @@
-name=TLE94112
-version=1.4.0
-author=Infineon Technologies
-maintainer=Infineon Technologies
-sentence=This library provides an interface for Infineons DC Motor Control Shield with TLE94112EL
-paragraph=This shield provides 12 half-bridges which can drive up to 6 indipendent (+5 cascaded) bidirectional motors consuming up to 0.9 Ampere each
-category=Device Control
-url=https://www.infineon.com/dgdl/Infineon-DC_Motor_Control_Shield_with_TLE94112EL_UserManual-UM-v01_00-EN.pdf?fileId=5546d46259d9a4bf015a4755351304ac
-architectures=*
-
+name=TLE94112
+version=1.4.1
+author=Infineon Technologies
+maintainer=Infineon Technologies
+sentence=This library provides an interface for Infineons DC Motor Control Shield with TLE94112EL
+paragraph=This shield provides 12 half-bridges which can drive up to 6 indipendent (+5 cascaded) bidirectional motors consuming up to 0.9 Ampere each
+category=Device Control
+url=https://www.infineon.com/cms/en/product/evaluation-boards/tle94112el_shield/
+architectures=*
+
diff --git a/src/TLE94112.cpp b/src/TLE94112.cpp
index 4018a4b1..d034a20e 100644
--- a/src/TLE94112.cpp
+++ b/src/TLE94112.cpp
@@ -1,222 +1,226 @@
-/*
- * Arduino library to control Infineon's DC Motor Control Shield with TLE94112
- *
- * The shield contains twelve independent halfbridges,
- * so it can drive up to 6 indipendent (+5 cascaded) bidirectional DC motor(s).
- * Each halfbridge provides a high-Voltage (nominal 5.5-18 V) tristate output,
- * which is also capable of PWM with 3 different frequencies.
- *
- * Have a look at the datasheet for more information.
- */
-
-/*! \file TLE94112.cpp
- * \brief This file defines functions and predefined instances from TLE94112.h
- */
-
-#include "TLE94112.h"
-#include "./util/tle94112_conf.h"
-
-//SPI address commands
-#define TLE94112_CMD_WRITE 0x80;
-#define TLE94112_CMD_CLEAR 0x80;
-
-#define TLE94112_CS_RISETIME 2
-
-#define TLE94112_STATUS_INV_MASK (Tle94112::TLE_POWER_ON_RESET)
-
-
-Tle94112::Tle94112(void)
-{
-}
-
-void Tle94112::begin(void)
-{
- begin(SPI, TLE94112_PIN_CS1, TLE94112_PIN_EN);
-}
-
-void Tle94112::begin(SPIClass &bus, uint8_t cs, uint8_t en)
-{
- mEnabled = FALSE;
- mBus = &bus;
- mCsPin = cs;
- mEnPin = en;
-
- mEnabled = TRUE;
- mBus->begin();
- mBus->setBitOrder(LSBFIRST);
- mBus->setClockDivider(SPI_CLOCK_DIV16);
- mBus->setDataMode(SPI_MODE1);
- pinMode(mEnPin, OUTPUT);
- pinMode(mCsPin, OUTPUT);
- digitalWrite(mCsPin, HIGH);
- digitalWrite(mEnPin, HIGH);
- init();
-}
-
-
-void Tle94112::end(void)
-{
- mEnabled = FALSE;
- digitalWrite(mCsPin, HIGH);
- digitalWrite(mEnPin, LOW);
-}
-
-void Tle94112::configHB(HalfBridge hb, HBState state, PWMChannel pwm)
-{
- configHB(hb, state, pwm, 0);
-}
-
-void Tle94112::configHB(HalfBridge hb, HBState state, PWMChannel pwm, uint8_t activeFW)
-{
- if(mEnabled == TRUE)
- {
- configHB(static_cast(hb),
- static_cast(state),
- static_cast(pwm),
- activeFW );
- }
-}
-
-void Tle94112::configHB(uint8_t hb, uint8_t state, uint8_t pwm, uint8_t activeFW)
-{
- uint8_t reg = mHalfBridges[hb].stateReg;
- uint8_t mask = mHalfBridges[hb].stateMask;
- uint8_t shift = mHalfBridges[hb].stateShift;
- writeReg(reg, mask, shift, state);
-
- reg = mHalfBridges[hb].pwmReg;
- mask = mHalfBridges[hb].pwmMask;
- shift = mHalfBridges[hb].pwmShift;
- writeReg(reg, mask, shift, pwm);
-
- reg = mHalfBridges[hb].fwReg;
- mask = mHalfBridges[hb].fwMask;
- shift = mHalfBridges[hb].fwShift;
- writeReg(reg, mask, shift, activeFW);
-}
-
-void Tle94112::configPWM(PWMChannel pwm, PWMFreq freq, uint8_t dutyCycle)
-{
- if(mEnabled == TRUE)
- {
- configPWM(static_cast(pwm),
- static_cast(freq),
- dutyCycle );
- }
-}
-
-void Tle94112::configPWM(uint8_t pwm, uint8_t freq, uint8_t dutyCycle)
-{
- uint8_t reg = mPwmChannels[pwm].freqReg;
- uint8_t mask = mPwmChannels[pwm].freqMask;
- uint8_t shift = mPwmChannels[pwm].freqShift;
- writeReg(reg, mask, shift, freq);
-
- reg = mPwmChannels[pwm].dcReg;
- mask = mPwmChannels[pwm].dcMask;
- shift = mPwmChannels[pwm].dcShift;
- writeReg(reg, mask, shift, dutyCycle);
-}
-
-uint8_t Tle94112::getSysDiagnosis()
-{
- uint8_t ret = readStatusReg(SYS_DIAG1);
- return ret^TLE94112_STATUS_INV_MASK;
-}
-
-uint8_t Tle94112::getSysDiagnosis(DiagFlag mask)
-{
- return getSysDiagnosis(static_cast(mask));
-}
-
-uint8_t Tle94112::getSysDiagnosis(uint8_t mask)
-{
- uint8_t ret = readStatusReg(SYS_DIAG1, mask, 0);
- return ret^(TLE94112_STATUS_INV_MASK&mask);
-}
-
-uint8_t Tle94112::getHBOverCurrent(HalfBridge hb)
-{
- return getHBOverCurrent(static_cast(hb));
-}
-
-uint8_t Tle94112::getHBOverCurrent(uint8_t hb)
-{
- uint8_t reg = mHalfBridges[hb].ocReg;
- uint8_t mask = mHalfBridges[hb].ocMask;
- uint8_t shift = mHalfBridges[hb].ocShift;
- return readStatusReg(reg, mask, shift);
-}
-
-uint8_t Tle94112::getHBOpenLoad(HalfBridge hb)
-{
- return getHBOpenLoad(static_cast(hb));
-}
-
-uint8_t Tle94112::getHBOpenLoad(uint8_t hb)
-{
- uint8_t reg = mHalfBridges[hb].olReg;
- uint8_t mask = mHalfBridges[hb].olMask;
- uint8_t shift = mHalfBridges[hb].olShift;
- return readStatusReg(reg, mask, shift);
-}
-
-void Tle94112::clearErrors()
-{
- clearStatusReg(SYS_DIAG1);
- clearStatusReg(OP_ERROR_1_STAT);
- clearStatusReg(OP_ERROR_2_STAT);
- clearStatusReg(OP_ERROR_3_STAT);
- clearStatusReg(OP_ERROR_4_STAT);
- clearStatusReg(OP_ERROR_5_STAT);
- clearStatusReg(OP_ERROR_6_STAT);
-}
-
-void Tle94112::writeReg(uint8_t reg, uint8_t mask, uint8_t shift, uint8_t data)
-{
- uint8_t address = mCtrlRegAddresses[reg];
- uint8_t toWrite = mCtrlRegData[reg] & (~mask);
- toWrite |= (data << shift) & mask;
- mCtrlRegData[reg] = toWrite;
-
- address = address | TLE94112_CMD_WRITE;
- digitalWrite(mCsPin, LOW);
- uint8_t byte0 = mBus->transfer(address);
- uint8_t byte1 = mBus->transfer(toWrite);
- digitalWrite(mCsPin, HIGH);
- delay(TLE94112_CS_RISETIME);
-}
-
-uint8_t Tle94112::readStatusReg(uint8_t reg)
-{
- //read the whole register
- return readStatusReg(reg, 0xFF, 0);
-}
-
-uint8_t Tle94112::readStatusReg(uint8_t reg, uint8_t mask, uint8_t shift)
-{
- uint8_t address = mStatusRegAddresses[reg];
-
- digitalWrite(mCsPin, LOW);
- uint8_t byte0 = SPI.transfer(address);
- uint8_t received = SPI.transfer(0xFF); //send dummy byte while receiving
- digitalWrite(mCsPin, HIGH);
- delay(TLE94112_CS_RISETIME);
-
- received = (received & mask) >> shift;
-
- return received;
-}
-
-void Tle94112::clearStatusReg(uint8_t reg)
-{
- uint8_t address = mStatusRegAddresses[reg];
-
- address = address | TLE94112_CMD_CLEAR;
- digitalWrite(mCsPin, LOW);
- uint8_t byte0 = mBus->transfer(address);
- uint8_t byte1 = mBus->transfer(0); //clear register by writing 0x00
- digitalWrite(mCsPin, HIGH);
- delay(TLE94112_CS_RISETIME);
-}
-
+/*!
+ * \file Tle94112.cpp
+ * \name Tle94112.cpp - Arduino library to control Infineon's DC Motor Control Shield with Tle94112
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief This file has to be included in projects that use Infineon's DC Motor Control Shield with TLE94112
+ * \details
+ * The Infineon TLE94112EL DC motor controller shield is able to handle 6 motors with a max. current of 0.9 A
+ * independently and additional 5 motors cascaded. The twelve half-bridges can be arranged also together,
+ * so that 3 motors with 1.8 A current or one motor with 3.6 A can be used. Each half bridge can
+ * provide a high-Voltage (nominal 5.5-18 V) tristate output and max. input voltage of 40V. It is also
+ * capable of PWM with 3 different frequencies for controlling the speed of each motor.
+ * Have a look at the datasheet for more information.
+ *
+ * This library include the basic functions to access the half-bridges.
+ *
+ * Have a look at the datasheet for more information.
+ */
+
+
+#include "TLE94112.h"
+#include "./util/tle94112_conf.h"
+
+//SPI address commands
+#define TLE94112_CMD_WRITE 0x80;
+#define TLE94112_CMD_CLEAR 0x80;
+
+#define TLE94112_STATUS_INV_MASK (Tle94112::TLE_POWER_ON_RESET)
+#define TLE94112_CS_RISETIME 2
+
+
+Tle94112::Tle94112(void)
+{
+}
+
+void Tle94112::begin(void)
+{
+ begin(SPI, TLE94112_PIN_CS1, TLE94112_PIN_EN);
+}
+
+void Tle94112::begin(SPIClass &bus, uint8_t cs, uint8_t en)
+{
+ mEnabled = FALSE;
+ mBus = &bus;
+ mCsPin = cs;
+ mEnPin = en;
+
+ mEnabled = TRUE;
+ mBus->begin();
+ mBus->setBitOrder(LSBFIRST);
+ mBus->setClockDivider(SPI_CLOCK_DIV16);
+ mBus->setDataMode(SPI_MODE1);
+ pinMode(mEnPin, OUTPUT);
+ pinMode(mCsPin, OUTPUT);
+ digitalWrite(mCsPin, HIGH);
+ digitalWrite(mEnPin, HIGH);
+ init();
+}
+
+void Tle94112::end(void)
+{
+ mEnabled = FALSE;
+ digitalWrite(mCsPin, HIGH);
+ digitalWrite(mEnPin, LOW);
+}
+
+void Tle94112::configHB(HalfBridge hb, HBState state, PWMChannel pwm)
+{
+ configHB(hb, state, pwm, 0);
+}
+
+void Tle94112::configHB(HalfBridge hb, HBState state, PWMChannel pwm, uint8_t activeFW)
+{
+ if(mEnabled == TRUE)
+ {
+ configHB(static_cast(hb),
+ static_cast(state),
+ static_cast(pwm),
+ activeFW );
+ }
+}
+
+void Tle94112::configHB(uint8_t hb, uint8_t state, uint8_t pwm, uint8_t activeFW)
+{
+ uint8_t reg = mHalfBridges[hb].stateReg;
+ uint8_t mask = mHalfBridges[hb].stateMask;
+ uint8_t shift = mHalfBridges[hb].stateShift;
+ writeReg(reg, mask, shift, state);
+
+ reg = mHalfBridges[hb].pwmReg;
+ mask = mHalfBridges[hb].pwmMask;
+ shift = mHalfBridges[hb].pwmShift;
+ writeReg(reg, mask, shift, pwm);
+
+ reg = mHalfBridges[hb].fwReg;
+ mask = mHalfBridges[hb].fwMask;
+ shift = mHalfBridges[hb].fwShift;
+ writeReg(reg, mask, shift, activeFW);
+}
+
+void Tle94112::configPWM(PWMChannel pwm, PWMFreq freq, uint8_t dutyCycle)
+{
+ if(mEnabled == TRUE)
+ {
+ configPWM(static_cast(pwm),
+ static_cast(freq),
+ dutyCycle );
+ }
+}
+
+void Tle94112::configPWM(uint8_t pwm, uint8_t freq, uint8_t dutyCycle)
+{
+ uint8_t reg = mPwmChannels[pwm].freqReg;
+ uint8_t mask = mPwmChannels[pwm].freqMask;
+ uint8_t shift = mPwmChannels[pwm].freqShift;
+ writeReg(reg, mask, shift, freq);
+
+ reg = mPwmChannels[pwm].dcReg;
+ mask = mPwmChannels[pwm].dcMask;
+ shift = mPwmChannels[pwm].dcShift;
+ writeReg(reg, mask, shift, dutyCycle);
+}
+
+uint8_t Tle94112::getSysDiagnosis()
+{
+ uint8_t ret = readStatusReg(SYS_DIAG1);
+ return ret^TLE94112_STATUS_INV_MASK;
+}
+
+uint8_t Tle94112::getSysDiagnosis(DiagFlag mask)
+{
+ return getSysDiagnosis(static_cast(mask));
+}
+
+uint8_t Tle94112::getSysDiagnosis(uint8_t mask)
+{
+ uint8_t ret = readStatusReg(SYS_DIAG1, mask, 0);
+ return ret^(TLE94112_STATUS_INV_MASK&mask);
+}
+
+uint8_t Tle94112::getHBOverCurrent(HalfBridge hb)
+{
+ return getHBOverCurrent(static_cast(hb));
+}
+
+uint8_t Tle94112::getHBOverCurrent(uint8_t hb)
+{
+ uint8_t reg = mHalfBridges[hb].ocReg;
+ uint8_t mask = mHalfBridges[hb].ocMask;
+ uint8_t shift = mHalfBridges[hb].ocShift;
+ return readStatusReg(reg, mask, shift);
+}
+
+uint8_t Tle94112::getHBOpenLoad(HalfBridge hb)
+{
+ return getHBOpenLoad(static_cast(hb));
+}
+
+uint8_t Tle94112::getHBOpenLoad(uint8_t hb)
+{
+ uint8_t reg = mHalfBridges[hb].olReg;
+ uint8_t mask = mHalfBridges[hb].olMask;
+ uint8_t shift = mHalfBridges[hb].olShift;
+ return readStatusReg(reg, mask, shift);
+}
+
+void Tle94112::clearErrors()
+{
+ clearStatusReg(SYS_DIAG1);
+ clearStatusReg(OP_ERROR_1_STAT);
+ clearStatusReg(OP_ERROR_2_STAT);
+ clearStatusReg(OP_ERROR_3_STAT);
+ clearStatusReg(OP_ERROR_4_STAT);
+ clearStatusReg(OP_ERROR_5_STAT);
+ clearStatusReg(OP_ERROR_6_STAT);
+}
+
+void Tle94112::writeReg(uint8_t reg, uint8_t mask, uint8_t shift, uint8_t data)
+{
+ uint8_t address = mCtrlRegAddresses[reg];
+ uint8_t toWrite = mCtrlRegData[reg] & (~mask);
+ toWrite |= (data << shift) & mask;
+ mCtrlRegData[reg] = toWrite;
+
+ address = address | TLE94112_CMD_WRITE;
+ digitalWrite(mCsPin, LOW);
+ uint8_t byte0 = mBus->transfer(address);
+ uint8_t byte1 = mBus->transfer(toWrite);
+ digitalWrite(mCsPin, HIGH);
+ delay(TLE94112_CS_RISETIME);
+}
+
+uint8_t Tle94112::readStatusReg(uint8_t reg)
+{
+ //read the whole register
+ return readStatusReg(reg, 0xFF, 0);
+}
+
+uint8_t Tle94112::readStatusReg(uint8_t reg, uint8_t mask, uint8_t shift)
+{
+ uint8_t address = mStatusRegAddresses[reg];
+
+ digitalWrite(mCsPin, LOW);
+ uint8_t byte0 = SPI.transfer(address);
+ uint8_t received = SPI.transfer(0xFF); //send dummy byte while receiving
+ digitalWrite(mCsPin, HIGH);
+ delay(TLE94112_CS_RISETIME);
+
+ received = (received & mask) >> shift;
+
+ return received;
+}
+
+void Tle94112::clearStatusReg(uint8_t reg)
+{
+ uint8_t address = mStatusRegAddresses[reg];
+
+ address = address | TLE94112_CMD_CLEAR;
+ digitalWrite(mCsPin, LOW);
+ uint8_t byte0 = mBus->transfer(address);
+ uint8_t byte1 = mBus->transfer(0); //clear register by writing 0x00
+ digitalWrite(mCsPin, HIGH);
+ delay(TLE94112_CS_RISETIME);
+}
+
diff --git a/src/TLE94112.h b/src/TLE94112.h
index 0f41fda4..81fd0697 100644
--- a/src/TLE94112.h
+++ b/src/TLE94112.h
@@ -1,364 +1,393 @@
-/*
- * Arduino library to control Infineon's DC Motor Control Shield with Tle94112
- *
- * The shield contains twelve independent halfbridges,
- * so it can drive up to 6 indipendent (+5 cascaded) bidirectional DC motor(s).
- * Each halfbridge provides a high-Voltage (nominal 5.5-18 V) tristate output,
- * which is also capable of PWM with 3 different frequencies.
- *
- * Have a look at the datasheet for more information.
- */
-
-/*! \file Tle94112.h
- * \brief This file has to be included in projects that use Infineon's DC Motor Control Shield with TLE94112
- */
-
-#ifndef TLE94112_H
-#define TLE94112_H
-
-#include "Arduino.h"
-#include "SPI.h"
-#include "./util/tle94112_conf.h"
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-/*! \brief the number of halfbridges on a TLE94112
- *
- * \see mHalfBridges
- * \see HalfBridge
- */
-#define TLE94112_NUM_HB 13
-
-/*! \brief the number of pwm modes for a halfbridge (including no pwm)
- *
- * \see mPwmChannels
- * \see PWMChannel
- */
-#define TLE94112_NUM_PWM 4
-
-/*! \brief the number of control registers in a TLE94112
- *
- * \see CtrlRegisters
- * \see mCtrlRegAddresses
- * \see mCtrlRegData
- */
-#define TLE94112_NUM_CTRL_REGS 12
-
-/*! \brief the number of status registers in a TLE94112
- *
- * \see StatusRegisters
- * \see mStatusRegAddresses
- * \see mStatusRegData
- */
-#define TLE94112_NUM_STATUS_REGS 7
-
-/*! \brief Standard pin for chip select on first shield
- */
-#define TLE94112_PIN_CS1 10
-
-/*! \brief Standard pin for chip select on second shield
- */
-#define TLE94112_PIN_CS2 9
-
-/*! \brief Standard enable pin
- */
-#define TLE94112_PIN_EN 8
-
-
-//! \brief Class that represents a TLE94112
-class Tle94112
-{
- public:
- //! \brief enum for the halfbridges on a TLE94112
- enum HalfBridge
- {
- TLE_NOHB = 0, TLE_HB1, TLE_HB2, TLE_HB3, TLE_HB4, TLE_HB5, TLE_HB6,
- TLE_HB7, TLE_HB8, TLE_HB9, TLE_HB10, TLE_HB11, TLE_HB12
- };
-
- //! \brief enum for the PWM channels of a halfbridge on TLE94112
- enum PWMChannel
- {
- TLE_NOPWM = 0, TLE_PWM1, TLE_PWM2, TLE_PWM3
- };
-
- //! \brief enum for the output states of a halfbridge
- enum HBState
- {
- TLE_FLOATING = 0b00, TLE_LOW = 0b01, TLE_HIGH = 0b10
- };
-
- //! \brief enum for the frequencies of a PWM channel
- enum PWMFreq
- {
- TLE_FREQOFF = 0b00, TLE_FREQ80HZ, TLE_FREQ100HZ, TLE_FREQ200HZ
- };
-
- //! \brief enum for the flags in the register SYS_DIAG1
- enum DiagFlag
- {
- TLE_SPI_ERROR = 0x80,
- TLE_LOAD_ERROR = 0x40,
- TLE_UNDER_VOLTAGE = 0x20,
- TLE_OVER_VOLTAGE = 0x10,
- TLE_POWER_ON_RESET = 0x08,
- TLE_TEMP_SHUTDOWN = 0x04,
- TLE_TEMP_WARNING = 0x02
- };
- //! \brief Reference value of Status Register
- static const uint8_t TLE_STATUS_OK = 0U;
-
- //! \brief standard constructor with default pin assignment
- Tle94112();
-
- //! \brief enables and initializes the TLE94112
- void begin(void);
-
- /*! \brief constructor with individual pin assignment
- *
- * \param bus a SPIClass object
- * \param cs pin number of the CS pin
- * \param en pin number of the ENABLE pin
- */
- void begin(SPIClass &bus, uint8_t cs, uint8_t en);
-
- //! \brief deactivates all outputs and disables the TLE94112
- void end(void);
-
- /*! \brief sets the output state and the PWM channel for a halfbridge (only for passive freewheeling)
- *
- * \param hb halfbridge which will be configured
- * \param state sets the output voltage to high, low or floating
- * \param pwm selects a PWM channel for PWM output
- *
- * \see HalfBridge
- * \see HBState
- * \see PWMChannel
- */
- void configHB(HalfBridge hb, HBState state, PWMChannel pwm);
-
- /*! \brief sets the output state and the PWM channel for a halfbridge (allows active freewheeling)
- *
- * \param hb halfbridge which will be configured
- * \param state sets the output voltage to high, low or floating
- * \param pwm selects a PWM channel for PWM output
- * \param activeFW 1 for active freewheeling
- * 0 for passive freewheeling (default)
- *
- * \see HalfBridge
- * \see HBState
- * \see PWMChannel
- */
- void configHB(HalfBridge hb, HBState state, PWMChannel pwm, uint8_t activeFW);
-
- /*! \brief sets the frequency and duty cycle for a PWM channel
- *
- * \param pwm PWM channel which will be configured
- * \param freq selects the PWM output frequency
- * \param dutyCycle a value from 0 to 255 which sets the dutyCycle
- *
- * \see PWMChannel
- * \see PWMFreq
- */
- void configPWM(PWMChannel pwm, PWMFreq freq, uint8_t dutyCycle);
-
- /*! \brief returns a diagnosis value for error detection
- *
- * \return 0 if everything is ok
- * non-zero value if errors occurred
- */
- uint8_t getSysDiagnosis();
-
- /*! \brief shows if errors of a specific type have occurred
- *
- * \param mask mask to filter for a specific flag
- *
- * \return 0 if everything is ok
- * non-zero value on error condition
- *
- * \see DiagFlag
- */
- uint8_t getSysDiagnosis(DiagFlag mask);
-
- /*! \brief shows if errors of a specific type have occurred
- *
- * \param mask mask to filter for one or more specific flags
- * this can be a disjunction of DiagFlag values
- *
- * \return 0 if everything is ok
- * non-zero value on error condition
- *
- * \see DiagFlag
- */
- uint8_t getSysDiagnosis(uint8_t mask);
-
- /*! \brief gets the overcurrent error flag bit for a specific halfbridge
- *
- * \param halfbridge halfbridge thats overcurrent flag will be returned
- *
- * \return 1 if there HalfBridge was shut down because of an overcurrent
- * 0 otherwise
- */
- uint8_t getHBOverCurrent(HalfBridge hb);
-
- /*! \brief gets the openload error flag bit for a specific halfbridge
- *
- * \param halfbridge halfbridge thats openload flag will be returned
- *
- * \return 1 if there HalfBridge detected an open load
- * 0 otherwise
- */
- uint8_t getHBOpenLoad(HalfBridge hb);
-
- //! \brief clears all clearable error flags
- void clearErrors();
-
- private:
- //! \brief enum for the control registers in a TLE94112
- enum CtrlRegisters
- {
- HB_ACT_1_CTRL = 0,
- HB_ACT_2_CTRL,
- HB_ACT_3_CTRL,
- HB_MODE_1_CTRL,
- HB_MODE_2_CTRL,
- HB_MODE_3_CTRL,
- PWM_CH_FREQ_CTRL,
- PWM1_DC_CTRL,
- PWM2_DC_CTRL,
- PWM3_DC_CTRL,
- FW_OL_CTRL,
- FW_CTRL
- };
-
- //! \brief enum for the control registers in a TLE94112
- enum StatusRegisters
- {
- SYS_DIAG1 = 0,
- OP_ERROR_1_STAT,
- OP_ERROR_2_STAT,
- OP_ERROR_3_STAT,
- OP_ERROR_4_STAT,
- OP_ERROR_5_STAT,
- OP_ERROR_6_STAT
- };
-
- //! \brief indicates if TLE94112LE is enabled
- uint8_t mEnabled;
- //! \brief pointer to the SPIClass object representing the bus
- SPIClass *mBus;
- //! \brief pin number of the CS pin
- uint8_t mCsPin;
- //! \brief pin number on the EN pin
- uint8_t mEnPin;
- //! \brief array of register locations for halfbridges
- HalfBridge_t mHalfBridges[TLE94112_NUM_HB];
- //! \brief array of register locations for PWM channels
- PWMchannel_t mPwmChannels[TLE94112_NUM_PWM];
- //! \brief mapping array for control register addresses
- uint8_t mCtrlRegAddresses[TLE94112_NUM_CTRL_REGS];
- //! \brief mirror array for control register data
- uint8_t mCtrlRegData[TLE94112_NUM_CTRL_REGS];
- //! \brief mapping array for status register addresses
- uint8_t mStatusRegAddresses[TLE94112_NUM_STATUS_REGS];
-
- //! \brief initializes this object, automatically called by begin()
- void init(void);
-
- /*! \brief sets the output state and the PWM channel for a halfbridge
- * automatically called by the public version of configHB
- *
- * \param hb halfbridge which will be configured
- * \param state sets the output voltage to high, low or floating
- * \param pwm selects a PWM channel for PWM output
- * \param activeFW 1 for active freewheeling
- * 0 for passive freewheeling (default)
- */
- void configHB(uint8_t hb, uint8_t state, uint8_t pwm, uint8_t activeFW);
-
- /*! \brief sets the frequency and duty cycle for a PWM channel
- automatically called by the public version of configPWM
- *
- * \param pwm PWM channel which will be configured
- * \param freq selects the PWM output frequency
- * \param dutyCycle a value from 0 to 255 which sets the dutyCycle
- */
- void configPWM(uint8_t pwm, uint8_t freq, uint8_t dutyCycle);
-
- /*! \brief gets the overcurrent error flag bit for a specific halfbridge
- * automatically called by the public version of getHBOverCurrent
- *
- * \param halfbridge halfbridge thats overcurrent flag will be returned
- *
- * \return 1 if there HalfBridge was shut down because of an overcurrent
- * 0 otherwise
- */
- uint8_t getHBOverCurrent(uint8_t hb);
-
- /*! \brief gets the openload error flag bit for a specific halfbridge
- * automatically called by the public version of getHBOpenLoad
- *
- * \param halfbridge halfbridge thats openload flag will be returned
- *
- * \return 1 if there HalfBridge detected an open load
- * 0 otherwise
- */
- uint8_t getHBOpenLoad(uint8_t hb);
-
- /*! \brief writes data bits to a control register of the TLE94112
- *
- * \param reg control register number(mapping array index / CtrlRegisters constant) of the register
- * \param mask mask for the bits that have to be written
- * \param shift data will be shifted left by this amount before masking. This is for the bit alignment of data
- * \param data the data byte that has to be written. It will be shifted and masked before
- *
- * \see CtrlRegisters
- * \see TLE94112_NUM_CTRL_REGS
- * \see mCtrlRegAddresses
- * \see mCtrlRegData
- */
- void writeReg(uint8_t reg, uint8_t mask, uint8_t shift, uint8_t data);
-
- /*! \brief reads one byte from a status register of the TLE94112
- *
- * \param reg status register number(mapping array index / StatusRegisters constant) of the register
- *
- * \return data byte that has been read
- *
- * \see StatusRegisters
- * \see TLE94112_NUM_STATUS_REGS
- * \see mStatusRegAddresses
- */
- uint8_t readStatusReg(uint8_t reg);
-
- /*! \brief reads some bits from a status register of the TLE94112
- *
- * \param reg status register number(mapping array index / StatusRegisters constant) of the register
- * \param mask mask for the bits that have to be read
- * \param shift data will be shifted right by this amount after masking. This is for the bit alignment of data
- *
- * \return data bits that have been read (after masking and shifting)
- *
- * \see StatusRegisters
- * \see TLE94112_NUM_STATUS_REGS
- * \see mStatusRegAddresses
- */
- uint8_t readStatusReg(uint8_t reg, uint8_t mask, uint8_t shift);
-
- /*! \brief clears a status register by writing 0x00 to it
- *
- * \param reg status register number(mapping array index / StatusRegisters constant) of the register
- *
- * \see StatusRegisters
- * \see TLE94112_NUM_STATUS_REGS
- * \see mStatusRegAddresses
- */
- void clearStatusReg(uint8_t reg);
-};
-
-#endif
\ No newline at end of file
+/*!
+ * \file Tle94112.h
+ * \name Tle94112.h - Arduino library to control Infineon's DC Motor Control Shield with Tle94112
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief This file has to be included in projects that use Infineon's DC Motor Control Shield with TLE94112
+ * \details
+ * The Infineon TLE94112EL DC motor controller shield is able to handle 6 motors with a max. current of 0.9 A
+ * independently and additional 5 motors cascaded. The twelve half-bridges can be arranged also together,
+ * so that 3 motors with 1.8 A current or one motor with 3.6 A can be used. Each half bridge can
+ * provide a high-Voltage (nominal 5.5-18 V) tristate output and max. input voltage of 40V. It is also
+ * capable of PWM with 3 different frequencies for controlling the speed of each motor.
+ * Have a look at the datasheet for more information.
+ *
+ * This library include the basic functions to access the half-bridges.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TLE94112_H
+#define TLE94112_H
+
+#include "Arduino.h"
+#include "SPI.h"
+#include "./util/tle94112_conf.h"
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+/*! \brief the number of halfbridges on a TLE94112
+ *
+ * \see mHalfBridges
+ * \see HalfBridge
+ */
+#define TLE94112_NUM_HB 13
+
+/*! \brief the number of pwm modes for a halfbridge (including no pwm)
+ *
+ * \see mPwmChannels
+ * \see PWMChannel
+ */
+#define TLE94112_NUM_PWM 4
+
+/*! \brief the number of control registers in a TLE94112
+ *
+ * \see CtrlRegisters
+ * \see mCtrlRegAddresses
+ * \see mCtrlRegData
+ */
+#define TLE94112_NUM_CTRL_REGS 12
+
+/*! \brief the number of status registers in a TLE94112
+ *
+ * \see StatusRegisters
+ * \see mStatusRegAddresses
+ * \see mStatusRegData
+ */
+#define TLE94112_NUM_STATUS_REGS 7
+
+/*!
+ * Standard chip select pin for first TLE94112 shield
+ */
+#define TLE94112_PIN_CS1 10
+
+/*!
+ * Standard chip select pin for second TLE94112 shield
+ * To use a second shield with different CS pin you have
+ * to remove the 0 Ohm resistor R7 and solder it to R8
+ */
+#define TLE94112_PIN_CS2 9
+
+/*!
+ * Standard TLE94112 enable pin
+ */
+#define TLE94112_PIN_EN 8
+
+//! \brief Class that represents a TLE94112
+class Tle94112
+{
+ public:
+ //! \brief enum for the halfbridges on a TLE94112
+ enum HalfBridge
+ {
+ TLE_NOHB = 0, TLE_HB1, TLE_HB2, TLE_HB3, TLE_HB4, TLE_HB5, TLE_HB6,
+ TLE_HB7, TLE_HB8, TLE_HB9, TLE_HB10, TLE_HB11, TLE_HB12
+ };
+
+ //! \brief enum for the PWM channels of a halfbridge on TLE94112
+ enum PWMChannel
+ {
+ TLE_NOPWM = 0, TLE_PWM1, TLE_PWM2, TLE_PWM3
+ };
+
+ //! \brief enum for the output states of a halfbridge
+ enum HBState
+ {
+ TLE_FLOATING = 0b00, TLE_LOW = 0b01, TLE_HIGH = 0b10
+ };
+
+ //! \brief enum for the frequencies of a PWM channel
+ enum PWMFreq
+ {
+ TLE_FREQOFF = 0b00, TLE_FREQ80HZ, TLE_FREQ100HZ, TLE_FREQ200HZ
+ };
+
+ //! \brief enum for the flags in the register SYS_DIAG1
+ enum DiagFlag
+ {
+ TLE_SPI_ERROR = 0x80,
+ TLE_LOAD_ERROR = 0x40,
+ TLE_UNDER_VOLTAGE = 0x20,
+ TLE_OVER_VOLTAGE = 0x10,
+ TLE_POWER_ON_RESET = 0x08,
+ TLE_TEMP_SHUTDOWN = 0x04,
+ TLE_TEMP_WARNING = 0x02
+ };
+ //! \brief Reference value of Status Register
+ static const uint8_t TLE_STATUS_OK = 0U;
+
+ //! \brief standard constructor with default pin assignment
+ Tle94112();
+
+ //! \brief enables and initializes the TLE94112
+ void begin(void);
+
+ /*! \brief constructor with individual pin assignment
+ *
+ * \param bus a SPIClass object
+ * \param cs pin number of the CS pin
+ * \param en pin number of the ENABLE pin
+ */
+ void begin(SPIClass &bus, uint8_t cs, uint8_t en);
+
+ //! \brief deactivates all outputs and disables the TLE94112
+ void end(void);
+
+ /*! \brief sets the output state and the PWM channel for a halfbridge (only for passive freewheeling)
+ *
+ * \param hb halfbridge which will be configured
+ * \param state sets the output voltage to high, low or floating
+ * \param pwm selects a PWM channel for PWM output
+ *
+ * \see HalfBridge
+ * \see HBState
+ * \see PWMChannel
+ */
+ void configHB(HalfBridge hb, HBState state, PWMChannel pwm);
+
+ /*! \brief sets the output state and the PWM channel for a halfbridge (allows active freewheeling)
+ *
+ * \param hb halfbridge which will be configured
+ * \param state sets the output voltage to high, low or floating
+ * \param pwm selects a PWM channel for PWM output
+ * \param activeFW 1 for active freewheeling
+ * 0 for passive freewheeling (default)
+ *
+ * \see HalfBridge
+ * \see HBState
+ * \see PWMChannel
+ */
+ void configHB(HalfBridge hb, HBState state, PWMChannel pwm, uint8_t activeFW);
+
+ /*! \brief sets the frequency and duty cycle for a PWM channel
+ *
+ * \param pwm PWM channel which will be configured
+ * \param freq selects the PWM output frequency
+ * \param dutyCycle a value from 0 to 255 which sets the dutyCycle
+ *
+ * \see PWMChannel
+ * \see PWMFreq
+ */
+ void configPWM(PWMChannel pwm, PWMFreq freq, uint8_t dutyCycle);
+
+ /*! \brief returns a diagnosis value for error detection
+ *
+ * \return 0 if everything is ok
+ * non-zero value if errors occurred
+ */
+ uint8_t getSysDiagnosis();
+
+ /*! \brief shows if errors of a specific type have occurred
+ *
+ * \param mask mask to filter for a specific flag
+ *
+ * \return 0 if everything is ok
+ * non-zero value on error condition
+ *
+ * \see DiagFlag
+ */
+ uint8_t getSysDiagnosis(DiagFlag mask);
+
+ /*! \brief shows if errors of a specific type have occurred
+ *
+ * \param mask mask to filter for one or more specific flags
+ * this can be a disjunction of DiagFlag values
+ *
+ * \return 0 if everything is ok
+ * non-zero value on error condition
+ *
+ * \see DiagFlag
+ */
+ uint8_t getSysDiagnosis(uint8_t mask);
+
+ /*! \brief gets the overcurrent error flag bit for a specific halfbridge
+ *
+ * \param halfbridge halfbridge thats overcurrent flag will be returned
+ *
+ * \return 1 if there HalfBridge was shut down because of an overcurrent
+ * 0 otherwise
+ */
+ uint8_t getHBOverCurrent(HalfBridge hb);
+
+ /*! \brief gets the openload error flag bit for a specific halfbridge
+ *
+ * \param halfbridge halfbridge thats openload flag will be returned
+ *
+ * \return 1 if there HalfBridge detected an open load
+ * 0 otherwise
+ */
+ uint8_t getHBOpenLoad(HalfBridge hb);
+
+ //! \brief clears all clearable error flags
+ void clearErrors();
+
+ private:
+ //! \brief enum for the control registers in a TLE94112
+ enum CtrlRegisters
+ {
+ HB_ACT_1_CTRL = 0,
+ HB_ACT_2_CTRL,
+ HB_ACT_3_CTRL,
+ HB_MODE_1_CTRL,
+ HB_MODE_2_CTRL,
+ HB_MODE_3_CTRL,
+ PWM_CH_FREQ_CTRL,
+ PWM1_DC_CTRL,
+ PWM2_DC_CTRL,
+ PWM3_DC_CTRL,
+ FW_OL_CTRL,
+ FW_CTRL
+ };
+
+ //! \brief enum for the control registers in a TLE94112
+ enum StatusRegisters
+ {
+ SYS_DIAG1 = 0,
+ OP_ERROR_1_STAT,
+ OP_ERROR_2_STAT,
+ OP_ERROR_3_STAT,
+ OP_ERROR_4_STAT,
+ OP_ERROR_5_STAT,
+ OP_ERROR_6_STAT
+ };
+
+ //! \brief indicates if TLE94112LE is enabled
+ uint8_t mEnabled;
+ //! \brief pointer to the SPIClass object representing the bus
+ SPIClass *mBus;
+ //! \brief pin number of the CS pin
+ uint8_t mCsPin;
+ //! \brief pin number on the EN pin
+ uint8_t mEnPin;
+ //! \brief array of register locations for halfbridges
+ HalfBridge_t mHalfBridges[TLE94112_NUM_HB];
+ //! \brief array of register locations for PWM channels
+ PWMchannel_t mPwmChannels[TLE94112_NUM_PWM];
+ //! \brief mapping array for control register addresses
+ uint8_t mCtrlRegAddresses[TLE94112_NUM_CTRL_REGS];
+ //! \brief mirror array for control register data
+ uint8_t mCtrlRegData[TLE94112_NUM_CTRL_REGS];
+ //! \brief mapping array for status register addresses
+ uint8_t mStatusRegAddresses[TLE94112_NUM_STATUS_REGS];
+
+ //! \brief initializes this object, automatically called by begin()
+ void init(void);
+
+ /*! \brief sets the output state and the PWM channel for a halfbridge
+ * automatically called by the public version of configHB
+ *
+ * \param hb halfbridge which will be configured
+ * \param state sets the output voltage to high, low or floating
+ * \param pwm selects a PWM channel for PWM output
+ * \param activeFW 1 for active freewheeling
+ * 0 for passive freewheeling (default)
+ */
+ void configHB(uint8_t hb, uint8_t state, uint8_t pwm, uint8_t activeFW);
+
+ /*! \brief sets the frequency and duty cycle for a PWM channel
+ automatically called by the public version of configPWM
+ *
+ * \param pwm PWM channel which will be configured
+ * \param freq selects the PWM output frequency
+ * \param dutyCycle a value from 0 to 255 which sets the dutyCycle
+ */
+ void configPWM(uint8_t pwm, uint8_t freq, uint8_t dutyCycle);
+
+ /*! \brief gets the overcurrent error flag bit for a specific halfbridge
+ * automatically called by the public version of getHBOverCurrent
+ *
+ * \param halfbridge halfbridge thats overcurrent flag will be returned
+ *
+ * \return 1 if there HalfBridge was shut down because of an overcurrent
+ * 0 otherwise
+ */
+ uint8_t getHBOverCurrent(uint8_t hb);
+
+ /*! \brief gets the openload error flag bit for a specific halfbridge
+ * automatically called by the public version of getHBOpenLoad
+ *
+ * \param halfbridge halfbridge thats openload flag will be returned
+ *
+ * \return 1 if there HalfBridge detected an open load
+ * 0 otherwise
+ */
+ uint8_t getHBOpenLoad(uint8_t hb);
+
+ /*! \brief writes data bits to a control register of the TLE94112
+ *
+ * \param reg control register number(mapping array index / CtrlRegisters constant) of the register
+ * \param mask mask for the bits that have to be written
+ * \param shift data will be shifted left by this amount before masking. This is for the bit alignment of data
+ * \param data the data byte that has to be written. It will be shifted and masked before
+ *
+ * \see CtrlRegisters
+ * \see TLE94112_NUM_CTRL_REGS
+ * \see mCtrlRegAddresses
+ * \see mCtrlRegData
+ */
+ void writeReg(uint8_t reg, uint8_t mask, uint8_t shift, uint8_t data);
+
+ /*! \brief reads one byte from a status register of the TLE94112
+ *
+ * \param reg status register number(mapping array index / StatusRegisters constant) of the register
+ *
+ * \return data byte that has been read
+ *
+ * \see StatusRegisters
+ * \see TLE94112_NUM_STATUS_REGS
+ * \see mStatusRegAddresses
+ */
+ uint8_t readStatusReg(uint8_t reg);
+
+ /*! \brief reads some bits from a status register of the TLE94112
+ *
+ * \param reg status register number(mapping array index / StatusRegisters constant) of the register
+ * \param mask mask for the bits that have to be read
+ * \param shift data will be shifted right by this amount after masking. This is for the bit alignment of data
+ *
+ * \return data bits that have been read (after masking and shifting)
+ *
+ * \see StatusRegisters
+ * \see TLE94112_NUM_STATUS_REGS
+ * \see mStatusRegAddresses
+ */
+ uint8_t readStatusReg(uint8_t reg, uint8_t mask, uint8_t shift);
+
+ /*! \brief clears a status register by writing 0x00 to it
+ *
+ * \param reg status register number(mapping array index / StatusRegisters constant) of the register
+ *
+ * \see StatusRegisters
+ * \see TLE94112_NUM_STATUS_REGS
+ * \see mStatusRegAddresses
+ */
+ void clearStatusReg(uint8_t reg);
+};
+
+#endif
diff --git a/src/Tle94112Motor.cpp b/src/Tle94112Motor.cpp
index 2a62c9dd..ceff2671 100644
--- a/src/Tle94112Motor.cpp
+++ b/src/Tle94112Motor.cpp
@@ -1,3 +1,43 @@
+/*!
+ * \file Tle94112Motor.cpp
+ * \name Tle94112Motor.cpp - optionally include library
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief This file can optionally be included in projects that use Infineon's
+ * DC Motor Control Shield with TLE94112
+ * It provides a higher abstraction for controlling motors with the TLE94112
+ * acting as an output driver
+ * \details
+ * The Infineon TLE94112EL DC motor controller shield is able to handle 6 motors with a max. current of 0.9 A
+ * independently and additional 5 motors cascaded. The twelve half-bridges can be arranged also together,
+ * so that 3 motors with 1.8 A current or one motor with 3.6 A can be used. Each half bridge can
+ * provide a high-Voltage (nominal 5.5-18 V) tristate output and max. input voltage of 40V. It is also
+ * capable of PWM with 3 different frequencies for controlling the speed of each motor.
+ * Have a look at the datasheet for more information.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
#include "Tle94112Motor.h"
#define TLE94112_MAX_SPEED 255
@@ -64,8 +104,7 @@ void Tle94112Motor::initConnector(Tle94112Motor::ePolarity pol,
}
}
-void Tle94112Motor::connect(Tle94112Motor::ePolarity pol,
- Tle94112::HalfBridge connector)
+void Tle94112Motor::connect(Tle94112Motor::ePolarity pol, Tle94112::HalfBridge connector)
{
if(mEnabled == FALSE)
{
@@ -97,8 +136,7 @@ void Tle94112Motor::disconnect(Tle94112::HalfBridge connector)
}
}
-void Tle94112Motor::setPwm(Tle94112Motor::ePolarity pol,
- Tle94112::PWMChannel channel)
+void Tle94112Motor::setPwm(Tle94112Motor::ePolarity pol, Tle94112::PWMChannel channel)
{
if(mEnabled == FALSE)
{
@@ -116,8 +154,7 @@ void Tle94112Motor::setPwm(Tle94112Motor::ePolarity pol,
}
}
-void Tle94112Motor::setPwmFreq(Tle94112Motor::ePolarity pol,
- Tle94112::PWMFreq freq)
+void Tle94112Motor::setPwmFreq(Tle94112Motor::ePolarity pol, Tle94112::PWMFreq freq)
{
if(mEnabled == FALSE)
{
@@ -125,8 +162,7 @@ void Tle94112Motor::setPwmFreq(Tle94112Motor::ePolarity pol,
}
}
-void Tle94112Motor::setActiveFreeWheeling(Tle94112Motor::ePolarity pol,
- uint8_t active_fw)
+void Tle94112Motor::setActiveFreeWheeling(Tle94112Motor::ePolarity pol, uint8_t active_fw)
{
if(mEnabled == FALSE)
{
@@ -144,9 +180,9 @@ void Tle94112Motor::coast()
{
for(uint8_t idx = 0u; idx < TLE94112MOTOR_MAX_CONNECTORS; idx++)
{
- mDriver->configHB(mConnectors[pol].halfbridges[idx],
- Tle94112::TLE_FLOATING,
- mConnectors[pol].channel,
+ mDriver->configHB(mConnectors[pol].halfbridges[idx],
+ Tle94112::TLE_FLOATING,
+ mConnectors[pol].channel,
mConnectors[pol].active_fw);
}
}
@@ -165,9 +201,9 @@ void Tle94112Motor::stop(uint8_t force)
mSpeed = force;
// set dutycycle depending on parameter force
// higher force lets the motor stop quicker
- mDriver->configPWM(mConnectors[HIGHSIDE].channel,
+ mDriver->configPWM(mConnectors[HIGHSIDE].channel,
mConnectors[HIGHSIDE].freq, force);
- mDriver->configPWM(mConnectors[LOWSIDE].channel,
+ mDriver->configPWM(mConnectors[LOWSIDE].channel,
mConnectors[LOWSIDE].freq, force);
//connect highside pins to low
for(uint8_t idx = 0u; idx < TLE94112MOTOR_MAX_CONNECTORS; idx++)
@@ -175,21 +211,21 @@ void Tle94112Motor::stop(uint8_t force)
Tle94112::HalfBridge hb = mConnectors[HIGHSIDE].halfbridges[idx];
if(hb != Tle94112::TLE_NOHB) {
numHighside++;
- mDriver->configHB(hb,
- Tle94112::TLE_LOW,
- mConnectors[HIGHSIDE].channel,
+ mDriver->configHB(hb,
+ Tle94112::TLE_LOW,
+ mConnectors[HIGHSIDE].channel,
mConnectors[HIGHSIDE].active_fw);
}
}
if(numHighside == 0u)
{
- // highside is constantly connected to high.
+ // highside is constantly connected to high.
// also connect lowside to high to stop motor
for(uint8_t idx = 0u; idx < TLE94112MOTOR_MAX_CONNECTORS; idx++)
{
- mDriver->configHB(mConnectors[LOWSIDE].halfbridges[idx],
- Tle94112::TLE_HIGH,
- mConnectors[LOWSIDE].channel,
+ mDriver->configHB(mConnectors[LOWSIDE].halfbridges[idx],
+ Tle94112::TLE_HIGH,
+ mConnectors[LOWSIDE].channel,
mConnectors[LOWSIDE].active_fw);
}
}
@@ -198,9 +234,9 @@ void Tle94112Motor::stop(uint8_t force)
// connect all motor pins to low
for(uint8_t idx = 0u; idx < TLE94112MOTOR_MAX_CONNECTORS; idx++)
{
- mDriver->configHB(mConnectors[LOWSIDE].halfbridges[idx],
- Tle94112::TLE_LOW,
- mConnectors[LOWSIDE].channel,
+ mDriver->configHB(mConnectors[LOWSIDE].halfbridges[idx],
+ Tle94112::TLE_LOW,
+ mConnectors[LOWSIDE].channel,
mConnectors[LOWSIDE].active_fw);
}
}
@@ -236,24 +272,24 @@ void Tle94112Motor::setSpeed(int16_t speed)
mSpeed = static_cast(speed);
for(uint8_t idx = 0u; idx < TLE94112MOTOR_MAX_CONNECTORS; idx++)
{
- mDriver->configHB(mConnectors[HIGHSIDE].halfbridges[idx],
- Tle94112::TLE_HIGH,
- mConnectors[HIGHSIDE].channel,
- mConnectors[HIGHSIDE].active_fw);
- mDriver->configHB(mConnectors[LOWSIDE].halfbridges[idx],
- Tle94112::TLE_LOW,
- mConnectors[LOWSIDE].channel,
- mConnectors[LOWSIDE].active_fw);
+ mDriver->configHB(
+ mConnectors[HIGHSIDE].halfbridges[idx],
+ Tle94112::TLE_HIGH,
+ mConnectors[HIGHSIDE].channel,
+ mConnectors[HIGHSIDE].active_fw);
+ mDriver->configHB(
+ mConnectors[LOWSIDE].halfbridges[idx],
+ Tle94112::TLE_LOW,
+ mConnectors[LOWSIDE].channel,
+ mConnectors[LOWSIDE].active_fw);
}
}
}
else // speed < 0
{
mSpeed = static_cast(-speed);
- mDriver->configPWM(mConnectors[HIGHSIDE].channel,
- mConnectors[HIGHSIDE].freq, mSpeed);
- mDriver->configPWM(mConnectors[LOWSIDE].channel,
- mConnectors[LOWSIDE].freq, mSpeed);
+ mDriver->configPWM(mConnectors[HIGHSIDE].channel, mConnectors[HIGHSIDE].freq, mSpeed);
+ mDriver->configPWM(mConnectors[LOWSIDE].channel, mConnectors[LOWSIDE].freq, mSpeed);
if(mMode != BACKWARD)
{
//change configuration to running backward
@@ -292,10 +328,10 @@ int16_t Tle94112Motor::getSpeed(void)
}
-uint32_t Tle94112Motor::measureSetSpeedDuration(int16_t speed,
- int16_t start_speed)
+uint32_t Tle94112Motor::measureSetSpeedDuration(int16_t speed, int16_t start_speed)
{
- if(start_speed == 0) {
+ if(start_speed == 0)
+ {
// changing direction is additional effort
// don't let this have an effect on the setSpeed duration measurement
start_speed = SIGNUM(speed);
@@ -310,14 +346,16 @@ uint32_t Tle94112Motor::measureSetSpeedDuration(int16_t speed,
void Tle94112Motor::performSpeedStepping(int16_t start_speed,
int16_t ramp_delta_speed, int16_t num_steps, uint16_t steptime)
{
- if(num_steps > 0) {
+ uint32_t Timer = millis(); //!> none blocking delay
+ if(num_steps > 0)
+ {
// normal ramp loop
for(uint16_t i=1u; i<=num_steps; i++)
{
setSpeed(start_speed + ( (i*ramp_delta_speed) / num_steps ) );
- if( steptime > 0u )
+ if (steptime > 0u)
{
- delay(steptime);
+ while((millis() - Timer) < steptime ){}
}
}
}
@@ -328,26 +366,26 @@ void Tle94112Motor::performSpeedStepping(int16_t start_speed,
}
}
-
void Tle94112Motor::rampSpeed(int16_t speed, uint16_t slope)
{
int16_t start_speed = getSpeed();
- if(mEnabled == TRUE && speed != start_speed)
+ if (mEnabled == TRUE && speed != start_speed)
{
uint32_t duration = measureSetSpeedDuration(speed, start_speed);
+ //mDriver->clearErrors();
// calc full ramp deltas
int16_t ramp_delta_speed = speed - start_speed;
- uint16_t ramp_delta_time
- = (slope * abs(ramp_delta_speed)) / TLE94112_MAX_SPEED;
+ uint16_t ramp_delta_time = (slope * abs(ramp_delta_speed)) / TLE94112_MAX_SPEED;
// calc step deltas
int16_t num_steps = ramp_delta_time / duration - 1;
uint16_t steptime = 0;
// correction of step deltas for very flat ramps
- if(abs(ramp_delta_speed) < num_steps)
+ if (abs(ramp_delta_speed) < num_steps)
{
num_steps = abs(ramp_delta_speed);
steptime = ramp_delta_time / abs(ramp_delta_speed) - duration;
}
- performSpeedStepping(start_speed, ramp_delta_speed, num_steps, steptime);
+ performSpeedStepping(start_speed, ramp_delta_speed, num_steps,steptime);
+ //mDriver->clearErrors();
}
}
diff --git a/src/Tle94112Motor.h b/src/Tle94112Motor.h
index ef905240..633b6ea1 100644
--- a/src/Tle94112Motor.h
+++ b/src/Tle94112Motor.h
@@ -1,10 +1,41 @@
-/**
- * @file Tle94112Motor.h
- * @brief This file can optionally be included in projects that use Infineon's
- * DC Motor Control Shield with TLE94112
+/*!
+ * \file Tle94112Motor.h
+ * \name Tle94112Motor.h - optionally include library
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief This file can optionally be included in projects that use Infineon's
+ * DC Motor Control Shield with TLE94112
+ * It provides a higher abstraction for controlling motors with the TLE94112
+ * acting as an output driver
+ * \details
+ * The Infineon TLE94112EL DC motor controller shield is able to handle 6 motors with a max. current of 0.9 A
+ * independently and additional 5 motors cascaded. The twelve half-bridges can be arranged also together,
+ * so that 3 motors with 1.8 A current or one motor with 3.6 A can be used. Each half bridge can
+ * provide a high-Voltage (nominal 5.5-18 V) tristate output and max. input voltage of 40V. It is also
+ * capable of PWM with 3 different frequencies for controlling the speed of each motor.
+ * Have a look at the datasheet for more information.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * It provides a higher abstraction for controlling motors with the TLE94112
- * acting as an output driver
*/
#ifndef TLE94112MOTOR_H
@@ -94,7 +125,7 @@ class Tle94112Motor
* @brief configures most important settings for one motor connector
*
* Call this function twice to setup motor configuration for both the
- * + and - connector of the motor. If there is no setup for one poarity,
+ * + and - connector of the motor. If there is no setup for one polarity,
* the library assumes that the motor is constantly connected to + or -.
*
* @param pol Polarity of the motor connector to be configured
@@ -115,7 +146,7 @@ class Tle94112Motor
* @brief configures most important settings for one motor connector
*
* Call this function twice to setup motor configuration for both the
- * + and - connector of the motor. If there is no setup for one poarity,
+ * + and - connector of the motor. If there is no setup for one polarity,
* the library assumes that the motor is constantly connected to + or -.
*
* @param pol Polarity of the motor connector to be configured
@@ -211,8 +242,7 @@ class Tle94112Motor
* coast, run and break. Speed values greater or smaller than 0 are treated
* like -255 or 255, respectively.
*
- * @param speed An integer in a range from -255 to 255 to set motor speed
- * and direction
+ * @param speed An integer in a range from -255 to 255 to set motor speed and direction
*/
void start(int16_t speed);
@@ -230,8 +260,7 @@ class Tle94112Motor
* coast, run and break. Speed values greater or smaller than 0 are treated
* like -255 or 255, respectively.
*
- * @param speed An integer in a range from -255 to 255 to set motor speed
- * and direction
+ * @param speed An integer in a range from -255 to 255 to set motor speed and direction
* @see start
*/
void setSpeed(int16_t speed);
@@ -264,7 +293,8 @@ class Tle94112Motor
};
//! @brief struct representing one motor connector
- typedef struct {
+ typedef struct
+ {
Tle94112::HalfBridge halfbridges[TLE94112MOTOR_MAX_CONNECTORS];
Tle94112::PWMChannel channel;
Tle94112::PWMFreq freq;
@@ -272,7 +302,8 @@ class Tle94112Motor
} Connector_t, *Connector_p;
//! @brief array of motor connectors
- Connector_t mConnectors[2] = {
+ Connector_t mConnectors[2] =
+ {
{
.halfbridges = {Tle94112::TLE_NOHB,
Tle94112::TLE_NOHB,
@@ -305,10 +336,27 @@ class Tle94112Motor
//! @brief value of the current motor speed
uint8_t mSpeed;
- //! @brief private function needed by rampSpeed
+ //!
+
+ /*
+ * @brief private function needed by rampSpeed
+ *
+ * @param speed An integer in a range from -255 to 255 to set motor speed
+ * and direction. Here the target speed.
+ * @param start_speed An integer a range from -255 to 255 to set motor speed
+ * and direction. Here the source speed
+ */
uint32_t measureSetSpeedDuration(int16_t speed, int16_t start_speed);
- //! @brief private function needed by rampSpeed
+ /* @brief private function needed by rampSpeed
+ *
+ * @param start_speed An integer a range from -255 to 255 to set motor speed
+ * and direction. Here the source speed
+ * @param ramp_delta_speed a slope value how fast the speed change
+ * should raise or fall
+ * @param num_steps The number of steps to raise or fall the speed
+ * @param steptime The time to be needed for each step
+ */
void performSpeedStepping(int16_t start_speed, int16_t ramp_delta_speed,
int16_t num_steps, uint16_t steptime);
};
diff --git a/src/util/tle94112_conf.cpp b/src/util/tle94112_conf.cpp
index da1d9b20..f68903ed 100644
--- a/src/util/tle94112_conf.cpp
+++ b/src/util/tle94112_conf.cpp
@@ -1,78 +1,97 @@
-/*
- * Arduino library to control Infineon's DC Motor Control Shield with TLE94112
- *
- * The shield contains twelve independent halfbridges,
- * so it can drive up to 6 indipendent (+5 cascaded) bidirectional DC motor(s).
- * Each halfbridge provides a high-Voltage (nominal 5.5-18 V) tristate output,
- * which is also capable of PWM with 3 different frequencies.
- *
- * Have a look at the datasheet for more information.
- */
-
-/*! \file TLE94112_conf.cpp
- * \brief This file contains the initialization of a TLE94112 with all its magic numbers
- */
-
-#include "tle94112_conf.h"
-#include "TLE94112.h"
-
-
-void Tle94112::init(void)
-{
- //initial control register configuration
- mCtrlRegAddresses[static_cast(Tle94112::HB_ACT_1_CTRL)] = 0x03;
- mCtrlRegData[HB_ACT_1_CTRL] = 0;
- mCtrlRegAddresses[HB_ACT_2_CTRL] = 0x43;
- mCtrlRegData[HB_ACT_2_CTRL] = 0;
- mCtrlRegAddresses[HB_ACT_3_CTRL] = 0x23;
- mCtrlRegData[HB_ACT_3_CTRL] = 0;
- mCtrlRegAddresses[HB_MODE_1_CTRL] = 0x63;
- mCtrlRegData[HB_MODE_1_CTRL] = 0;
- mCtrlRegAddresses[HB_MODE_2_CTRL] = 0x13;
- mCtrlRegData[HB_MODE_2_CTRL] = 0;
- mCtrlRegAddresses[HB_MODE_3_CTRL] = 0x53;
- mCtrlRegData[HB_MODE_3_CTRL] = 0;
- mCtrlRegAddresses[PWM_CH_FREQ_CTRL] = 0x33;
- mCtrlRegData[PWM_CH_FREQ_CTRL] = 0;
- mCtrlRegAddresses[PWM1_DC_CTRL] = 0x73;
- mCtrlRegData[PWM1_DC_CTRL] = 0;
- mCtrlRegAddresses[PWM2_DC_CTRL] = 0x0B;
- mCtrlRegData[PWM2_DC_CTRL] = 0;
- mCtrlRegAddresses[PWM3_DC_CTRL] = 0x4B;
- mCtrlRegData[PWM3_DC_CTRL] = 0;
- mCtrlRegAddresses[FW_OL_CTRL] = 0x2B;
- mCtrlRegData[FW_OL_CTRL] = 0;
- mCtrlRegAddresses[FW_CTRL] = 0x6B;
- mCtrlRegData[FW_CTRL] = 0;
-
- //status register configuration
- mStatusRegAddresses[SYS_DIAG1] = 0x1B;
- mStatusRegAddresses[OP_ERROR_1_STAT] = 0x5B;
- mStatusRegAddresses[OP_ERROR_2_STAT] = 0x3B;
- mStatusRegAddresses[OP_ERROR_3_STAT] = 0x7B;
- mStatusRegAddresses[OP_ERROR_4_STAT] = 0x07;
- mStatusRegAddresses[OP_ERROR_5_STAT] = 0x47;
- mStatusRegAddresses[OP_ERROR_6_STAT] = 0x27;
-
- //bit masking for all halfbridges
- mHalfBridges[TLE_NOHB] = { HB_ACT_1_CTRL, 0x00, 0, HB_MODE_1_CTRL, 0x00, 0, FW_OL_CTRL, 0x00, 0, OP_ERROR_1_STAT, 0x00, 0, OP_ERROR_4_STAT, 0x00, 0 };
- mHalfBridges[TLE_HB1] = { HB_ACT_1_CTRL, 0x03, 0, HB_MODE_1_CTRL, 0x03, 0, FW_OL_CTRL, 0x04, 2, OP_ERROR_1_STAT, 0x03, 0, OP_ERROR_4_STAT, 0x03, 0 };
- mHalfBridges[TLE_HB2] = { HB_ACT_1_CTRL, 0x0C, 2, HB_MODE_1_CTRL, 0x0C, 2, FW_OL_CTRL, 0x08, 3, OP_ERROR_1_STAT, 0x0C, 2, OP_ERROR_4_STAT, 0x0C, 2 };
- mHalfBridges[TLE_HB3] = { HB_ACT_1_CTRL, 0x30, 4, HB_MODE_1_CTRL, 0x30, 4, FW_OL_CTRL, 0x10, 4, OP_ERROR_1_STAT, 0x30, 4, OP_ERROR_4_STAT, 0x30, 4 };
- mHalfBridges[TLE_HB4] = { HB_ACT_1_CTRL, 0xC0, 6, HB_MODE_1_CTRL, 0xC0, 6, FW_OL_CTRL, 0x20, 5, OP_ERROR_1_STAT, 0xC0, 6, OP_ERROR_4_STAT, 0xC0, 6 };
- mHalfBridges[TLE_HB5] = { HB_ACT_2_CTRL, 0x03, 0, HB_MODE_2_CTRL, 0x03, 0, FW_OL_CTRL, 0x40, 6, OP_ERROR_2_STAT, 0x03, 0, OP_ERROR_5_STAT, 0x03, 0 };
- mHalfBridges[TLE_HB6] = { HB_ACT_2_CTRL, 0x0C, 2, HB_MODE_2_CTRL, 0x0C, 2, FW_OL_CTRL, 0x80, 7, OP_ERROR_2_STAT, 0x0C, 2, OP_ERROR_5_STAT, 0x0C, 2 };
- mHalfBridges[TLE_HB7] = { HB_ACT_2_CTRL, 0x30, 4, HB_MODE_2_CTRL, 0x30, 4, FW_CTRL, 0x01, 0, OP_ERROR_2_STAT, 0x30, 4, OP_ERROR_5_STAT, 0x30, 4 };
- mHalfBridges[TLE_HB8] = { HB_ACT_2_CTRL, 0xC0, 6, HB_MODE_2_CTRL, 0xC0, 6, FW_CTRL, 0x02, 1, OP_ERROR_2_STAT, 0xC0, 6, OP_ERROR_5_STAT, 0xC0, 6 };
- mHalfBridges[TLE_HB9] = { HB_ACT_3_CTRL, 0x03, 0, HB_MODE_3_CTRL, 0x03, 0, FW_CTRL, 0x04, 2, OP_ERROR_3_STAT, 0x03, 0, OP_ERROR_6_STAT, 0x03, 0 };
- mHalfBridges[TLE_HB10] = { HB_ACT_3_CTRL, 0x0C, 2, HB_MODE_3_CTRL, 0x0C, 2, FW_CTRL, 0x08, 3, OP_ERROR_3_STAT, 0x0C, 2, OP_ERROR_6_STAT, 0x0C, 2 };
- mHalfBridges[TLE_HB11] = { HB_ACT_3_CTRL, 0x30, 4, HB_MODE_3_CTRL, 0x30, 4, FW_CTRL, 0x10, 4, OP_ERROR_3_STAT, 0x30, 4, OP_ERROR_6_STAT, 0x30, 4 };
- mHalfBridges[TLE_HB12] = { HB_ACT_3_CTRL, 0xC0, 6, HB_MODE_3_CTRL, 0xC0, 6, FW_CTRL, 0x20, 5, OP_ERROR_3_STAT, 0xC0, 6, OP_ERROR_6_STAT, 0xC0, 6 };
-
- //bit masking for all pwm channels
- mPwmChannels[TLE_NOPWM] = { PWM_CH_FREQ_CTRL, 0x00, 0, 0, 0x00, 0}; //dummy channel for NOPWM
- mPwmChannels[TLE_PWM1] = { PWM_CH_FREQ_CTRL, 0x03, 0, PWM1_DC_CTRL, 0xFF, 0};
- mPwmChannels[TLE_PWM2] = { PWM_CH_FREQ_CTRL, 0x0C, 2, PWM2_DC_CTRL, 0xFF, 0};
- mPwmChannels[TLE_PWM3] = { PWM_CH_FREQ_CTRL, 0x30, 4, PWM3_DC_CTRL, 0xFF, 0};
-
-}
\ No newline at end of file
+/*!
+ * \file TLE94112_conf.cpp
+ * \name TLE94112_conf.cpp - automatically included library
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief This file can optionally be included in projects that use Infineon's
+ * DC Motor Control Shield with TLE94112
+ * It provides a higher abstraction for controlling motors with the TLE94112
+ * acting as an output driver
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+#include "tle94112_conf.h"
+#include "TLE94112.h"
+
+void Tle94112::init(void)
+{
+ //!< initial control register configuration
+ mCtrlRegAddresses[static_cast(Tle94112::HB_ACT_1_CTRL)] = 0x03;
+ mCtrlRegData[HB_ACT_1_CTRL] = 0;
+ mCtrlRegAddresses[HB_ACT_2_CTRL] = 0x43;
+ mCtrlRegData[HB_ACT_2_CTRL] = 0;
+ mCtrlRegAddresses[HB_ACT_3_CTRL] = 0x23;
+ mCtrlRegData[HB_ACT_3_CTRL] = 0;
+ mCtrlRegAddresses[HB_MODE_1_CTRL] = 0x63;
+ mCtrlRegData[HB_MODE_1_CTRL] = 0;
+ mCtrlRegAddresses[HB_MODE_2_CTRL] = 0x13;
+ mCtrlRegData[HB_MODE_2_CTRL] = 0;
+ mCtrlRegAddresses[HB_MODE_3_CTRL] = 0x53;
+ mCtrlRegData[HB_MODE_3_CTRL] = 0;
+ mCtrlRegAddresses[PWM_CH_FREQ_CTRL] = 0x33;
+ mCtrlRegData[PWM_CH_FREQ_CTRL] = 0;
+ mCtrlRegAddresses[PWM1_DC_CTRL] = 0x73;
+ mCtrlRegData[PWM1_DC_CTRL] = 0;
+ mCtrlRegAddresses[PWM2_DC_CTRL] = 0x0B;
+ mCtrlRegData[PWM2_DC_CTRL] = 0;
+ mCtrlRegAddresses[PWM3_DC_CTRL] = 0x4B;
+ mCtrlRegData[PWM3_DC_CTRL] = 0;
+ mCtrlRegAddresses[FW_OL_CTRL] = 0x2B;
+ mCtrlRegData[FW_OL_CTRL] = 0;
+ mCtrlRegAddresses[FW_CTRL] = 0x6B;
+ mCtrlRegData[FW_CTRL] = 0;
+
+ //!< status register configuration
+ mStatusRegAddresses[SYS_DIAG1] = 0x1B;
+ mStatusRegAddresses[OP_ERROR_1_STAT] = 0x5B;
+ mStatusRegAddresses[OP_ERROR_2_STAT] = 0x3B;
+ mStatusRegAddresses[OP_ERROR_3_STAT] = 0x7B;
+ mStatusRegAddresses[OP_ERROR_4_STAT] = 0x07;
+ mStatusRegAddresses[OP_ERROR_5_STAT] = 0x47;
+ mStatusRegAddresses[OP_ERROR_6_STAT] = 0x27;
+
+ //!< bit masking for all halfbridges
+ mHalfBridges[TLE_NOHB] = { HB_ACT_1_CTRL, 0x00, 0, HB_MODE_1_CTRL, 0x00, 0, FW_OL_CTRL, 0x00, 0, OP_ERROR_1_STAT, 0x00, 0, OP_ERROR_4_STAT, 0x00, 0 };
+ mHalfBridges[TLE_HB1] = { HB_ACT_1_CTRL, 0x03, 0, HB_MODE_1_CTRL, 0x03, 0, FW_OL_CTRL, 0x04, 2, OP_ERROR_1_STAT, 0x03, 0, OP_ERROR_4_STAT, 0x03, 0 };
+ mHalfBridges[TLE_HB2] = { HB_ACT_1_CTRL, 0x0C, 2, HB_MODE_1_CTRL, 0x0C, 2, FW_OL_CTRL, 0x08, 3, OP_ERROR_1_STAT, 0x0C, 2, OP_ERROR_4_STAT, 0x0C, 2 };
+ mHalfBridges[TLE_HB3] = { HB_ACT_1_CTRL, 0x30, 4, HB_MODE_1_CTRL, 0x30, 4, FW_OL_CTRL, 0x10, 4, OP_ERROR_1_STAT, 0x30, 4, OP_ERROR_4_STAT, 0x30, 4 };
+ mHalfBridges[TLE_HB4] = { HB_ACT_1_CTRL, 0xC0, 6, HB_MODE_1_CTRL, 0xC0, 6, FW_OL_CTRL, 0x20, 5, OP_ERROR_1_STAT, 0xC0, 6, OP_ERROR_4_STAT, 0xC0, 6 };
+ mHalfBridges[TLE_HB5] = { HB_ACT_2_CTRL, 0x03, 0, HB_MODE_2_CTRL, 0x03, 0, FW_OL_CTRL, 0x40, 6, OP_ERROR_2_STAT, 0x03, 0, OP_ERROR_5_STAT, 0x03, 0 };
+ mHalfBridges[TLE_HB6] = { HB_ACT_2_CTRL, 0x0C, 2, HB_MODE_2_CTRL, 0x0C, 2, FW_OL_CTRL, 0x80, 7, OP_ERROR_2_STAT, 0x0C, 2, OP_ERROR_5_STAT, 0x0C, 2 };
+ mHalfBridges[TLE_HB7] = { HB_ACT_2_CTRL, 0x30, 4, HB_MODE_2_CTRL, 0x30, 4, FW_CTRL, 0x01, 0, OP_ERROR_2_STAT, 0x30, 4, OP_ERROR_5_STAT, 0x30, 4 };
+ mHalfBridges[TLE_HB8] = { HB_ACT_2_CTRL, 0xC0, 6, HB_MODE_2_CTRL, 0xC0, 6, FW_CTRL, 0x02, 1, OP_ERROR_2_STAT, 0xC0, 6, OP_ERROR_5_STAT, 0xC0, 6 };
+ mHalfBridges[TLE_HB9] = { HB_ACT_3_CTRL, 0x03, 0, HB_MODE_3_CTRL, 0x03, 0, FW_CTRL, 0x04, 2, OP_ERROR_3_STAT, 0x03, 0, OP_ERROR_6_STAT, 0x03, 0 };
+ mHalfBridges[TLE_HB10] = { HB_ACT_3_CTRL, 0x0C, 2, HB_MODE_3_CTRL, 0x0C, 2, FW_CTRL, 0x08, 3, OP_ERROR_3_STAT, 0x0C, 2, OP_ERROR_6_STAT, 0x0C, 2 };
+ mHalfBridges[TLE_HB11] = { HB_ACT_3_CTRL, 0x30, 4, HB_MODE_3_CTRL, 0x30, 4, FW_CTRL, 0x10, 4, OP_ERROR_3_STAT, 0x30, 4, OP_ERROR_6_STAT, 0x30, 4 };
+ mHalfBridges[TLE_HB12] = { HB_ACT_3_CTRL, 0xC0, 6, HB_MODE_3_CTRL, 0xC0, 6, FW_CTRL, 0x20, 5, OP_ERROR_3_STAT, 0xC0, 6, OP_ERROR_6_STAT, 0xC0, 6 };
+
+ //!< bit masking for all pwm channels
+ mPwmChannels[TLE_NOPWM] = { PWM_CH_FREQ_CTRL, 0x00, 0, 0, 0x00, 0}; //dummy channel for NOPWM
+ mPwmChannels[TLE_PWM1] = { PWM_CH_FREQ_CTRL, 0x03, 0, PWM1_DC_CTRL, 0xFF, 0};
+ mPwmChannels[TLE_PWM2] = { PWM_CH_FREQ_CTRL, 0x0C, 2, PWM2_DC_CTRL, 0xFF, 0};
+ mPwmChannels[TLE_PWM3] = { PWM_CH_FREQ_CTRL, 0x30, 4, PWM3_DC_CTRL, 0xFF, 0};
+
+}
diff --git a/src/util/tle94112_conf.h b/src/util/tle94112_conf.h
index 990d1483..130230bd 100644
--- a/src/util/tle94112_conf.h
+++ b/src/util/tle94112_conf.h
@@ -1,54 +1,71 @@
-/*
- * Arduino library to control Infineon's DC Motor Control Shield with TLE94112
- *
- * The shield contains twelve independent halfbridges,
- * so it can drive up to 6 indipendent (+5 cascaded) bidirectional DC motor(s).
- * Each halfbridge provides a high-Voltage (nominal 5.5-18 V) tristate output,
- * which is also capable of PWM with 3 different frequencies.
- *
- * Have a look at the datasheet for more information.
- */
-
-/*! \file TLE94112_conf.h
- * \brief This file is automatically included
- */
-
-
-#ifndef TLE94112_CONF_H
-#define TLE94112_CONF_H
-
-#include "Arduino.h"
-
-//! \brief struct containing register locations for a single halfbridge
-typedef struct
-{
- uint8_t stateReg;
- uint8_t stateMask;
- uint8_t stateShift;
- uint8_t pwmReg;
- uint8_t pwmMask;
- uint8_t pwmShift;
- uint8_t fwReg;
- uint8_t fwMask;
- uint8_t fwShift;
- uint8_t ocReg;
- uint8_t ocMask;
- uint8_t ocShift;
- uint8_t olReg;
- uint8_t olMask;
- uint8_t olShift;
-} HalfBridge_t;
-
-//! \brief struct containing register locations for a single PWM channel
-typedef struct
-{
- uint8_t freqReg;
- uint8_t freqMask;
- uint8_t freqShift;
- uint8_t dcReg;
- uint8_t dcMask;
- uint8_t dcShift;
-} PWMchannel_t;
-
-
+/*!
+ * \file TLE94112_conf.h
+ * \name TLE94112_conf.h - automatically included library
+ * \author Infineon Technologies AG
+ * \copyright 2019 Infineon Technologies AG
+ * \version 1.4.1
+ * \brief This file can optionally be included in projects that use Infineon's
+ * DC Motor Control Shield with TLE94112
+ * It provides a higher abstraction for controlling motors with the TLE94112
+ * acting as an output driver
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TLE94112_CONF_H
+#define TLE94112_CONF_H
+
+#include "Arduino.h"
+
+//! \brief struct containing register locations for a single halfbridge
+typedef struct
+{
+ uint8_t stateReg;
+ uint8_t stateMask;
+ uint8_t stateShift;
+ uint8_t pwmReg;
+ uint8_t pwmMask;
+ uint8_t pwmShift;
+ uint8_t fwReg;
+ uint8_t fwMask;
+ uint8_t fwShift;
+ uint8_t ocReg;
+ uint8_t ocMask;
+ uint8_t ocShift;
+ uint8_t olReg;
+ uint8_t olMask;
+ uint8_t olShift;
+} HalfBridge_t;
+
+//! \brief struct containing register locations for a single PWM channel
+typedef struct
+{
+ uint8_t freqReg;
+ uint8_t freqMask;
+ uint8_t freqShift;
+ uint8_t dcReg;
+ uint8_t dcMask;
+ uint8_t dcShift;
+} PWMchannel_t;
+
#endif
\ No newline at end of file