Skip to content

Commit 7024353

Browse files
committed
feat(Platform): porting STM32F0xx
1 parent 81e886f commit 7024353

Some content is hidden

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

87 files changed

+48880
-1
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# User-specific uVision files
2+
*.opt
3+
*.uvopt
4+
*.uvoptx
5+
*.uvgui
6+
*.uvgui.*
7+
*.uvguix.*
8+
9+
# Generated output files
10+
Listings
11+
Objects
12+
RTE
13+
DebugConfig
14+
15+
# Misc files
16+
*.lin
17+
EventRecorderStub.scvd
18+
19+
# Other files
20+
.vscode

Keilduino/ArduinoAPI/Arduino.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,12 @@ uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout)
169169
* pulse width measuring loop and achieve finer resolution. calling
170170
* digitalRead() instead yields much coarser resolution.
171171
*/
172-
volatile uint32_t* idr = portInputRegister(digitalPinToPort(pin));
172+
#ifdef GPIO_HAVE_PORT_REGISTER_TYPE
173+
PORT_INPUT_REGISTER_TYPE* idr;
174+
#else
175+
volatile uint32_t* idr;
176+
#endif
177+
idr = portInputRegister(digitalPinToPort(pin));
173178
const uint32_t bit = digitalPinToBitMask(pin);
174179
const uint32_t stateMask = (state ? bit : 0);
175180

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/*
2+
* MIT License
3+
* Copyright (c) 2017 - 2022 _VIFEXTech
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
* SOFTWARE.
22+
*/
23+
#ifndef __MCU_CONFIG_H
24+
#define __MCU_CONFIG_H
25+
26+
/*=========================
27+
MCU configuration
28+
*=========================*/
29+
30+
/* System tick */
31+
#define SYSTICK_TICK_FREQ 1000 // Hz
32+
#define SYSTICK_PRIORITY 0
33+
34+
/* Hardware Serial */
35+
#define SERIAL_RX_BUFFER_SIZE 128
36+
#define SERIAL_PREEMPTIONPRIORITY_DEFAULT 1
37+
#define SERIAL_SUBPRIORITY_DEFAULT 3
38+
#define SERIAL_CONFIG_DEFAULT SERIAL_8N1
39+
40+
#define SERIAL_1_ENABLE 1
41+
#if SERIAL_1_ENABLE
42+
# define SERIAL_1_USART USART1
43+
# define SERIAL_1_IRQ_HANDLER_DEF() void USART1_IRQHandler(void)
44+
#endif
45+
46+
#define SERIAL_2_ENABLE 1
47+
#if SERIAL_2_ENABLE
48+
# define SERIAL_2_USART USART2
49+
# define SERIAL_2_IRQ_HANDLER_DEF() void USART2_IRQHandler(void)
50+
#endif
51+
52+
#define SERIAL_3_ENABLE 1
53+
#if SERIAL_3_ENABLE
54+
# define SERIAL_3_USART USART3
55+
# define SERIAL_3_IRQ_HANDLER_DEF() void USART3_IRQHandler(void)
56+
#endif
57+
58+
#define SERIAL_4_ENABLE 0
59+
#if SERIAL_4_ENABLE
60+
# define SERIAL_4_USART UART4
61+
# define SERIAL_4_IRQ_HANDLER_DEF() void UART4_IRQHandler(void)
62+
#endif
63+
64+
#define SERIAL_5_ENABLE 0
65+
#if SERIAL_5_ENABLE
66+
# define SERIAL_5_USART UART5
67+
# define SERIAL_5_IRQ_HANDLER_DEF() void UART5_IRQHandler(void)
68+
#endif
69+
70+
/* Wire (Software I2C) */
71+
#define WIRE_USE_FULL_SPEED_I2C 0
72+
#define WIRE_SDA_PIN PB7
73+
#define WIRE_SCL_PIN PB6
74+
#define WIRE_DELAY 0
75+
#define WIRE_BEGIN_TIMEOUT 100 // ms
76+
#define WIRE_BUFF_SIZE 32
77+
78+
/* SPI Class */
79+
#define SPI_CLASS_AVR_COMPATIBILITY_MODE 1
80+
#define SPI_CLASS_PIN_DEFINE_ENABLE 1
81+
82+
#define SPI_CLASS_1_ENABLE 1
83+
#if SPI_CLASS_1_ENABLE
84+
# define SPI_CLASS_1_SPI SPI1
85+
#endif
86+
87+
#define SPI_CLASS_2_ENABLE 1
88+
#if SPI_CLASS_2_ENABLE
89+
# define SPI_CLASS_2_SPI SPI2
90+
#endif
91+
92+
#define SPI_CLASS_3_ENABLE 1
93+
#if SPI_CLASS_3_ENABLE
94+
# define SPI_CLASS_3_SPI SPI3
95+
#endif
96+
97+
/* WString */
98+
#define WSTRING_MEM_INCLUDE <stdlib.h>
99+
#define WSTRING_MEM_REALLOC realloc
100+
#define WSTRING_MEM_FREE free
101+
102+
/* Print */
103+
#define PRINT_PRINTF_BUFFER_LENGTH 128
104+
105+
/* GPIO */
106+
#define GPIO_DRIVE_DEFAULT GPIO_Speed_50MHz
107+
108+
/* External Interrupt */
109+
#define EXTI_PREEMPTIONPRIORITY_DEFAULT 2
110+
#define EXTI_SUBPRIORITY_DEFAULT 1
111+
112+
/* Timer Interrupt */
113+
#define TIMER_PREEMPTIONPRIORITY_DEFAULT 0
114+
#define TIMER_SUBPRIORITY_DEFAULT 3
115+
116+
/* Tone */
117+
#define TONE_TIMER_DEFAULT TIM1
118+
#define TONE_PREEMPTIONPRIORITY_DEFAULT 0
119+
#define TONE_SUBPRIORITY_DEFAULT 1
120+
121+
/* PWM */
122+
#define PWM_RESOLUTION_DEFAULT 1000
123+
#define PWM_FREQUENCY_DEFAULT 10000
124+
125+
#endif
Binary file not shown.

0 commit comments

Comments
 (0)