Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
humanoides
bioloid_stm32_fw
Commits
c3c8de0c
Commit
c3c8de0c
authored
Jan 22, 2016
by
Sergi Hernandez
Browse files
Changed the main include. Added the USE_HAL_DRIVER macro.
parent
6e6aea46
Changes
15
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
c3c8de0c
...
...
@@ -34,7 +34,7 @@ DYNAMIXEL_PATH=../../STM32_processor/libraries/dynamixel_base
BUILD_PATH
=
build
COMPILE_OPTS
=
-mlittle-endian
-mcpu
=
cortex-m4
-mthumb
-mthumb-interwork
COMPILE_OPTS
+=
-Wall
-O2
-fno-common
COMPILE_OPTS
+=
-Wall
-O2
-fno-common
-DUSE_HAL_DRIVER
COMPILE_OPTS
+=
-mfloat-abi
=
hard
-mfpu
=
fpv4-sp-d16
COMPILE_OPTS
+=
-ffreestanding
-nostdlib
-D
$(PROCESSOR_MACRO)
-DARM_MATH_CM4
-D__FPU_PRESENT
-DHSE_VALUE
=
8000000
INCLUDE_DIRS
=
-I
$(HAL_PATH)
/include
-I
$(HAL_PATH)
/include/core
-I
$(HAL_PATH)
/include/devices
...
...
include/action.h
View file @
c3c8de0c
...
...
@@ -5,7 +5,7 @@
extern
"C"
{
#endif
#include
"stm32f4xx
_hal
.h"
#include
"stm32f4xx.h"
#include
"motion_pages.h"
extern
int64_t
action_current_angles
[
PAGE_MAX_NUM_SERVOS
];
...
...
include/action_id.h
View file @
c3c8de0c
#ifndef _ACTION_ID_H
#define _ACTION_ID_H
#ifdef __cplusplus
extern
"C"
{
#endif
#define BOW 1
#define BRAVO 2
#define RAP_CHEST 5
...
...
@@ -137,4 +141,8 @@
#define BALANCE 224
#define CLAP_END 225
#ifdef __cplusplus
}
#endif
#endif
include/adc_dma.h
View file @
c3c8de0c
...
...
@@ -5,7 +5,7 @@
extern
"C"
{
#endif
#include
"stm32f4xx
_hal
.h"
#include
"stm32f4xx.h"
typedef
enum
{
ADC_CH1
,
ADC_CH2
,
ADC_CH3
,
ADC_CH4
,
ADC_CH6
,
ADC_CH8
}
adc_ch_t
;
...
...
include/bioloid_dyn_master_sensors.h
View file @
c3c8de0c
#ifndef _BIOLOID_DYN_MASTER_SENSORS_H
#define _BIOLOID_DYN_MASTER_SENSORS_H
#include
"stm32f4xx_hal.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#include
"stm32f4xx.h"
#include
"stm32_time.h"
#include
"dynamixel_master.h"
#include
"comm.h"
void
bioloid_dyn_master_sensors_init
(
void
);
#ifdef __cplusplus
}
#endif
#endif
include/bioloid_dyn_master_servos.h
View file @
c3c8de0c
#ifndef _BIOLOID_DYN_MASTER_SERVOS_H
#define _BIOLOID_DYN_MASTER_SERVOS_H
#include
"stm32f4xx_hal.h"
#include
"stm32_time.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#include
"stm32f4xx.h"
#include
"dynamixel_master.h"
#include
"comm.h"
...
...
@@ -12,5 +15,9 @@ void bioloid_dyn_master_servos_init(void);
inline
void
bioloid_dyn_master_servos_enable_power
(
void
);
inline
void
bioloid_dyn_master_servos_disable_power
(
void
);
#ifdef __cplusplus
}
#endif
#endif
include/bioloid_dyn_slave.h
View file @
c3c8de0c
...
...
@@ -5,8 +5,7 @@
extern
"C"
{
#endif
#include
"stm32f4xx_hal.h"
#include
"stm32_time.h"
#include
"stm32f4xx.h"
#include
"dynamixel_slave.h"
#include
"comm.h"
...
...
include/bioloid_gyro.h
View file @
c3c8de0c
#ifndef BIOLOID_GYRO_H
#define BIOLOID_GYRO_H
#include
"stm32f4xx_hal.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#include
"stm32f4xx.h"
#include
"adc_dma.h"
/* public functions */
...
...
@@ -15,4 +19,8 @@ uint8_t gyro_in_range(unsigned short int address, unsigned short int length);
void
gyro_process_read_cmd
(
unsigned
short
int
address
,
unsigned
short
int
length
,
unsigned
char
*
data
);
void
gyro_process_write_cmd
(
unsigned
short
int
address
,
unsigned
short
int
length
,
unsigned
char
*
data
);
#ifdef __cplusplus
}
#endif
#endif
include/bioloid_time.h
View file @
c3c8de0c
...
...
@@ -5,7 +5,7 @@
extern
"C"
{
#endif
#include
"stm32f4xx
_hal
.h"
#include
"stm32f4xx.h"
void
bioloid_time_init
(
void
);
unsigned
long
long
int
bioloid_time_get_counts
(
void
);
...
...
include/eeprom.h
View file @
c3c8de0c
...
...
@@ -40,8 +40,12 @@
#ifndef __EEPROM_H
#define __EEPROM_H
#ifdef __cplusplus
extern
"C"
{
#endif
/* Includes ------------------------------------------------------------------*/
#include
"stm32f4xx
_hal
.h"
#include
"stm32f4xx.h"
/* Exported constants --------------------------------------------------------*/
/* Define the size of the sectors to be used */
...
...
@@ -88,6 +92,10 @@ uint16_t EE_Init(void);
uint16_t
EE_ReadVariable
(
uint16_t
VirtAddress
,
uint16_t
*
Data
);
uint16_t
EE_WriteVariable
(
uint16_t
VirtAddress
,
uint16_t
Data
);
#ifdef __cplusplus
}
#endif
#endif
/* __EEPROM_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
include/gpio.h
View file @
c3c8de0c
...
...
@@ -5,7 +5,7 @@
extern
"C"
{
#endif
#include
"stm32f4xx
_hal
.h"
#include
"stm32f4xx.h"
typedef
enum
{
USER1_LED
,
USER2_LED
,
RXD_LED
,
TXD_LED
}
led_t
;
...
...
include/motion_manager.h
View file @
c3c8de0c
...
...
@@ -5,7 +5,7 @@
extern
"C"
{
#endif
#include
"stm32f4xx
_hal
.h"
#include
"stm32f4xx.h"
typedef
enum
{
R_SHOULDER_PITCH
=
1
,
...
...
include/motion_pages.h
View file @
c3c8de0c
...
...
@@ -5,7 +5,7 @@
extern
"C"
{
#endif
#include
"stm32f4xx
_hal
.h"
#include
"stm32f4xx.h"
#define MAX_PAGES 256
#define PAGE_MAX_NUM_SERVOS 31
...
...
include/zigbee.h
View file @
c3c8de0c
...
...
@@ -5,7 +5,7 @@
extern
"C"
{
#endif
#include
"stm32f4xx
_hal
.h"
#include
"stm32f4xx.h"
// public functions
void
zigbee_init
(
void
);
...
...
src/motion_manager.c
View file @
c3c8de0c
...
...
@@ -184,7 +184,7 @@ void manager_init(uint16_t period_us)
dyn_master_scan
(
&
bioloid_dyn_master_servos
,
&
num
,
servo_ids
);
ram_data
[
BIOLOID_MM_NUM_SERVOS
]
=
num
;
manager_num_servos
=
0
;
for
(
i
=
0
;
i
<
MANAGER_MAX_NUM_SERVOS
;
i
++
)
/*
for(i=0;i<MANAGER_MAX_NUM_SERVOS;i++)
{
if(i==servo_ids[manager_num_servos])
{
...
...
@@ -289,7 +289,7 @@ void manager_init(uint16_t period_us)
manager_servos[i].ccw_angle_limit=0;
}
}
bioloid_dyn_master_servos_disable_power
();
bioloid_dyn_master_servos_disable_power();
*/
/* configure timer */
ENABLE_MANAGER_TIMER_CLK
;
...
...
@@ -298,29 +298,27 @@ void manager_init(uint16_t period_us)
MANAGER_TIM_Handle
.
Init
.
Prescaler
=
84
;
MANAGER_TIM_Handle
.
Init
.
ClockDivision
=
TIM_CLOCKDIVISION_DIV1
;
MANAGER_TIM_Handle
.
Init
.
CounterMode
=
TIM_COUNTERMODE_UP
;
HAL_NVIC_SetPriority
(
MANAGER_TIMER_IRQn
,
2
,
1
);
HAL_NVIC_EnableIRQ
(
MANAGER_TIMER_IRQn
);
//
HAL_NVIC_SetPriority(MANAGER_TIMER_IRQn, 2, 1);
//
HAL_NVIC_EnableIRQ(MANAGER_TIMER_IRQn);
/* use the internal clock */
sClockSourceConfig
.
ClockSource
=
TIM_CLOCKSOURCE_INTERNAL
;
HAL_TIM_ConfigClockSource
(
&
MANAGER_TIM_Handle
,
&
sClockSourceConfig
);
HAL_TIM_OC_Init
(
&
MANAGER_TIM_Handle
);
//
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
//
HAL_TIM_ConfigClockSource(&MANAGER_TIM_Handle, &sClockSourceConfig);
//
HAL_TIM_OC_Init(&MANAGER_TIM_Handle);
/* disable master/slave mode */
sMasterConfig
.
MasterOutputTrigger
=
TIM_TRGO_RESET
;
sMasterConfig
.
MasterSlaveMode
=
TIM_MASTERSLAVEMODE_DISABLE
;
HAL_TIMEx_MasterConfigSynchronization
(
&
MANAGER_TIM_Handle
,
&
sMasterConfig
);
//
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
//
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
//
HAL_TIMEx_MasterConfigSynchronization(&MANAGER_TIM_Handle, &sMasterConfig);
/* configure ouptut counter channel 4 */
manager_motion_period
=
(
period_us
*
1000000
)
>>
16
;
manager_motion_period_us
=
period_us
;
//
manager_motion_period=(period_us*1000000)>>16;
//
manager_motion_period_us=period_us;
/* initialize balance parameters */
for
(
i
=
0
;
i
<
MANAGER_MAX_NUM_SERVOS
;
i
++
)
manager_balance_offset
[
i
]
=
0
;
manager_balance_enabled
=
0x00
;
//
for(i=0;i<MANAGER_MAX_NUM_SERVOS;i++)
//
manager_balance_offset[i]=0;
//
manager_balance_enabled=0x00;
/* initialize action module */
action_init
(
period_us
);
gpio_blink_led
(
RXD_LED
,
1000
);
// action_init(period_us);
}
uint16_t
manager_get_period
(
void
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment