Hotfix for X12S ADC driver
This commit is contained in:
@@ -115,7 +115,7 @@ static bool adcSingleRead()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool adcRead()
|
||||
bool adcRead() __attribute__((weak))
|
||||
{
|
||||
uint16_t temp[NUM_ANALOGS] = { 0 };
|
||||
|
||||
|
||||
@@ -52,8 +52,10 @@ struct etx_hal_adc_driver_t {
|
||||
};
|
||||
|
||||
bool adcInit(const etx_hal_adc_driver_t* driver);
|
||||
//void adcDeInit();
|
||||
// void adcDeInit();
|
||||
|
||||
// Declare adcRead() weak so it can be re-declared
|
||||
bool adcRead() __attribute__((weak));
|
||||
|
||||
bool adcRead();
|
||||
uint16_t getRTCBatteryVoltage();
|
||||
uint16_t getAnalogValue(uint8_t index);
|
||||
|
||||
@@ -21,7 +21,14 @@
|
||||
#include "opentx.h"
|
||||
|
||||
#include "hal/adc_driver.h"
|
||||
#include "../common/arm/stm32/stm32_hal_adc.h"
|
||||
|
||||
#if !defined(PCBX12S)
|
||||
#include "../common/arm/stm32/stm32_hal_adc.h"
|
||||
#define ADC_DRIVER stm32_hal_adc_driver
|
||||
#else
|
||||
#include "x12_adc_driver.h"
|
||||
#define ADC_DRIVER x12s_adc_driver
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
@@ -200,7 +207,7 @@ void boardInit()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!adcInit(&stm32_hal_adc_driver))
|
||||
if (!adcInit(&ADC_DRIVER))
|
||||
TRACE("adcInit failed");
|
||||
|
||||
lcdInit();
|
||||
|
||||
@@ -100,7 +100,7 @@ static void ADS7952_Init()
|
||||
ADC_CS_HIGH();
|
||||
}
|
||||
|
||||
void adcInit()
|
||||
static bool x12s_adc_init()
|
||||
{
|
||||
ADS7952_Init();
|
||||
|
||||
@@ -227,6 +227,8 @@ bool adcOnChipReadFinished()
|
||||
return (ADC_DMA->LISR & DMA_LISR_TCIF0);
|
||||
}
|
||||
|
||||
// Re-declare adcRead()
|
||||
// (takes precedence over hal/adc_driver.cpp)
|
||||
void adcRead()
|
||||
{
|
||||
uint16_t temp[NUM_ANALOGS-MOUSE1] = { 0 };
|
||||
@@ -279,3 +281,14 @@ uint16_t getAnalogValue(uint8_t index)
|
||||
return adcValues[index];
|
||||
}
|
||||
#endif // #if !defined(SIMU)
|
||||
|
||||
//TODO: implement these based on stm32_hal_adc.cpp
|
||||
//static bool x12s_adc_init();
|
||||
//static bool x12s_adc_start_read();
|
||||
//static void x12s_adc_wait_completion();
|
||||
|
||||
const etx_hal_adc_driver_t x12s_adc_driver = {
|
||||
x12s_adc_init,
|
||||
nullptr,//x12s_adc_start_read,
|
||||
nullptr,//x12s_adc_wait_completion
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTx
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hal/adc_driver.h"
|
||||
|
||||
extern const etx_hal_adc_driver_t x12s_adc_driver;
|
||||
Reference in New Issue
Block a user