Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Aug 11, 2015
1 parent 69e998b commit 9be7431
Show file tree
Hide file tree
Showing 15 changed files with 2,664 additions and 1,796 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions 00-STM32F429_LIBRARIES/fatfs/drivers/fatfs_sd_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ uint8_t convert_from_bytes_to_power_of_two (uint16_t NumberOfBytes);

static volatile DSTATUS TM_FATFS_SD_SDIO_Stat = STA_NOINIT; /* Physical drive status */

#define BLOCK_SIZE 512

uint8_t TM_FATFS_SDIO_WriteEnabled(void) {
#if FATFS_USE_WRITEPROTECT_PIN > 0
return !TM_GPIO_GetInputPinValue(FATFS_USE_WRITEPROTECT_PIN_PORT, FATFS_USE_WRITEPROTECT_PIN_PIN);
Expand Down Expand Up @@ -330,8 +332,6 @@ DSTATUS TM_FATFS_SD_SDIO_disk_status(void) {
return TM_FATFS_SD_SDIO_Stat;
}

#define BLOCK_SIZE 512

DRESULT TM_FATFS_SD_SDIO_disk_read(BYTE *buff, DWORD sector, UINT count) {
SD_Error Status = SD_OK;

Expand Down
26 changes: 12 additions & 14 deletions 00-STM32F429_LIBRARIES/tm_stm32f4_delay.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@
* @{
*
@verbatim
------!!!!!!!!!!!------
If you are using GCC (sucks) compiler, then your delay is probably totally inaccurate.
USE TIMER FOR DELAY, otherwise your delay will not be accurate
If you are using GCC compiler, then your microseconds delay is probably totally inaccurate.
USE TIMER FOR DELAY, otherwise your delay will not be accurate.
Or use ARM compiler!
------!!!!!!!!!!!------
Another way is to use ARM compiler.
@endverbatim
*
* As of version 2.0 you have now to possible ways to make a delay.
* As of version 2.0 you have now two possible ways to make a delay.
* The first (and default) is Systick timer. It makes interrupts every 1ms.
* If you want delay in "us" accuracy, there is simple pooling (variable) mode.
*
Expand All @@ -74,15 +72,15 @@ Or use ARM compiler!
* \par Select custom TIM for delay functions
*
* By default, Systick timer is used for delay. If you want your custom timer,
* open defines.h file, add lines below and edit for your needs:
* open defines.h file, add lines below and edit for your needs.
*
@verbatim
\code{.c}
//Select custom timer for delay, here is TIM2 selected.
//If you want custom TIMx, just replace number "2" for your TIM's number.
#define TM_DELAY_TIM TIM2
#define TM_DELAY_TIM_IRQ TIM2_IRQn
#define TM_DELAY_TIM_IRQ_HANDLER TIM2_IRQHandler
@endverbatim
\endcode
*
*
* With this setting (using custom timer) you have better accuracy in "us" delay.
Expand Down Expand Up @@ -291,18 +289,18 @@ static __INLINE void Delay(uint32_t micros) {
static __INLINE void Delayms(uint32_t millis) {
volatile uint32_t timer = TM_Time;

/* Called from interrupt */
if (__get_IPSR()) {
/* Called from thread */
if (!__get_IPSR()) {
/* Wait for timer to count milliseconds */
while ((TM_Time - timer) < millis) {
/* Go sleep, wait systick interrupt */
#ifdef DELAY_SLEEP
/* Go sleep, wait systick interrupt */
__WFI();
#endif
}
} else {
/* Called from thread */
while (millis--) {
/* Called from interrupt */
while (millis) {
if (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) {
millis--;
}
Expand Down
2 changes: 1 addition & 1 deletion 00-STM32F429_LIBRARIES/tm_stm32f4_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ extern C {

/* DMA2 preemption priority */
#ifndef DMA2_NVIC_PREEMPTION_PRIORITY
#define DMA2_NVIC_PREEMPTION_PRIORITY 0x02
#define DMA2_NVIC_PREEMPTION_PRIORITY 0x01
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion 00-STM32F429_LIBRARIES/tm_stm32f4_exti.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ TM_EXTI_Result_t TM_EXTI_Attach(GPIO_TypeDef* GPIOx, uint16_t GPIO_Line, TM_EXTI

/* Add to NVIC */
NVIC_InitStruct.NVIC_IRQChannel = irqchannel;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = TM_EXTI_NVIC_PRIORITY;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = EXTI_NVIC_PRIORITY;
NVIC_InitStruct.NVIC_IRQChannelSubPriority = pinsource;
NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStruct);
Expand Down
6 changes: 3 additions & 3 deletions 00-STM32F429_LIBRARIES/tm_stm32f4_exti.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ extern C {
* If you need higher priority for external interrupts in NVIC, add lines below in defines.h file and edit them
@verbatim
//Set custom NVIC priority
#define TM_EXTI_NVIC_PRIORITY 0x0A
#define EXTI_NVIC_PRIORITY 0x0A
@endverbatim
*
* \par Changelog
Expand Down Expand Up @@ -145,8 +145,8 @@ extern C {
/**
* @brief Default EXTI preemption priority for EXTI lines used in NVIC
*/
#ifndef TM_EXTI_NVIC_PRIORITY
#define TM_EXTI_NVIC_PRIORITY 0x0A
#ifndef EXTI_NVIC_PRIORITY
#define EXTI_NVIC_PRIORITY 0x0A
#endif

/**
Expand Down
1 change: 1 addition & 0 deletions 00-STM32F429_LIBRARIES/tm_stm32f4_pvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void TM_PVD_Enable(TM_PVD_Level_t Level, TM_PVD_Trigger_t Trigger) {
}

/* Clear interrupt */
EXTI->PR = PVD_EXTI_LINE;

/* Enable EXTI interrupt */
EXTI->IMR |= PVD_EXTI_LINE;
Expand Down
14 changes: 9 additions & 5 deletions 00-STM32F429_LIBRARIES/tm_stm32f4_spi_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @email [email protected]
* @website http://stm32f4-discovery.com
* @link http://stm32f4-discovery.com/2015/04/library-56-extend-spi-with-dma-for-stm32f4xx
* @version v1.1
* @version v1.1.1
* @ide Keil uVision
* @license GNU GPL v3
* @brief DMA functionality for TM SPI library
Expand All @@ -28,7 +28,7 @@
@endverbatim
*/
#ifndef TM_SPI_DMA_H
#define TM_SPI_DMA_H 110
#define TM_SPI_DMA_H 111

/* C++ detection */
#ifdef __cplusplus
Expand All @@ -42,12 +42,12 @@ extern C {

/**
* @defgroup TM_SPI_DMA
* @brief DMA functionality for TM SPI library - http://stm32f4-discovery.com/2015/04/library-56-extend-spi-with-dma-for-stm32f4xx
* @brief DMA functionality for @ref TM_SPI library - http://stm32f4-discovery.com/2015/04/library-56-extend-spi-with-dma-for-stm32f4xx
* @{
*
* This library allows you to use DMA with SPI peripheral.
*
* It can send, receive or transmit data over SPI with DMA feature.
* It can send (TX only), receive (RX only) or transmit (TX and RX) data over SPI with DMA feature.
*
* \par
*
Expand All @@ -69,6 +69,10 @@ SPI6 | DMA2 | DMA Stream 5 | DMA Channel 1 | DMA Stream 6 | DMA Channel 0
* \par Changelog
*
@verbatim
Version 1.1.1
- August 11, 2015
- Fixed bug with default TX Stream value for SPI4
Version 1.1
- June 06, 2015
- Added TM DMA library support for future purpose
Expand Down Expand Up @@ -133,7 +137,7 @@ SPI6 | DMA2 | DMA Stream 5 | DMA Channel 1 | DMA Stream 6 | DMA Channel 0

/* SPI4 TX and RX default settings */
#ifndef SPI4_DMA_TX_STREAM
#define SPI4_DMA_TX_STREAM DMA2_Stream0
#define SPI4_DMA_TX_STREAM DMA2_Stream1
#define SPI4_DMA_TX_CHANNEL DMA_Channel_4
#endif
#ifndef SPI4_DMA_RX_STREAM
Expand Down
2 changes: 1 addition & 1 deletion 00-STM32F429_LIBRARIES/tm_stm32f4_usart.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ static void TM_USART_INT_Init(

/* Fill NVIC settings */
NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = TM_USART_NVIC_PRIORITY;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = USART_NVIC_PRIORITY;
NVIC_InitStruct.NVIC_IRQChannelSubPriority = TM_USART_INT_GetSubPriority(USARTx);
NVIC_Init(&NVIC_InitStruct);

Expand Down
24 changes: 12 additions & 12 deletions 00-STM32F429_LIBRARIES/tm_stm32f4_usart.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,39 +277,39 @@ typedef enum {
*/

/* Default buffer size for each USART */
#ifndef TM_USART_BUFFER_SIZE
#define TM_USART_BUFFER_SIZE 32
#ifndef USART_BUFFER_SIZE
#define USART_BUFFER_SIZE 32
#endif

/* Set default buffer size for specific USART if not set by user */
#ifndef TM_USART1_BUFFER_SIZE
#define TM_USART1_BUFFER_SIZE TM_USART_BUFFER_SIZE
#define TM_USART1_BUFFER_SIZE USART_BUFFER_SIZE
#endif
#ifndef TM_USART2_BUFFER_SIZE
#define TM_USART2_BUFFER_SIZE TM_USART_BUFFER_SIZE
#define TM_USART2_BUFFER_SIZE USART_BUFFER_SIZE
#endif
#ifndef TM_USART3_BUFFER_SIZE
#define TM_USART3_BUFFER_SIZE TM_USART_BUFFER_SIZE
#define TM_USART3_BUFFER_SIZE USART_BUFFER_SIZE
#endif
#ifndef TM_UART4_BUFFER_SIZE
#define TM_UART4_BUFFER_SIZE TM_USART_BUFFER_SIZE
#define TM_UART4_BUFFER_SIZE USART_BUFFER_SIZE
#endif
#ifndef TM_UART5_BUFFER_SIZE
#define TM_UART5_BUFFER_SIZE TM_USART_BUFFER_SIZE
#define TM_UART5_BUFFER_SIZE USART_BUFFER_SIZE
#endif
#ifndef TM_USART6_BUFFER_SIZE
#define TM_USART6_BUFFER_SIZE TM_USART_BUFFER_SIZE
#define TM_USART6_BUFFER_SIZE USART_BUFFER_SIZE
#endif
#ifndef TM_UART7_BUFFER_SIZE
#define TM_UART7_BUFFER_SIZE TM_USART_BUFFER_SIZE
#define TM_UART7_BUFFER_SIZE USART_BUFFER_SIZE
#endif
#ifndef TM_UART8_BUFFER_SIZE
#define TM_UART8_BUFFER_SIZE TM_USART_BUFFER_SIZE
#define TM_UART8_BUFFER_SIZE USART_BUFFER_SIZE
#endif

/* NVIC Global Priority */
#ifndef TM_USART_NVIC_PRIORITY
#define TM_USART_NVIC_PRIORITY 0x06
#ifndef USART_NVIC_PRIORITY
#define USART_NVIC_PRIORITY 0x06
#endif

/* U(S)ART settings, can be changed in your defines.h project file */
Expand Down
Loading

0 comments on commit 9be7431

Please sign in to comment.