mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-30 12:38:33 -04:00
HAL_ChibiOS: enable analog input on IOMCU
This commit is contained in:
parent
b45b8ff703
commit
af4340d1d1
@ -19,7 +19,7 @@
|
|||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include <AP_Common/Semaphore.h>
|
#include <AP_Common/Semaphore.h>
|
||||||
|
|
||||||
#if HAL_USE_ADC == TRUE
|
#if HAL_USE_ADC == TRUE && !defined(HAL_DISABLE_ADC_DRIVER)
|
||||||
|
|
||||||
#include "AnalogIn.h"
|
#include "AnalogIn.h"
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
// number of samples on each channel to gather on each DMA callback
|
// number of samples on each channel to gather on each DMA callback
|
||||||
#define ADC_DMA_BUF_DEPTH 8
|
#define ADC_DMA_BUF_DEPTH 8
|
||||||
|
|
||||||
#if HAL_USE_ADC == TRUE
|
#if HAL_USE_ADC == TRUE && !defined(HAL_DISABLE_ADC_DRIVER)
|
||||||
|
|
||||||
class ChibiOS::AnalogSource : public AP_HAL::AnalogSource {
|
class ChibiOS::AnalogSource : public AP_HAL::AnalogSource {
|
||||||
public:
|
public:
|
||||||
|
@ -59,7 +59,7 @@ static ChibiOS::SPIDeviceManager spiDeviceManager;
|
|||||||
static Empty::SPIDeviceManager spiDeviceManager;
|
static Empty::SPIDeviceManager spiDeviceManager;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAL_USE_ADC == TRUE
|
#if HAL_USE_ADC == TRUE && !defined(HAL_DISABLE_ADC_DRIVER)
|
||||||
static ChibiOS::AnalogIn analogIn;
|
static ChibiOS::AnalogIn analogIn;
|
||||||
#else
|
#else
|
||||||
static Empty::AnalogIn analogIn;
|
static Empty::AnalogIn analogIn;
|
||||||
|
@ -268,7 +268,7 @@ void Scheduler::_run_timers()
|
|||||||
_failsafe();
|
_failsafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAL_USE_ADC == TRUE
|
#if HAL_USE_ADC == TRUE && !defined(HAL_DISABLE_ADC_DRIVER)
|
||||||
// process analog input
|
// process analog input
|
||||||
((AnalogIn *)hal.analogin)->_timer_tick();
|
((AnalogIn *)hal.analogin)->_timer_tick();
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,6 +53,15 @@ PB13 SAFETY_LED OUTPUT HIGH
|
|||||||
|
|
||||||
PA8 INPUT PULLUP # RC Input PPM
|
PA8 INPUT PULLUP # RC Input PPM
|
||||||
|
|
||||||
|
# analog inputs
|
||||||
|
PA4 VSERVO ADC1
|
||||||
|
PA5 VRSSI ADC1
|
||||||
|
define HAL_ADC_VSERVO_CHAN ADC_CHANNEL_IN4
|
||||||
|
define HAL_ADC_VRSSI_CHAN ADC_CHANNEL_IN5
|
||||||
|
define HAL_USE_ADC TRUE
|
||||||
|
define STM32_ADC_USE_ADC1 TRUE
|
||||||
|
define HAL_DISABLE_ADC_DRIVER TRUE
|
||||||
|
|
||||||
#Manually define ICU settings
|
#Manually define ICU settings
|
||||||
define HAL_USE_ICU TRUE
|
define HAL_USE_ICU TRUE
|
||||||
define STM32_ICU_USE_TIM1 TRUE
|
define STM32_ICU_USE_TIM1 TRUE
|
||||||
@ -88,7 +97,6 @@ define HAL_NO_RCIN_THREAD
|
|||||||
#defined to turn off undef warnings
|
#defined to turn off undef warnings
|
||||||
define __FPU_PRESENT 0
|
define __FPU_PRESENT 0
|
||||||
|
|
||||||
define HAL_USE_ADC FALSE
|
|
||||||
define HAL_USE_RTC FALSE
|
define HAL_USE_RTC FALSE
|
||||||
define HAL_NO_FLASH_SUPPORT TRUE
|
define HAL_NO_FLASH_SUPPORT TRUE
|
||||||
define HAL_NO_UARTDRIVER TRUE
|
define HAL_NO_UARTDRIVER TRUE
|
||||||
|
@ -32,3 +32,24 @@ mcu = {
|
|||||||
'RAM_SIZE_KB' : 8,
|
'RAM_SIZE_KB' : 8,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ADC1_map = {
|
||||||
|
# format is PIN : ADC1_CHAN
|
||||||
|
"PA0" : 0,
|
||||||
|
"PA1" : 1,
|
||||||
|
"PA2" : 2,
|
||||||
|
"PA3" : 3,
|
||||||
|
"PA4" : 4,
|
||||||
|
"PA5" : 5,
|
||||||
|
"PA6" : 6,
|
||||||
|
"PA7" : 7,
|
||||||
|
"PB0" : 8,
|
||||||
|
"PB1" : 9,
|
||||||
|
"PC0" : 10,
|
||||||
|
"PC1" : 11,
|
||||||
|
"PC2" : 12,
|
||||||
|
"PC3" : 13,
|
||||||
|
"PC4" : 14,
|
||||||
|
"PC5" : 15,
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user