Skip to content

Commit 9373d56

Browse files
committed
update to v0.1.6
1 parent bbecc82 commit 9373d56

File tree

7 files changed

+86
-6
lines changed

7 files changed

+86
-6
lines changed

drivers/baremetal/drv_usart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2019-11-09 xiangxistu first version
9+
* 2020-05-18 chenyaxing modify stm32_uart_config struct
910
*/
1011

1112
#include <string.h>
@@ -209,7 +210,7 @@ static long stm32_gpio_clk_enable(GPIO_TypeDef *gpiox)
209210
return 0;
210211
}
211212

212-
char * up_char(char * c)
213+
static int up_char(char * c)
213214
{
214215
if ((*c >= 'a') && (*c <= 'z'))
215216
{

drivers/nano/SConscript

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
from building import *
3+
4+
5+
def modify_board_h_file(filepath, include_str):
6+
is_include_file_exist = False
7+
8+
with open(filepath, mode='r') as f:
9+
for line in f:
10+
if include_str.strip() in line:
11+
is_include_file_exist = True
12+
break
13+
14+
if not is_include_file_exist:
15+
w_str = ""
16+
with open(filepath, mode='r') as f:
17+
for line in f:
18+
if '#define __BOARD_H__' in line:
19+
w_str += line
20+
w_str += include_str
21+
else:
22+
w_str += line
23+
with open(filepath, mode='w') as f:
24+
f.write(w_str)
25+
26+
27+
cwd = GetCurrentDir()
28+
group = DefineGroup('', [], depend=[''], CPPPATH=[])
29+
30+
file_path = "board.h"
31+
include_str = """
32+
#include <stm32g4xx.h>
33+
"""
34+
modify_board_h_file(os.path.join(cwd, file_path), include_str)
35+
os.remove(os.path.join(cwd,"SConscript"))
36+
37+
Return('group')

drivers/nano/drv_clk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void system_clock_config(int target_freq_mhz)
4040
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
4141
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
4242
{
43-
Error_Handler();
43+
Error_Handler();
4444
}
4545
/** Initializes the CPU, AHB and APB busses clocks
4646
*/
@@ -53,7 +53,7 @@ void system_clock_config(int target_freq_mhz)
5353

5454
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_8) != HAL_OK)
5555
{
56-
Error_Handler();
56+
Error_Handler();
5757
}
5858
}
5959

drivers/nano/drv_usart.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2019-11-09 xiangxistu first version
9+
* 2020-05-18 chenyaxing modify stm32_uart_config struct
910
*/
1011

1112
#include "stdlib.h"

drivers/rtt/SConscript

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
from building import *
3+
4+
5+
def modify_board_h_file(filepath, include_str):
6+
is_include_file_exist = False
7+
8+
with open(filepath, mode='r') as f:
9+
for line in f:
10+
if include_str.strip() in line:
11+
is_include_file_exist = True
12+
break
13+
14+
if not is_include_file_exist:
15+
w_str = ""
16+
with open(filepath, mode='r') as f:
17+
for line in f:
18+
if '#define __BOARD_H__' in line:
19+
w_str += line
20+
w_str += include_str
21+
else:
22+
w_str += line
23+
with open(filepath, mode='w') as f:
24+
f.write(w_str)
25+
26+
27+
cwd = GetCurrentDir()
28+
group = DefineGroup('', [], depend=[''], CPPPATH=[])
29+
30+
file_path = "board.h"
31+
include_str = """
32+
#include <stm32g4xx.h>
33+
"""
34+
modify_board_h_file(os.path.join(cwd, file_path), include_str)
35+
os.remove(os.path.join(cwd,"SConscript"))
36+
37+
Return('group')

drivers/rtt/drv_clk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void system_clock_config(int target_freq_mhz)
4040
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
4141
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
4242
{
43-
Error_Handler();
43+
Error_Handler();
4444
}
4545
/** Initializes the CPU, AHB and APB busses clocks
4646
*/
@@ -53,7 +53,7 @@ void system_clock_config(int target_freq_mhz)
5353

5454
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_8) != HAL_OK)
5555
{
56-
Error_Handler();
56+
Error_Handler();
5757
}
5858
}
5959
int clock_information(void)

drivers/rtt/drv_usart.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2018-10-30 SummerGift first version
9+
* 2020-05-23 chenyaxing modify stm32_uart_config
910
*/
11+
1012
#include "string.h"
1113
#include "stdlib.h"
1214
#include "drv_common.h"
@@ -329,14 +331,16 @@ static rt_err_t stm32_gpio_clk_enable(GPIO_TypeDef *gpiox)
329331

330332
return RT_EOK;
331333
}
332-
char * up_char(char * c)
334+
335+
static int up_char(char * c)
333336
{
334337
if ((*c >= 'a') && (*c <= 'z'))
335338
{
336339
*c = *c - 32;
337340
}
338341
return 0;
339342
}
343+
340344
static void get_pin_by_name(const char* pin_name, GPIO_TypeDef **port, uint16_t *pin)
341345
{
342346
int pin_num = atoi((char*) &pin_name[2]);

0 commit comments

Comments
 (0)