Skip to content

Commit 88eafe7

Browse files
authored
Merge pull request #3466 from gyd0317/dev
add STM32L1 HAL DRIVER
2 parents d1ba07a + 588bda5 commit 88eafe7

File tree

346 files changed

+411327
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

346 files changed

+411327
-1
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2018-12-07 zylx first version
9+
*/
10+
11+
#ifndef __ADC_CONFIG_H__
12+
#define __ADC_CONFIG_H__
13+
14+
#include <rtthread.h>
15+
16+
#ifdef __cplusplus
17+
extern "C" {
18+
#endif
19+
20+
#ifdef BSP_USING_ADC1
21+
#ifndef ADC1_CONFIG
22+
#define ADC1_CONFIG \
23+
{ \
24+
.Instance = ADC1, \
25+
.Init.DataAlign = ADC_DATAALIGN_RIGHT, \
26+
.Init.ScanConvMode = ADC_SCAN_DISABLE, \
27+
.Init.ContinuousConvMode = DISABLE, \
28+
.Init.NbrOfConversion = 1, \
29+
.Init.DiscontinuousConvMode = DISABLE, \
30+
.Init.NbrOfDiscConversion = 1, \
31+
.Init.ExternalTrigConv = ADC_SOFTWARE_START, \
32+
}
33+
#endif /* ADC1_CONFIG */
34+
#endif /* BSP_USING_ADC1 */
35+
36+
#ifdef BSP_USING_ADC2
37+
#ifndef ADC2_CONFIG
38+
#define ADC2_CONFIG \
39+
{ \
40+
.Instance = ADC2, \
41+
.Init.DataAlign = ADC_DATAALIGN_RIGHT, \
42+
.Init.ScanConvMode = ADC_SCAN_DISABLE, \
43+
.Init.ContinuousConvMode = DISABLE, \
44+
.Init.NbrOfConversion = 1, \
45+
.Init.DiscontinuousConvMode = DISABLE, \
46+
.Init.NbrOfDiscConversion = 1, \
47+
.Init.ExternalTrigConv = ADC_SOFTWARE_START, \
48+
}
49+
#endif /* ADC2_CONFIG */
50+
#endif /* BSP_USING_ADC2 */
51+
52+
#ifdef BSP_USING_ADC3
53+
#ifndef ADC3_CONFIG
54+
#define ADC3_CONFIG \
55+
{ \
56+
.Instance = ADC3, \
57+
.Init.DataAlign = ADC_DATAALIGN_RIGHT, \
58+
.Init.ScanConvMode = ADC_SCAN_DISABLE, \
59+
.Init.ContinuousConvMode = DISABLE, \
60+
.Init.NbrOfConversion = 1, \
61+
.Init.DiscontinuousConvMode = DISABLE, \
62+
.Init.NbrOfDiscConversion = 1, \
63+
.Init.ExternalTrigConv = ADC_SOFTWARE_START, \
64+
}
65+
#endif /* ADC3_CONFIG */
66+
#endif /* BSP_USING_ADC3 */
67+
68+
#ifdef __cplusplus
69+
}
70+
#endif
71+
72+
#endif /* __ADC_CONFIG_H__ */
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2018-01-02 SummerGift first version
9+
* 2019-01-08 SummerGift clean up the code
10+
*/
11+
12+
#ifndef __DMA_CONFIG_H__
13+
#define __DMA_CONFIG_H__
14+
15+
#include <rtthread.h>
16+
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
21+
/* DMA1 channel1 */
22+
/* DMA1 channel2 */
23+
#if defined(BSP_SPI1_RX_USING_DMA) && !defined(SPI1_RX_DMA_INSTANCE)
24+
#define SPI1_DMA_RX_IRQHandler DMA1_Channel2_IRQHandler
25+
#define SPI1_RX_DMA_RCC RCC_AHBENR_DMA1EN
26+
#define SPI1_RX_DMA_INSTANCE DMA1_Channel2
27+
#define SPI1_RX_DMA_IRQ DMA1_Channel2_IRQn
28+
#elif defined(BSP_UART3_TX_USING_DMA) && !defined(UART3_TX_DMA_INSTANCE)
29+
#define UART3_DMA_TX_IRQHandler DMA1_Channel2_IRQHandler
30+
#define UART3_TX_DMA_RCC RCC_AHBENR_DMA1EN
31+
#define UART3_TX_DMA_INSTANCE DMA1_Channel2
32+
#define UART3_TX_DMA_IRQ DMA1_Channel2_IRQn
33+
#endif
34+
35+
/* DMA1 channel3 */
36+
#if defined(BSP_SPI1_TX_USING_DMA) && !defined(SPI1_TX_DMA_INSTANCE)
37+
#define SPI1_DMA_TX_IRQHandler DMA1_Channel3_IRQHandler
38+
#define SPI1_TX_DMA_RCC RCC_AHBENR_DMA1EN
39+
#define SPI1_TX_DMA_INSTANCE DMA1_Channel3
40+
#define SPI1_TX_DMA_IRQ DMA1_Channel3_IRQn
41+
#elif defined(BSP_UART3_RX_USING_DMA) && !defined(UART3_RX_DMA_INSTANCE)
42+
#define UART3_DMA_RX_IRQHandler DMA1_Channel3_IRQHandler
43+
#define UART3_RX_DMA_RCC RCC_AHBENR_DMA1EN
44+
#define UART3_RX_DMA_INSTANCE DMA1_Channel3
45+
#define UART3_RX_DMA_IRQ DMA1_Channel3_IRQn
46+
#endif
47+
48+
/* DMA1 channel4 */
49+
#if defined(BSP_SPI2_RX_USING_DMA) && !defined(SPI2_RX_DMA_INSTANCE)
50+
#define SPI2_DMA_RX_IRQHandler DMA1_Channel4_IRQHandler
51+
#define SPI2_RX_DMA_RCC RCC_AHBENR_DMA1EN
52+
#define SPI2_RX_DMA_INSTANCE DMA1_Channel4
53+
#define SPI2_RX_DMA_IRQ DMA1_Channel4_IRQn
54+
#elif defined(BSP_UART1_TX_USING_DMA) && !defined(UART1_TX_DMA_INSTANCE)
55+
#define UART1_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler
56+
#define UART1_TX_DMA_RCC RCC_AHBENR_DMA1EN
57+
#define UART1_TX_DMA_INSTANCE DMA1_Channel4
58+
#define UART1_TX_DMA_IRQ DMA1_Channel4_IRQn
59+
#endif
60+
61+
/* DMA1 channel5 */
62+
#if defined(BSP_SPI2_TX_USING_DMA) && !defined(SPI2_TX_DMA_INSTANCE)
63+
#define SPI2_DMA_TX_IRQHandler DMA1_Channel5_IRQHandler
64+
#define SPI2_TX_DMA_RCC RCC_AHBENR_DMA1EN
65+
#define SPI2_TX_DMA_INSTANCE DMA1_Channel5
66+
#define SPI2_TX_DMA_IRQ DMA1_Channel5_IRQn
67+
68+
#elif defined(BSP_UART1_RX_USING_DMA) && !defined(UART1_RX_DMA_INSTANCE)
69+
#define UART1_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler
70+
#define UART1_RX_DMA_RCC RCC_AHBENR_DMA1EN
71+
#define UART1_RX_DMA_INSTANCE DMA1_Channel5
72+
#define UART1_RX_DMA_IRQ DMA1_Channel5_IRQn
73+
#endif
74+
75+
/* DMA1 channel6 */
76+
#if defined(BSP_UART2_RX_USING_DMA) && !defined(UART2_RX_DMA_INSTANCE)
77+
#define UART2_DMA_RX_IRQHandler DMA1_Channel6_IRQHandler
78+
#define UART2_RX_DMA_RCC RCC_AHBENR_DMA1EN
79+
#define UART2_RX_DMA_INSTANCE DMA1_Channel6
80+
#define UART2_RX_DMA_IRQ DMA1_Channel6_IRQn
81+
#endif
82+
83+
/* DMA1 channel7 */
84+
#if defined(BSP_UART2_TX_USING_DMA) && !defined(UART2_TX_DMA_INSTANCE)
85+
#define UART2_DMA_TX_IRQHandler DMA1_Channel7_IRQHandler
86+
#define UART2_TX_DMA_RCC RCC_AHBENR_DMA1EN
87+
#define UART2_TX_DMA_INSTANCE DMA1_Channel7
88+
#define UART2_TX_DMA_IRQ DMA1_Channel7_IRQn
89+
#endif
90+
91+
/* DMA2 channel1 */
92+
#if defined(BSP_SPI3_RX_USING_DMA) && !defined(SPI3_RX_DMA_INSTANCE)
93+
#define SPI3_DMA_RX_IRQHandler DMA2_Channel1_IRQHandler
94+
#define SPI3_RX_DMA_RCC RCC_AHBENR_DMA2EN
95+
#define SPI3_RX_DMA_INSTANCE DMA2_Channel1
96+
#define SPI3_RX_DMA_IRQ DMA2_Channel1_IRQn
97+
#endif
98+
99+
/* DMA2 channel2 */
100+
#if defined(BSP_SPI3_TX_USING_DMA) && !defined(SPI3_TX_DMA_INSTANCE)
101+
#define SPI3_DMA_TX_IRQHandler DMA2_Channel2_IRQHandler
102+
#define SPI3_TX_DMA_RCC RCC_AHBENR_DMA2EN
103+
#define SPI3_TX_DMA_INSTANCE DMA2_Channel2
104+
#define SPI3_TX_DMA_IRQ DMA2_Channel2_IRQn
105+
#endif
106+
107+
/* DMA2 channel3 */
108+
#if defined(BSP_UART4_RX_USING_DMA) && !defined(UART4_RX_DMA_INSTANCE)
109+
#define UART4_DMA_RX_IRQHandler DMA2_Channel3_IRQHandler
110+
#define UART4_RX_DMA_RCC RCC_AHBENR_DMA2EN
111+
#define UART4_RX_DMA_INSTANCE DMA2_Channel3
112+
#define UART4_RX_DMA_IRQ DMA2_Channel3_IRQn
113+
#endif
114+
/* DMA2 channel4 */
115+
/* DMA2 channel5 */
116+
#if defined(BSP_UART4_TX_USING_DMA) && !defined(UART4_TX_DMA_INSTANCE)
117+
#define UART4_DMA_TX_IRQHandler DMA2_Channel4_5_IRQHandler
118+
#define UART4_TX_DMA_RCC RCC_AHBENR_DMA2EN
119+
#define UART4_TX_DMA_INSTANCE DMA2_Channel5
120+
#define UART4_TX_DMA_IRQ DMA2_Channel4_5_IRQn
121+
#endif
122+
123+
#ifdef __cplusplus
124+
}
125+
#endif
126+
127+
#endif /* __DMA_CONFIG_H__ */
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2019-08-23 balanceTWK first version
9+
*/
10+
11+
#ifndef __PULSE_ENCODER_CONFIG_H__
12+
#define __PULSE_ENCODER_CONFIG_H__
13+
14+
#include <rtthread.h>
15+
16+
#ifdef __cplusplus
17+
extern "C" {
18+
#endif
19+
20+
#ifdef BSP_USING_PULSE_ENCODER1
21+
#ifndef PULSE_ENCODER1_CONFIG
22+
#define PULSE_ENCODER1_CONFIG \
23+
{ \
24+
.tim_handler.Instance = TIM1, \
25+
.encoder_irqn = TIM1_UP_IRQn, \
26+
.name = "pulse1" \
27+
}
28+
#endif /* PULSE_ENCODER1_CONFIG */
29+
#endif /* BSP_USING_PULSE_ENCODER1 */
30+
31+
#ifdef BSP_USING_PULSE_ENCODER2
32+
#ifndef PULSE_ENCODER2_CONFIG
33+
#define PULSE_ENCODER2_CONFIG \
34+
{ \
35+
.tim_handler.Instance = TIM2, \
36+
.encoder_irqn = TIM2_IRQn, \
37+
.name = "pulse2" \
38+
}
39+
#endif /* PULSE_ENCODER2_CONFIG */
40+
#endif /* BSP_USING_PULSE_ENCODER2 */
41+
42+
#ifdef BSP_USING_PULSE_ENCODER3
43+
#ifndef PULSE_ENCODER3_CONFIG
44+
#define PULSE_ENCODER3_CONFIG \
45+
{ \
46+
.tim_handler.Instance = TIM3, \
47+
.encoder_irqn = TIM3_IRQn, \
48+
.name = "pulse3" \
49+
}
50+
#endif /* PULSE_ENCODER3_CONFIG */
51+
#endif /* BSP_USING_PULSE_ENCODER3 */
52+
53+
#ifdef BSP_USING_PULSE_ENCODER4
54+
#ifndef PULSE_ENCODER4_CONFIG
55+
#define PULSE_ENCODER4_CONFIG \
56+
{ \
57+
.tim_handler.Instance = TIM4, \
58+
.encoder_irqn = TIM4_IRQn, \
59+
.name = "pulse4" \
60+
}
61+
#endif /* PULSE_ENCODER4_CONFIG */
62+
#endif /* BSP_USING_PULSE_ENCODER4 */
63+
64+
#ifdef __cplusplus
65+
}
66+
#endif
67+
68+
#endif /* __PULSE_ENCODER_CONFIG_H__ */
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2018-12-13 zylx first version
9+
*/
10+
11+
#ifndef __PWM_CONFIG_H__
12+
#define __PWM_CONFIG_H__
13+
14+
#include <rtthread.h>
15+
16+
#ifdef __cplusplus
17+
extern "C" {
18+
#endif
19+
20+
#ifdef BSP_USING_PWM2
21+
#ifndef PWM2_CONFIG
22+
#define PWM2_CONFIG \
23+
{ \
24+
.tim_handle.Instance = TIM2, \
25+
.name = "pwm2", \
26+
.channel = 0 \
27+
}
28+
#endif /* PWM2_CONFIG */
29+
#endif /* BSP_USING_PWM2 */
30+
31+
#ifdef BSP_USING_PWM3
32+
#ifndef PWM3_CONFIG
33+
#define PWM3_CONFIG \
34+
{ \
35+
.tim_handle.Instance = TIM3, \
36+
.name = "pwm3", \
37+
.channel = 0 \
38+
}
39+
#endif /* PWM3_CONFIG */
40+
#endif /* BSP_USING_PWM3 */
41+
42+
#ifdef BSP_USING_PWM4
43+
#ifndef PWM4_CONFIG
44+
#define PWM4_CONFIG \
45+
{ \
46+
.tim_handle.Instance = TIM4, \
47+
.name = "pwm4", \
48+
.channel = 0 \
49+
}
50+
#endif /* PWM4_CONFIG */
51+
#endif /* BSP_USING_PWM4 */
52+
53+
#ifdef BSP_USING_PWM5
54+
#ifndef PWM5_CONFIG
55+
#define PWM5_CONFIG \
56+
{ \
57+
.tim_handle.Instance = TIM5, \
58+
.name = "pwm5", \
59+
.channel = 0 \
60+
}
61+
#endif /* PWM5_CONFIG */
62+
#endif /* BSP_USING_PWM5 */
63+
64+
#ifdef __cplusplus
65+
}
66+
#endif
67+
68+
#endif /* __PWM_CONFIG_H__ */
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2018-12-13 BalanceTWK first version
9+
*/
10+
11+
#ifndef __SDIO_CONFIG_H__
12+
#define __SDIO_CONFIG_H__
13+
14+
#include <rtthread.h>
15+
#include "stm32l1xx_hal.h"
16+
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
21+
#ifdef BSP_USING_SDIO
22+
#define SDIO_BUS_CONFIG \
23+
{ \
24+
.Instance = SDIO, \
25+
.dma_rx.dma_rcc = RCC_AHBENR_DMA2EN, \
26+
.dma_tx.dma_rcc = RCC_AHBENR_DMA2EN, \
27+
.dma_rx.Instance = DMA2_Channel4, \
28+
.dma_rx.dma_irq = DMA2_Channel4_IRQn, \
29+
.dma_tx.Instance = DMA2_Channel4, \
30+
.dma_tx.dma_irq = DMA2_Channel4_IRQn, \
31+
}
32+
33+
#endif
34+
35+
#ifdef __cplusplus
36+
}
37+
#endif
38+
39+
#endif /*__SDIO_CONFIG_H__ */
40+
41+
42+

0 commit comments

Comments
 (0)