miniFOC 1.0.3
This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.
system.c
Go to the documentation of this file.
1/**************************************************************************/
9#include "gd32f1x0.h"
10#include "system.h"
11
15static volatile unsigned long delayms_counter = 1;
16
20void systick_config(void) {
21 if (SysTick_Config(SystemCoreClock / 1000U))
22 while (1);
23 NVIC_SetPriority(SysTick_IRQn, 0x00U);
24}
25
30void delayms(unsigned long count) {
31 delayms_counter = count;
32 while (0U != delayms_counter);
33}
34
38void delay_decrement(void) {
39 if (0U != delayms_counter)
41}
42
49void user_memset(void *buf, unsigned char data, unsigned char num) {
50 unsigned char *buf_p = (unsigned char *) buf;
51 for (unsigned char counter = 0; counter < num; ++counter)
52 buf_p[counter] = data;
53}
54
60unsigned int float_to_int32(float data0) {
61 unsigned int uintp32 = (*((unsigned int *) (&data0)));
62 return uintp32;
63}
64
70float int32_to_float(unsigned int data0) {
71 float fp32 = (*((float *) (&data0)));
72 return fp32;
73}
void systick_config(void)
initialize systick timer to implementation delay function
Definition: system.c:20
void delay_decrement(void)
delay counter decrement function, called by systick handler
Definition: system.c:38
unsigned int float_to_int32(float data0)
convert floating point numbers to int32 type data
Definition: system.c:60
void user_memset(void *buf, unsigned char data, unsigned char num)
format buffer array to fixed value, replace memset function
Definition: system.c:49
void delayms(unsigned long count)
millisecond delay function, any time time.
Definition: system.c:30
float int32_to_float(unsigned int data0)
convert int32 to floating point numbers type data
Definition: system.c:70
static volatile unsigned long delayms_counter
millisecond delay function count variable
Definition: system.c:15
system basic function header file