Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Oct 17, 2015
1 parent 6448b07 commit b181cc3
Show file tree
Hide file tree
Showing 139 changed files with 140,100 additions and 26 deletions.
58 changes: 40 additions & 18 deletions 00-STM32_LIBRARIES/Doxyfile.doxy
@@ -1,4 +1,4 @@
# Doxyfile 1.8.9.1
# Doxyfile 1.8.10

# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
Expand Down Expand Up @@ -353,6 +353,13 @@ IDL_PROPERTY_SUPPORT = YES

DISTRIBUTE_GROUP_DOC = NO

# If one adds a struct or class to a group and this option is enabled, then also
# any nested class or struct is added to the same group. By default this option
# is disabled and one has to add nested compounds explicitly via \ingroup.
# The default value is: NO.

GROUP_NESTED_COMPOUNDS = NO

# Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that
# type (e.g. under the Public Functions section). Set it to NO to prevent
Expand Down Expand Up @@ -765,7 +772,7 @@ WARN_LOGFILE =
# The INPUT tag is used to specify the files and/or directories that contain
# documented source files. You may enter file names like myfile.cpp or
# directories like /usr/src/myproject. Separate the files or directories with
# spaces.
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = "C:/Users/MajerleT/Google Drive/ELECTRONICS/ARM/stm32fxxx/00-STM32_LIBRARIES"
Expand All @@ -781,12 +788,17 @@ INPUT_ENCODING = UTF-8

# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank the
# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
# *.qsf, *.as and *.js.
# *.h) to filter out the source-files in the directories.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# read by doxygen.
#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd,
# *.vhdl, *.ucf, *.qsf, *.as and *.js.

FILE_PATTERNS = *.c \
*.cc \
Expand Down Expand Up @@ -1199,8 +1211,9 @@ HTML_COLORSTYLE_GAMMA = 80

# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: YES.
# to YES can help to show when doxygen was last run and thus if the
# documentation is up to date.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_TIMESTAMP = YES
Expand Down Expand Up @@ -1495,7 +1508,7 @@ FORMULA_TRANSPARENT = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

USE_MATHJAX = NO
USE_MATHJAX = YES

# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
Expand Down Expand Up @@ -1674,9 +1687,12 @@ COMPACT_LATEX = YES
PAPER_TYPE = a4

# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
# that should be included in the LaTeX output. To get the times font for
# instance you can specify
# EXTRA_PACKAGES=times
# that should be included in the LaTeX output. The package can be specified just
# by its name or with the correct syntax as to be used with the LaTeX
# \usepackage command. To get the times font for instance you can specify :
# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
# To use the option intlimits with the amsmath package you can specify:
# EXTRA_PACKAGES=[intlimits]{amsmath}
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.

Expand Down Expand Up @@ -2277,7 +2293,8 @@ INCLUDED_BY_GRAPH = YES
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
# functions only using the \callgraph command.
# functions only using the \callgraph command. Disabling a call graph can be
# accomplished by means of the command \hidecallgraph.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.

Expand All @@ -2288,7 +2305,8 @@ CALL_GRAPH = NO
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable caller graphs for selected
# functions only using the \callergraph command.
# functions only using the \callergraph command. Disabling a caller graph can be
# accomplished by means of the command \hidecallergraph.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.

Expand All @@ -2311,11 +2329,15 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES

# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot.
# generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see:
# http://www.graphviz.org/)).
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
# to make the SVG files visible in IE 9+ (other browsers do not have this
# requirement).
# Possible values are: png, jpg, gif and svg.
# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
# png:gdiplus:gdiplus.
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.

Expand Down
56 changes: 53 additions & 3 deletions 00-STM32_LIBRARIES/tm_stm32_fft.h
Expand Up @@ -2,7 +2,7 @@
* @author Tilen Majerle
* @email tilen@majerle.eu
* @website http://stm32f4-discovery.com
* @link http://stm32f4-discovery.com/2015/05/library-62-fast-fourier-transform-fft-for-stm32f4xx/
* @link http://stm32f4-discovery.com/2015/07/hal-library-14-fast-fourier-transform-for-stm32fxxx/
* @version v1.0
* @ide Keil uVision
* @license GNU GPL v3
Expand Down Expand Up @@ -42,12 +42,62 @@ extern "C" {

/**
* @defgroup TM_FFT
* @brief FFT library for STM32Fxxx devices - http://stm32f4-discovery.com/2015/05/library-62-fast-fourier-transform-fft-for-stm32f4xx/
* @brief FFT library for STM32Fxxx devices - http://stm32f4-discovery.com/2015/07/hal-library-14-fast-fourier-transform-for-stm32fxxx/
* @{
*
* This library allows you to calculate FFT in your signal.
*
* For more info about FFT and how it works on Cortex-M4, you should take a look at ARM DSP documentation
* For more info about FFT and how it works on Cortex-M4, you should take a look at ARM DSP documentation.
*
* \par ARM dependencies
*
* Some libraries are needed in order to start with ARM CMSIS MATH Library.
*
\verbatim
- arm_const_structs.c, available in “CMSIS\DSP_Lib\Source\CommonTables”
- arm_cortexM4lf_math.lib for ARM compiler, available in “CMSIS\Lib\ARM”
- CMSIS folder can be found if you download these libraries directly from ARM.com or if you download Standard Perihperal Drivers for STM32F4xx from ST.com site.
\endverbatim
*
* \par ARM MATH
*
* ARM MATH is a library provided from ARM and is the same for all Cortex families, except that you have to provide some informations to library.
*
* In your global compiler defines, you should add these 2 lines:
\code
//Use ARM MATH for Cortex-M4
#define ARM_MATH_CM4
//Use ARM MATH for Cortex-M7
#define ARM_MATH_CM7
//Use ARM MATH for Cortex-M0
#define ARM_MATH_CM0
//Use ARM MATH for Cortex-M0+
#define ARM_MATH_CM0PLUS
//Set define if FPU presents on device. On F4xx and F7xx it is available
#define __FPU_PRESENT 1
\endcode
* \par FFT Samples count
*
* ARM FFT library allows you to use specific number of samples for data calculation.
*
* These values can be every number which is <b>power of 2</b> from <b>2^4 and 2^12</b>. So, 9 different FFT length options. This number is passed into function when you initialize FFT with @ref TM_FFT_Init_F32.
*
* \par FFT input/output buffers
*
* FFT works in a way that you first fill input buffer with samples and then you process them and you got samples in output buffer.
* Complex (CFFT) Fast Fourier Transform, which is also used behind the scenes in my library so uses real and imaginary part in input buffer and only real part is calculated to output buffer.
*
* For this reason, input buffer <b>HAVE TO</b> be <b>2 * FFT_Size</b> in length and output buffer HAVE TO be <b>FFT_Size</b> in length where FFT_Size is the same as FFT_Samples count explained above.
*
* Library is able to use @ref malloc() to allocate memory for you.
* You just need to enable this feature when you initialize FFT module and everything will be done for you.
*
* \note You have to make sure that you have enough HEAP memory available for malloc, otherwise malloc will fail and you will not get anything.
*
* For example, if you have <b>512</b> length FFT size, then input buffer must be <b>2 * 512 = 1024</b> samples of float 32 and output buffer is 512 samples of float 32.
* In common, this is <b>1536</b> samples of float32 which is 4-bytes long in memory.
* Together this would be 6144 Bytes of HEAP memory.
*
* \par Changelog
*
Expand Down
32 changes: 29 additions & 3 deletions 00-STM32_LIBRARIES/tm_stm32_i2c.c
Expand Up @@ -18,6 +18,11 @@
*/
#include "tm_stm32_i2c.h"

/* I2C2 AF fix for F0xx */
#if !defined(GPIO_AF4_I2C2)
#define GPIO_AF4_I2C2 GPIO_AF1_I2C2
#endif

/* Timeout value */
#define I2C_TIMEOUT_VALUE 1000

Expand Down Expand Up @@ -77,17 +82,36 @@ I2C_HandleTypeDef* TM_I2C_GetHandle(I2C_TypeDef* I2Cx) {

static void TM_I2C_FillSettings(I2C_HandleTypeDef* Handle, uint32_t clockSpeed) {
#if defined(STM32F7xx)
/* 100kHz @ 50MHz APB clock */
uint32_t I2C_Timing = 0x40912732;
uint32_t I2C_Timing;

/* Future */
if (clockSpeed >= 3400000) {
/* 100kHz @ 50MHz APB clock */
I2C_Timing = 0x40912732;
} else if (clockSpeed >= 1000000) {
/* 100kHz @ 50MHz APB clock */
I2C_Timing = 0x40912732;
} else if (clockSpeed >= 400000) {
/* 100kHz @ 50MHz APB clock */
I2C_Timing = 0x40912732;
} else {
/* 100kHz @ 50MHz APB clock */
I2C_Timing = 0x40912732;
}
#endif
#if defined(STM32F0xx)
/* 100kHz @ 48MHz APB clock */
uint32_t I2C_Timing = 0x10805E89;
#endif

/* Fill settings */
Handle->Init.OwnAddress2 = 0x00;
Handle->Init.OwnAddress1 = 0x00;
Handle->Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
Handle->Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
Handle->Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
Handle->Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
#if defined(STM32F7xx)
#if defined(STM32F7xx) || defined(STM32F0xx)
Handle->Init.Timing = I2C_Timing;
#else
Handle->Init.ClockSpeed = clockSpeed;
Expand Down Expand Up @@ -145,7 +169,9 @@ TM_I2C_Result_t TM_I2C_Init(I2C_TypeDef* I2Cx, TM_I2C_PinsPack_t pinspack, uint3
HAL_I2C_Init(Handle);

/* Enable analog filter */
#if defined(I2C_ANALOGFILTER_ENABLE)
HAL_I2CEx_ConfigAnalogFilter(Handle, I2C_ANALOGFILTER_ENABLE);
#endif

/* Return OK */
return TM_I2C_Result_Ok;
Expand Down

0 comments on commit b181cc3

Please sign in to comment.