Commit c3c8de0c authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Changed the main include. Added the USE_HAL_DRIVER macro.

parent 6e6aea46
......@@ -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
......
......@@ -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];
......
#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
......@@ -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;
......
#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
#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
......@@ -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"
......
#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
......@@ -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);
......
......@@ -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****/
......@@ -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;
......
......@@ -5,7 +5,7 @@
extern "C" {
#endif
#include "stm32f4xx_hal.h"
#include "stm32f4xx.h"
typedef enum {
R_SHOULDER_PITCH = 1,
......
......@@ -5,7 +5,7 @@
extern "C" {
#endif
#include "stm32f4xx_hal.h"
#include "stm32f4xx.h"
#define MAX_PAGES 256
#define PAGE_MAX_NUM_SERVOS 31
......
......@@ -5,7 +5,7 @@
extern "C" {
#endif
#include "stm32f4xx_hal.h"
#include "stm32f4xx.h"
// public functions
void zigbee_init(void);
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment