rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
config
boards
kinetis
OS
os
hal
ports
KINETIS
KE1xF
kinetis_stm32.h
Go to the documentation of this file.
1
/*
2
ChibiOS - Copyright (C) 2014-2015 Fabio Utzig
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
/**
18
* @file kinetis_stm32.h
19
* @brief This is needed for better compatibility with STM32 or other CPUs of Kinetis family.
20
* @author andreika <prometheus.pcb@gmail.com>
21
*
22
*/
23
24
#ifndef KINETIS_STM32_H_
25
#define KINETIS_STM32_H_
26
27
#ifdef KE1xF
28
29
// Kinetis family compatibility macros
30
#define GPIO_TypeDef GPIO_Type
31
#define PORT_TypeDef PORT_Type
32
#define UART_TypeDef LPUART_Type
33
#define FTM_TypeDef FTM_Type
34
#define ADC_TypeDef ADC_Type
35
#define COMP_TypeDef CMP_Type
36
37
// More Kinetis family compatibility macros
38
#define PORTx_PCRn_MUX PORT_PCR_MUX
39
#define PORTx_PCRn_PE PORT_PCR_PE(1)
40
#define PORTx_PCRn_PS PORT_PCR_PS(1)
41
#define PAL_STM32_PUPDR_PULLUP (PORTx_PCRn_PE | PORTx_PCRn_PS)
42
#define PAL_STM32_PUPDR_PULLDOWN (PORTx_PCRn_PE)
43
#define PAL_STM32_OSPEED_HIGHEST 0
44
#define PAL_STM32_MODE_INPUT (0U << 0U)
45
46
#define FTM_SC_TOFx FTM_SC_TOF(1)
47
#define FTM_SC_TOIEx FTM_SC_TOIE(1)
48
#define FTM_CnSC_CHFx FTM_CnSC_CHF(1)
49
#define FTM_CnSC_CHIEx FTM_CnSC_CHIE(1)
50
#define FTM_CnSC_MSBx FTM_CnSC_MSB(1)
51
#define FTM_CnSC_ELSAx FTM_CnSC_ELSA(1)
52
#define FTM_CnSC_ELSBx FTM_CnSC_ELSB(1)
53
54
#define PIT LPIT0
55
#define PITChannel0_IRQn LPIT0_Ch0_IRQn
56
#define PITChannel1_IRQn LPIT0_Ch1_IRQn
57
#define PITChannel2_IRQn LPIT0_Ch2_IRQn
58
#define PITChannel3_IRQn LPIT0_Ch3_IRQn
59
60
#else
// other CPUs of Kinetis family
61
62
#define FTM_SC_TOFx FTM_SC_TOF
63
#define FTM_SC_TOIEx FTM_SC_TOIE
64
#define FTM_CnSC_CHFx FTM_CnSC_CHF
65
#define FTM_CnSC_CHIEx FTM_CnSC_CHIE
66
#define FTM_CnSC_MSBx FTM_CnSC_MSB
67
#define FTM_CnSC_ELSAx FTM_CnSC_ELSA
68
#define FTM_CnSC_ELSBx FTM_CnSC_ELSB
69
70
#endif
/* KE1xF */
71
72
// SPI STM32 compatibility layer
73
#define SPI_CR1_DFF (0x1U << 11U)
/*!< 0x00000800 */
74
#define SPI_CR1_CPOL (0x1U << 1U)
/*!< 0x00000002 */
75
#define SPI_CR1_CPHA (0x1U << 0U)
/*!< 0x00000001 */
76
#define SPI_CR1_MSTR (0x1U << 2U)
/*!< 0x00000004 */
77
#define SPI_CR1_BR_Pos (3U)
78
#define SPI_CR1_BR_Msk (0x7U << SPI_CR1_BR_Pos)
/*!< 0x00000038 */
79
#define SPI_CR1_BR SPI_CR1_BR_Msk
/*!<BR[2:0] bits (Baud Rate Control) */
80
#define SPI_CR1_BR_0 (0x1U << 3U)
/*!< 0x00000008 */
81
#define SPI_CR1_BR_1 (0x2U << 3U)
/*!< 0x00000010 */
82
#define SPI_CR1_BR_2 (0x4U << 3U)
/*!< 0x00000020 */
83
#define SPI_CR1_LSBFIRST (0x1U << 7U)
/*!< 0x00000080 */
84
#define SPI_CR1_SSI (0x1U << 8U)
/*!< 0x00000100 */
85
#define SPI_CR1_SSM (0x1U << 9U)
/*!< 0x00000200 */
86
#define STM32_SPI_USE_SPI1 KINETIS_SPI_USE_SPI0
87
#define STM32_SPI_USE_SPI2 KINETIS_SPI_USE_SPI1
88
#define STM32_SPI_USE_SPI3 FALSE
89
90
#define USART_CR2_LINEN (0x1U << 14U)
/*!<LIN mode enable */
/*!< 0x00004000 */
91
92
#define STM32_HAS_GPIOA KINETIS_HAS_GPIOA
93
#define STM32_HAS_GPIOB KINETIS_HAS_GPIOB
94
#define STM32_HAS_GPIOC KINETIS_HAS_GPIOC
95
#define STM32_HAS_GPIOD KINETIS_HAS_GPIOD
96
#define STM32_HAS_GPIOE KINETIS_HAS_GPIOE
97
#define STM32_HAS_GPIOF KINETIS_HAS_GPIOF
98
#define STM32_HAS_GPIOG KINETIS_HAS_GPIOG
99
#define STM32_HAS_GPIOH KINETIS_HAS_GPIOH
100
101
#endif
/* KINETIS_STM32_H_ */
Generated on Sat Sep 27 2025 00:10:04 for rusEFI by
1.9.8