mirror of
https://github.com/rene-dev/stmbl.git
synced 2026-09-25 01:08:50 +08:00
Merge branch 'master' of github.com:rene-dev/stmbl
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
link pid
|
||||
link pmsm
|
||||
link encm_fb0
|
||||
link misc
|
||||
conf0.r = 1.2
|
||||
conf0.l = 0.005
|
||||
conf0.j = 0.00005
|
||||
conf0.polecount = 2
|
||||
conf0.max_ac_cur = 10
|
||||
conf0.max_force = 4
|
||||
conf0.mot_fb_offset = 1.57
|
||||
conf0.max_vel = 837
|
||||
load avg
|
||||
load avg
|
||||
load avg
|
||||
load debounce
|
||||
load wobl
|
||||
avg0.rt_prio = 10
|
||||
avg1.rt_prio = 10
|
||||
avg2.rt_prio = 10
|
||||
debounce0.rt_prio = 10
|
||||
wobl0.frt_prio = 10
|
||||
io0.frt_prio = 10
|
||||
debounce0.debounce_time = 1
|
||||
debounce0.in = 1
|
||||
fault0.en = debounce0.out
|
||||
wobl0.en = debounce0.out
|
||||
avg0.in = io0.in0
|
||||
avg1.in = io0.in1
|
||||
avg2.in = adc0.cos1
|
||||
wobl0.freq = avg0.out
|
||||
wobl0.freq_diff = avg1.out
|
||||
rev0.in = wobl0.pos
|
||||
io0.out0 = wobl0.out
|
||||
io0.out1 = wobl0.out
|
||||
io0.out2 = wobl0.out
|
||||
conf0.vel_g = 0.05
|
||||
|
||||
avg0.mult = 5.0
|
||||
avg1.mult = 0.1
|
||||
avg2.mult = 1
|
||||
avg0.offset = -1.2
|
||||
wobl0.home_pos = 0.0
|
||||
wobl0.duty = 0.1
|
||||
wobl0.amp = 0.1
|
||||
fb_switch0.offset_first_enable = 0
|
||||
fb_switch0.track_fb = 1
|
||||
conf0.max_pos_error = 0
|
||||
wobl0.home_pos = 1.2
|
||||
wobl0.amp = avg2.out
|
||||
avg2.mult = 0.01
|
||||
+3
-3
@@ -21,7 +21,7 @@ struct wobl_ctx_t {
|
||||
float ang2;
|
||||
};
|
||||
|
||||
static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
static void frt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
struct wobl_ctx_t *ctx = (struct wobl_ctx_t *)ctx_ptr;
|
||||
struct wobl_pin_ctx_t *pins = (struct wobl_pin_ctx_t *)pin_ptr;
|
||||
|
||||
@@ -45,8 +45,8 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
|
||||
hal_comp_t wobl_comp_struct = {
|
||||
.name = "wobl",
|
||||
.nrt = 0,
|
||||
.rt = rt_func,
|
||||
.frt = 0,
|
||||
.rt = 0,
|
||||
.frt = frt_func,
|
||||
.nrt_init = 0,
|
||||
.rt_start = 0,
|
||||
.frt_start = 0,
|
||||
|
||||
+3
-2
@@ -18,7 +18,7 @@ struct encm_ctx_t {
|
||||
uint8_t rxbuf[15];
|
||||
};
|
||||
|
||||
static void nrt_init(volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
static void hw_init(volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
struct encm_ctx_t *ctx = (struct encm_ctx_t *)ctx_ptr;
|
||||
// struct encm_pin_ctx_t * pins = (struct encm_pin_ctx_t *)pin_ptr;
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
@@ -146,7 +146,8 @@ hal_comp_t encm_comp_struct = {
|
||||
.nrt = 0,
|
||||
.rt = rt_func,
|
||||
.frt = 0,
|
||||
.nrt_init = nrt_init,
|
||||
.nrt_init = 0,
|
||||
.hw_init = hw_init,
|
||||
.rt_start = 0,
|
||||
.frt_start = 0,
|
||||
.rt_stop = 0,
|
||||
|
||||
+34
-13
@@ -342,20 +342,22 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
|
||||
else
|
||||
GPIO_ResetBits(GPIOD, GPIO_Pin_5);
|
||||
|
||||
if(PIN(out0) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_4);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_4);
|
||||
if(!(PIN(frt_prio) > 0)){//optional fast outputs in fast-rt
|
||||
if(PIN(out0) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_4);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_4);
|
||||
|
||||
if(PIN(out1) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_5);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_5);
|
||||
if(PIN(out1) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_5);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_5);
|
||||
|
||||
if(PIN(out2) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_6);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_6);
|
||||
if(PIN(out2) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_6);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_6);
|
||||
}
|
||||
|
||||
if(PIN(fb0g) > 0)
|
||||
GPIO_SetBits(GPIOD, GPIO_Pin_8);
|
||||
@@ -463,11 +465,30 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
|
||||
PIN(fb1z) = GPIO_ReadInputDataBit(FB1_Z_PORT, FB1_Z_PIN);
|
||||
}
|
||||
|
||||
static void frt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
// struct io_ctx_t * ctx = (struct io_ctx_t *)ctx_ptr;
|
||||
struct io_pin_ctx_t *pins = (struct io_pin_ctx_t *)pin_ptr;
|
||||
if(PIN(out0) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_4);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_4);
|
||||
|
||||
if(PIN(out1) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_5);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_5);
|
||||
|
||||
if(PIN(out2) > 0)
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_6);
|
||||
else
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_6);
|
||||
}
|
||||
|
||||
hal_comp_t io_comp_struct = {
|
||||
.name = "io",
|
||||
.nrt = 0,
|
||||
.rt = rt_func,
|
||||
.frt = 0,
|
||||
.frt = frt_func,
|
||||
.nrt_init = nrt_init,
|
||||
.hw_init = hw_init,
|
||||
.rt_start = 0,
|
||||
|
||||
@@ -25,7 +25,7 @@ struct smartabs_ctx_t {
|
||||
uint8_t rxbuf[15];
|
||||
};
|
||||
|
||||
static void nrt_init(volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
static void hw_init(volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
struct smartabs_ctx_t *ctx = (struct smartabs_ctx_t *)ctx_ptr;
|
||||
// struct smartabs_pin_ctx_t * pins = (struct smartabs_pin_ctx_t *)pin_ptr;
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
@@ -131,7 +131,8 @@ hal_comp_t smartabs_comp_struct = {
|
||||
.nrt = 0,
|
||||
.rt = rt_func,
|
||||
.frt = 0,
|
||||
.nrt_init = nrt_init,
|
||||
.nrt_init = 0,
|
||||
.hw_init = hw_init,
|
||||
.rt_start = 0,
|
||||
.frt_start = 0,
|
||||
.rt_stop = 0,
|
||||
|
||||
Reference in New Issue
Block a user