mirror of https://github.com/rusefi/bldc.git
Added foc-functions to C lib, fix in eeprom extension
This commit is contained in:
parent
6578a642d1
commit
7ae56c0a71
|
@ -582,6 +582,16 @@ typedef struct {
|
|||
bool (*read_nvm)(uint8_t *v, unsigned int len, unsigned int address);
|
||||
bool (*write_nvm)(uint8_t *v, unsigned int len, unsigned int address);
|
||||
bool (*wipe_nvm)(void);
|
||||
|
||||
// FOC
|
||||
float (*foc_get_id)(void);
|
||||
float (*foc_get_iq)(void);
|
||||
float (*foc_get_vd)(void);
|
||||
float (*foc_get_vq)(void);
|
||||
void (*foc_set_openloop_current)(float current, float rpm);
|
||||
void (*foc_set_openloop_phase)(float current, float phase);
|
||||
void (*foc_set_openloop_duty)(float dutyCycle, float rpm);
|
||||
void (*foc_set_openloop_duty_phase)(float dutyCycle, float phase);
|
||||
} vesc_c_if;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "servo_dec.h"
|
||||
#include "servo_simple.h"
|
||||
#include "flash_helper.h"
|
||||
#include "mcpwm_foc.h"
|
||||
|
||||
// Function prototypes otherwise missing
|
||||
void packet_init(void (*s_func)(unsigned char *data, unsigned int len),
|
||||
|
@ -806,11 +807,6 @@ lbm_value ext_load_native_lib(lbm_value *args, lbm_uint argn) {
|
|||
cif.cif.read_eeprom_var = conf_general_read_eeprom_var_custom;
|
||||
cif.cif.store_eeprom_var = conf_general_store_eeprom_var_custom;
|
||||
|
||||
// NVM
|
||||
cif.cif.read_nvm = flash_helper_read_nvm;
|
||||
cif.cif.write_nvm = flash_helper_write_nvm;
|
||||
cif.cif.wipe_nvm = flash_helper_wipe_nvm;
|
||||
|
||||
// Timeout
|
||||
cif.cif.timeout_reset = timeout_reset;
|
||||
cif.cif.timeout_has_timeout = timeout_has_timeout;
|
||||
|
@ -878,6 +874,21 @@ lbm_value ext_load_native_lib(lbm_value *args, lbm_uint argn) {
|
|||
cif.cif.get_ppm_age = lib_get_ppm_age;
|
||||
cif.cif.app_is_output_disabled = app_is_output_disabled;
|
||||
|
||||
// NVM
|
||||
cif.cif.read_nvm = flash_helper_read_nvm;
|
||||
cif.cif.write_nvm = flash_helper_write_nvm;
|
||||
cif.cif.wipe_nvm = flash_helper_wipe_nvm;
|
||||
|
||||
// FOC
|
||||
cif.cif.foc_get_id = mcpwm_foc_get_id_filter;
|
||||
cif.cif.foc_get_iq = mcpwm_foc_get_iq_filter;
|
||||
cif.cif.foc_get_vd = mcpwm_foc_get_vd;
|
||||
cif.cif.foc_get_vq = mcpwm_foc_get_vq;
|
||||
cif.cif.foc_set_openloop_current = mcpwm_foc_set_openloop_current;
|
||||
cif.cif.foc_set_openloop_phase = mcpwm_foc_set_openloop_phase;
|
||||
cif.cif.foc_set_openloop_duty = mcpwm_foc_set_openloop_duty;
|
||||
cif.cif.foc_set_openloop_duty_phase = mcpwm_foc_set_openloop_duty_phase;
|
||||
|
||||
lib_init_done = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -957,7 +957,7 @@ static lbm_value ext_eeprom_store_i(lbm_value *args, lbm_uint argn) {
|
|||
}
|
||||
|
||||
eeprom_var v;
|
||||
v.as_i32 = lbm_dec_as_float(args[1]);
|
||||
v.as_i32 = lbm_dec_as_i32(args[1]);
|
||||
return conf_general_store_eeprom_var_custom(&v, addr) ? ENC_SYM_TRUE : ENC_SYM_NIL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue