Skip to content
Snippets Groups Projects
Commit f2d44f1a authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Solved some minor compilation errors of the motion manager module and motion modules.

parent 97e0d985
No related branches found
No related tags found
No related merge requests found
...@@ -35,8 +35,8 @@ DYNAMIXEL_OUT_M3 = ./lib/dynamixel_manager_m3.a ...@@ -35,8 +35,8 @@ DYNAMIXEL_OUT_M3 = ./lib/dynamixel_manager_m3.a
SRC_DIR=./src/ SRC_DIR=./src/
SRC=$(wildcard $(SRC_DIR)*.c) SRC=$(wildcard $(SRC_DIR)*.c)
#SRC_DIR_MODULES=./src/modules/ SRC_DIR_MODULES=./src/modules/
#SRC+=$(wildcard $(SRC_DIR_MODULES)*.c) SRC+=$(wildcard $(SRC_DIR_MODULES)*.c)
DYNAMIXEL_M4_FPU_OBJ_DIR=build/m4_fpu/ DYNAMIXEL_M4_FPU_OBJ_DIR=build/m4_fpu/
DYNAMIXEL_M4_FPU_OBJS_TMP = $(notdir $(SRC:.c=.o)) DYNAMIXEL_M4_FPU_OBJS_TMP = $(notdir $(SRC:.c=.o))
......
...@@ -26,7 +26,9 @@ typedef struct TDynModule{ ...@@ -26,7 +26,9 @@ typedef struct TDynModule{
void (*pre_process)(void *module_data); void (*pre_process)(void *module_data);
void (*post_process)(void *module_data); void (*post_process)(void *module_data);
void *data; void *data;
TMemModule *mem_module; TMemModule mem_module;
unsigned short int ram_base_address;
unsigned short int eeprom_base_address;
}TDynModule; }TDynModule;
//public functions //public functions
......
...@@ -55,7 +55,7 @@ typedef struct { ...@@ -55,7 +55,7 @@ typedef struct {
void (*balance)(short int offsets[DYN_MANAGER_MAX_NUM_DEVICES]); void (*balance)(short int offsets[DYN_MANAGER_MAX_NUM_DEVICES]);
}TMotionManager; }TMotionManager;
unsigned char mmanager_init(TMotionManager *mmanager,TMemory *memory); unsigned char mmanager_init(TMotionManager *mmanager,TMemory *memory,unsigned short int ram_base_address,unsigned short int eeprom_base_address);
TDynModule *mmanager_get_dyn_module(TMotionManager *mmanager); TDynModule *mmanager_get_dyn_module(TMotionManager *mmanager);
void mmanager_enable_balance(TMotionManager *mmanager); void mmanager_enable_balance(TMotionManager *mmanager);
void mmanager_disable_balance(TMotionManager *mmanager); void mmanager_disable_balance(TMotionManager *mmanager);
......
...@@ -17,6 +17,8 @@ unsigned char dyn_module_init(TDynModule *module) ...@@ -17,6 +17,8 @@ unsigned char dyn_module_init(TDynModule *module)
module->pre_process=0x00000000; module->pre_process=0x00000000;
module->post_process=0x00000000; module->post_process=0x00000000;
module->data=0x00000000; module->data=0x00000000;
/* initialize memory module */
mem_module_init(&module->mem_module);
return 0x01; return 0x01;
} }
......
...@@ -500,7 +500,7 @@ void action_init(void) ...@@ -500,7 +500,7 @@ void action_init(void)
action_pause_time=0;// fixed point 48|16 format action_pause_time=0;// fixed point 48|16 format
action_current_time=0;// fixed point 48|16 format action_current_time=0;// fixed point 48|16 format
action_section_time=0;// fixed point 48|16 format action_section_time=0;// fixed point 48|16 format
action_period=(DYN_MANAGER_DEFAULT_PERIOD_US<<16)/1000000; //action_period=(DYN_MANAGER_DEFAULT_PERIOD_US<<16)/1000000;
} }
TMotionModule *action_get_module(void) TMotionModule *action_get_module(void)
......
#include "motion_manager.h" #include "motion_manager.h"
#include "motion_manager_registers.h"
#include "motion_module.h" #include "motion_module.h"
#include "dyn_devices.h" #include "dyn_devices.h"
#include "dyn_servos.h" #include "dyn_servos.h"
/* private variables */
uint16_t mm_eeprom_data[] __attribute__ ((section (".eeprom")))={DEFAULT_ADC_PERIOD,ADC_PERIOD};
/* private functions */ /* private functions */
void mmanager_read_cmd(void *module,unsigned short int address,unsigned short int length,unsigned char *data) void mmanager_read_cmd(void *module,unsigned short int address,unsigned short int length,unsigned char *data)
{ {
...@@ -235,7 +233,7 @@ void mmanager_set_period(TMotionManager *mmanager,unsigned short int period_us) ...@@ -235,7 +233,7 @@ void mmanager_set_period(TMotionManager *mmanager,unsigned short int period_us)
{ {
unsigned char i; unsigned char i;
for(i=0;i<MAX_NUM_MOTION_MODULES;i++) for(i=0;i<MM_MAX_NUM_MOTION_MODULES;i++)
if(mmanager->modules[i]->set_period!=0x00000000) if(mmanager->modules[i]->set_period!=0x00000000)
mmanager->modules[i]->set_period(mmanager->modules[i]->data,period_us*mmanager->dyn_module.period_count); mmanager->modules[i]->set_period(mmanager->modules[i]->data,period_us*mmanager->dyn_module.period_count);
} }
...@@ -244,7 +242,7 @@ void mmanager_pre_process(TMotionManager *mmanager) ...@@ -244,7 +242,7 @@ void mmanager_pre_process(TMotionManager *mmanager)
{ {
unsigned char i; unsigned char i;
for(i=0;i<MAX_NUM_MOTION_MODULES;i++) for(i=0;i<MM_MAX_NUM_MOTION_MODULES;i++)
{ {
if(mmanager->modules[i]!=0x00000000 && mmanager->modules[i]->pre_process!=0x00000000) if(mmanager->modules[i]!=0x00000000 && mmanager->modules[i]->pre_process!=0x00000000)
mmanager->modules[i]->pre_process(mmanager->modules[i]->data); mmanager->modules[i]->pre_process(mmanager->modules[i]->data);
...@@ -259,7 +257,7 @@ void mmanager_post_process(TMotionManager *mmanager) ...@@ -259,7 +257,7 @@ void mmanager_post_process(TMotionManager *mmanager)
/* transform the current values to angles */ /* transform the current values to angles */
mmanager_compute_angles(mmanager); mmanager_compute_angles(mmanager);
for(i=0;i<MAX_NUM_MOTION_MODULES;i++) for(i=0;i<MM_MAX_NUM_MOTION_MODULES;i++)
{ {
if(mmanager->modules[i]!=0x00000000 && mmanager->modules[i]->post_process!=0x00000000) if(mmanager->modules[i]!=0x00000000 && mmanager->modules[i]->post_process!=0x00000000)
mmanager->modules[i]->post_process(mmanager->modules[i]->data); mmanager->modules[i]->post_process(mmanager->modules[i]->data);
...@@ -267,7 +265,7 @@ void mmanager_post_process(TMotionManager *mmanager) ...@@ -267,7 +265,7 @@ void mmanager_post_process(TMotionManager *mmanager)
} }
/* public functions */ /* public functions */
unsigned char mmanager_init(TMotionManager *mmanager,TMemory *memory) unsigned char mmanager_init(TMotionManager *mmanager,TMemory *memory,unsigned short int ram_base_address,unsigned short int eeprom_base_address)
{ {
unsigned char i; unsigned char i;
...@@ -300,7 +298,7 @@ unsigned char mmanager_init(TMotionManager *mmanager,TMemory *memory) ...@@ -300,7 +298,7 @@ unsigned char mmanager_init(TMotionManager *mmanager,TMemory *memory)
mmanager->balance_enabled=0x00; mmanager->balance_enabled=0x00;
mmanager->num_modules=0x00; mmanager->num_modules=0x00;
/* initialize motion module base attributes */ /* initialize motion module base attributes */
for(i=0;i<MAX_NUM_MOTION_MODULES;i++) for(i=0;i<MM_MAX_NUM_MOTION_MODULES;i++)
mmanager->modules[i]=0x00000000; mmanager->modules[i]=0x00000000;
for(i=0;i<DYN_MANAGER_MAX_NUM_DEVICES;i++) for(i=0;i<DYN_MANAGER_MAX_NUM_DEVICES;i++)
{ {
...@@ -330,15 +328,16 @@ unsigned char mmanager_init(TMotionManager *mmanager,TMemory *memory) ...@@ -330,15 +328,16 @@ unsigned char mmanager_init(TMotionManager *mmanager,TMemory *memory)
mmanager->balance=0x00000000; mmanager->balance=0x00000000;
/* initialize memory module */ /* initialize memory module */
mem_module_init(&manager->mem_module); mmanager->dyn_module.mem_module.data=mmanager;
manager->mem_module.data=manager; mmanager->dyn_module.mem_module.write_cmd=mmanager_write_cmd;
manager->mem_module.write_cmd=mmanager_write_cmd; mmanager->dyn_module.mem_module.read_cmd=mmanager_read_cmd;
manager->mem_module.read_cmd=mmanager_read_cmd; if(!mem_module_add_ram_segment(&mmanager->dyn_module.mem_module,ram_base_address,RAM_MM_LENGTH))
if(!mem_module_add_ram_segment(&manager->mem_module,RAM_MM_BASE_ADDRESS,RAM_MM_LENGTH))
return 0x00; return 0x00;
if(!mem_module_add_eeprom_segment(&manager->mem_module,EEPROM_MM_BASE_ADDRESS,EEPROM_MM_LENGTH)) mmanager->dyn_module.ram_base_address=ram_base_address;
if(!mem_module_add_eeprom_segment(&mmanager->dyn_module.mem_module,eeprom_base_address,EEPROM_MM_LENGTH))
return 0x00; return 0x00;
if(!mem_add_module(memory,&manager->mem_module)) mmanager->dyn_module.eeprom_base_address=eeprom_base_address;
if(!mem_add_module(memory,&mmanager->dyn_module.mem_module))
return 0x00; return 0x00;
return 0x01; return 0x01;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment