mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-23 09:08:30 -04:00
ArduCopter: Add AP_HAL_SMACCM support.
- Added default configuration to "config.h". - Added main function to run under FreeRTOS with HWF4.
This commit is contained in:
parent
ab37f833db
commit
7827a4a54a
@ -67,6 +67,7 @@
|
||||
#include <AP_HAL.h>
|
||||
#include <AP_HAL_AVR.h>
|
||||
#include <AP_HAL_AVR_SITL.h>
|
||||
#include <AP_HAL_SMACCM.h>
|
||||
#include <AP_HAL_PX4.h>
|
||||
#include <AP_HAL_Empty.h>
|
||||
|
||||
|
@ -80,6 +80,16 @@
|
||||
# define MAG_ORIENTATION AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD
|
||||
# define CONFIG_SONAR_SOURCE SONAR_SOURCE_ANALOG_PIN
|
||||
# define MAGNETOMETER ENABLED
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_SMACCM
|
||||
# define CONFIG_IMU_TYPE CONFIG_IMU_MPU6000
|
||||
# define CONFIG_BARO AP_BARO_MS5611
|
||||
# define CONFIG_MS5611_SERIAL AP_BARO_MS5611_I2C
|
||||
# define CONFIG_ADC DISABLED
|
||||
# define CONFIG_PUSHBUTTON DISABLED
|
||||
# define CONFIG_RELAY DISABLED
|
||||
# define MAG_ORIENTATION AP_COMPASS_COMPONENTS_DOWN_PINS_BACK
|
||||
# define CONFIG_SONAR_SOURCE SONAR_SOURCE_ANALOG_PIN
|
||||
# define MAGNETOMETER ENABLED
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -201,6 +211,19 @@
|
||||
# define USB_MUX_PIN -1
|
||||
# define BATTERY_VOLT_PIN -1
|
||||
# define BATTERY_CURR_PIN -1
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_SMACCM
|
||||
// XXX these are just copied, may not make sense
|
||||
# define A_LED_PIN 27
|
||||
# define B_LED_PIN 26
|
||||
# define C_LED_PIN 25
|
||||
# define LED_ON LOW
|
||||
# define LED_OFF HIGH
|
||||
# define SLIDE_SWITCH_PIN (-1)
|
||||
# define PUSHBUTTON_PIN (-1)
|
||||
# define CLI_SLIDER_ENABLED DISABLED
|
||||
# define USB_MUX_PIN -1
|
||||
# define BATTERY_VOLT_PIN -1
|
||||
# define BATTERY_CURR_PIN -1
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -223,7 +246,7 @@
|
||||
#define COPTER_LED_6 AN9 // Motor LED
|
||||
#define COPTER_LED_7 AN10 // Motor LED
|
||||
#define COPTER_LED_8 AN11 // Motor LED
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL || CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL || CONFIG_HAL_BOARD == HAL_BOARD_PX4 || HAL_BOARD_SMACCM
|
||||
#define COPTER_LED_1 AN8 // Motor or Aux LED
|
||||
#define COPTER_LED_2 AN9 // Motor LED
|
||||
#define COPTER_LED_3 AN10 // Motor or GPS LED
|
||||
|
29
libraries/AP_HAL_SMACCM/AP_HAL_SMACCM_Main.cpp
Normal file
29
libraries/AP_HAL_SMACCM/AP_HAL_SMACCM_Main.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
#include <AP_HAL_SMACCM.h>
|
||||
#include <AP_HAL_SMACCM_Main.h>
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
|
||||
static xTaskHandle g_main_task;
|
||||
|
||||
// These must be defined in the main ".pde" file.
|
||||
extern const AP_HAL::HAL& hal;
|
||||
extern void setup();
|
||||
extern void loop();
|
||||
|
||||
static void main_task(void *arg)
|
||||
{
|
||||
hal.init(0, NULL);
|
||||
setup();
|
||||
for (;;)
|
||||
loop();
|
||||
}
|
||||
|
||||
void SMACCM::hal_main()
|
||||
{
|
||||
xTaskCreate(main_task, (signed char *)"main", 1024, NULL, 0, &g_main_task);
|
||||
vTaskStartScheduler();
|
||||
|
||||
for (;;)
|
||||
;
|
||||
}
|
@ -4,14 +4,19 @@
|
||||
#define __AP_HAL_SMACCM_MAIN_H__
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SMACCM
|
||||
#define AP_HAL_MAIN() extern "C" {\
|
||||
int main (void) {\
|
||||
hal.init(0, NULL); \
|
||||
setup();\
|
||||
for(;;) loop();\
|
||||
return 0;\
|
||||
}\
|
||||
}
|
||||
#endif // HAL_BOARD_SMACCM
|
||||
|
||||
namespace SMACCM
|
||||
{
|
||||
void hal_main();
|
||||
}
|
||||
|
||||
#define AP_HAL_MAIN() \
|
||||
extern "C" int main (void) \
|
||||
{ \
|
||||
SMACCM::hal_main(); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#endif // HAL_BOARD_SMACCM */
|
||||
|
||||
#endif // __AP_HAL_SMACCM_MAIN_H__
|
||||
|
Loading…
Reference in New Issue
Block a user