Removing trailing whitespaces
This commit is contained in:
parent
ed87b928c5
commit
f111058472
33 changed files with 237 additions and 237 deletions
|
@ -22,12 +22,12 @@ static uint16_t adcConfig[NUM_ADC_USERS];
|
|||
static boolean adcCalibrated;
|
||||
static int16_t Nvss;
|
||||
static int16_t Nvdd;
|
||||
/* Modified the original ADC driver for enabling the ADC extended range mode required for
|
||||
/* Modified the original ADC driver for enabling the ADC extended range mode required for
|
||||
supporting the STLM20 temperature sensor.
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
(see STM32W108 errata). As consequence, it is not reccomended to use this ADC driver for getting
|
||||
the temperature values
|
||||
the temperature values
|
||||
*/
|
||||
#ifdef ENABLE_ADC_EXTENDED_RANGE_BROKEN
|
||||
static int16_t Nvref;
|
||||
|
@ -87,7 +87,7 @@ void halAdcIsr(void)
|
|||
if (BIT(i) & adcPendingRequests) {
|
||||
adcPendingConversion = i; // set pending conversion
|
||||
adcPendingRequests ^= BIT(i); //clear request: conversion is starting
|
||||
ADC_CFG = adcConfig[i];
|
||||
ADC_CFG = adcConfig[i];
|
||||
break; //conversion started, so we're done here (only one at a time)
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void halAdcIsr(void)
|
|||
ADCUser startNextConversion()
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
|
||||
ATOMIC (
|
||||
// start the next requested conversion if any
|
||||
if (adcPendingRequests && !(ADC_CFG & ADC_ENABLE)) {
|
||||
|
@ -160,7 +160,7 @@ StStatus halStartAdcConversion(ADCUser id,
|
|||
ADCChannelType channel,
|
||||
ADCRateType rate)
|
||||
{
|
||||
|
||||
|
||||
if(reference != ADC_REF_INT)
|
||||
return ST_ERR_FATAL;
|
||||
|
||||
|
@ -191,7 +191,7 @@ StStatus halRequestAdcData(ADCUser id, uint16_t *value)
|
|||
//Both the ADC interrupt and the global interrupt need to be enabled,
|
||||
//otherwise the ADC ISR cannot be serviced.
|
||||
boolean intsAreOff = ( INTERRUPTS_ARE_OFF()
|
||||
|| !(INT_CFGSET & INT_ADC)
|
||||
|| !(INT_CFGSET & INT_ADC)
|
||||
|| !(INT_ADCCFG & INT_ADCULDFULL) );
|
||||
StStatus stat;
|
||||
|
||||
|
@ -199,7 +199,7 @@ StStatus halRequestAdcData(ADCUser id, uint16_t *value)
|
|||
// If interupts are disabled but the flag is set,
|
||||
// manually run the isr...
|
||||
//FIXME -= is this valid???
|
||||
if( intsAreOff
|
||||
if( intsAreOff
|
||||
&& ( (INT_CFGSET & INT_ADC) && (INT_ADCCFG & INT_ADCULDFULL) )) {
|
||||
halAdcIsr();
|
||||
}
|
||||
|
@ -235,21 +235,21 @@ StStatus halReadAdcBlocking(ADCUser id, uint16_t *value)
|
|||
StStatus halAdcCalibrate(ADCUser id)
|
||||
{
|
||||
StStatus stat;
|
||||
/* Modified the original ADC driver for enabling the ADC extended range mode required for
|
||||
/* Modified the original ADC driver for enabling the ADC extended range mode required for
|
||||
supporting the STLM20 temperature sensor.
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
(see STM32W108 errata). As consequence, it is not reccomended to use this ADC driver for getting
|
||||
the temperature values
|
||||
the temperature values
|
||||
*/
|
||||
#ifdef ENABLE_ADC_EXTENDED_RANGE_BROKEN
|
||||
if(halAdcGetRange()){
|
||||
|
||||
|
||||
halStartAdcConversion(id,
|
||||
ADC_REF_INT,
|
||||
ADC_SOURCE_VREF_VREF2,
|
||||
ADC_CONVERSION_TIME_US_4096);
|
||||
|
||||
|
||||
stat = halReadAdcBlocking(id, (uint16_t *)(&Nvref));
|
||||
if (stat == ST_ADC_CONVERSION_DONE) {
|
||||
halStartAdcConversion(id,
|
||||
|
@ -264,9 +264,9 @@ StStatus halAdcCalibrate(ADCUser id)
|
|||
adcCalibrated = FALSE;
|
||||
stat = ST_ERR_FATAL;
|
||||
}
|
||||
return stat;
|
||||
|
||||
}
|
||||
return stat;
|
||||
|
||||
}
|
||||
#endif /* ENABLE_ADC_EXTENDED_RANGE_BROKEN */
|
||||
halStartAdcConversion(id,
|
||||
ADC_REF_INT,
|
||||
|
@ -294,7 +294,7 @@ StStatus halAdcCalibrate(ADCUser id)
|
|||
// to convert to 100uV units.
|
||||
// FIXME: support external Vref
|
||||
// use #define of Vref, ignore VDD_PADSA
|
||||
// FIXME: support high voltage range
|
||||
// FIXME: support high voltage range
|
||||
// use Vref-Vref/2 to calibrate
|
||||
// FIXME: check for mfg token specifying measured VDD_PADSA
|
||||
int16_t halConvertValueToVolts(uint16_t value)
|
||||
|
@ -302,29 +302,29 @@ int16_t halConvertValueToVolts(uint16_t value)
|
|||
int32_t N;
|
||||
int16_t V;
|
||||
int32_t nvalue;
|
||||
|
||||
|
||||
if (!adcCalibrated) {
|
||||
halAdcCalibrate(ADC_USER_LQI);
|
||||
}
|
||||
if (adcCalibrated) {
|
||||
/* Modified the original ADC driver for enabling the ADC extended range mode required for
|
||||
/* Modified the original ADC driver for enabling the ADC extended range mode required for
|
||||
supporting the STLM20 temperature sensor.
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
(see STM32W108 errata). As consequence, it is not reccomended to use this ADC driver for getting
|
||||
the temperature values
|
||||
the temperature values
|
||||
*/
|
||||
#ifdef ENABLE_ADC_EXTENDED_RANGE_BROKEN
|
||||
if(halAdcGetRange()){ // High range.
|
||||
|
||||
|
||||
N = (((int32_t)value + Nvref - 2*Nvref2) << 16)/(2*(Nvref-Nvref2));
|
||||
// Calculate voltage with: V = (N * VREF) / (2^16) where VDD = 1.2 volts
|
||||
// Mutiplying by 1.2*10000 makes the result of this equation 100 uVolts
|
||||
V = (int16_t)((N*12000L) >> 16);
|
||||
if (V > 21000) { // VDD_PADS ?
|
||||
V = 21000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
#endif /* ENABLE_ADC_EXTENDED_RANGE_BROKEN */
|
||||
|
@ -340,9 +340,9 @@ int16_t halConvertValueToVolts(uint16_t value)
|
|||
if (V > 12000) {
|
||||
V = 12000;
|
||||
}
|
||||
#ifdef ENABLE_ADC_EXTENDED_RANGE_BROKEN
|
||||
#ifdef ENABLE_ADC_EXTENDED_RANGE_BROKEN
|
||||
}
|
||||
#endif /* ENABLE_ADC_EXTENDED_RANGE_BROKEN */
|
||||
#endif /* ENABLE_ADC_EXTENDED_RANGE_BROKEN */
|
||||
} else {
|
||||
V = -32768;
|
||||
}
|
||||
|
@ -355,27 +355,27 @@ uint8_t halGetADCChannelFromGPIO(uint32_t io)
|
|||
{
|
||||
case PORTB_PIN(5):
|
||||
return ADC_MUX_ADC0;
|
||||
|
||||
|
||||
case PORTB_PIN(6):
|
||||
return ADC_MUX_ADC1;
|
||||
|
||||
|
||||
case PORTB_PIN(7):
|
||||
return ADC_MUX_ADC2;
|
||||
|
||||
|
||||
case PORTC_PIN(1):
|
||||
return ADC_MUX_ADC3;
|
||||
|
||||
|
||||
case PORTA_PIN(4):
|
||||
return ADC_MUX_ADC4;
|
||||
|
||||
|
||||
case PORTA_PIN(5):
|
||||
return ADC_MUX_ADC5;
|
||||
|
||||
|
||||
case PORTB_PIN(0):
|
||||
return ADC_MUX_VREF;
|
||||
|
||||
|
||||
default :
|
||||
return 0x0F; // Invalid analogue source
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** @file board.c
|
||||
* @brief Board file x STM32W108 Kits boards
|
||||
/** @file cpu/stm32w108/hal/micro/cortexm3/board.c
|
||||
* @brief Board file x STM32W108 Kits boards
|
||||
*
|
||||
* This file implements a software layer to support all the ST kits boards
|
||||
* and deal with the difference in leds, buttons and sensors connected to the board.
|
||||
|
@ -138,22 +138,22 @@ const MemsResourceType memsSensor = {
|
|||
|
||||
const BoardIOType ioMB851A = {
|
||||
LedsMB851A,
|
||||
ButtonsMB851A,
|
||||
ButtonsMB851A,
|
||||
};
|
||||
|
||||
const BoardIOType ioMB954A = {
|
||||
LedsMB954A,
|
||||
ButtonsMB954A,
|
||||
ButtonsMB954A,
|
||||
};
|
||||
|
||||
const BoardIOType ioMB950A = {
|
||||
LedsMB954A,
|
||||
ButtonsMB950A,
|
||||
ButtonsMB950A,
|
||||
};
|
||||
|
||||
const BoardIOType ioMB951A = {
|
||||
LedsMB954A,
|
||||
ButtonsMB951A,
|
||||
ButtonsMB951A,
|
||||
};
|
||||
|
||||
const BoardResourcesType MB851A = {
|
||||
|
@ -264,7 +264,7 @@ void halBoardInit(void)
|
|||
i--;
|
||||
}
|
||||
|
||||
for (i = 0; i < (sizeof(boardList)/4) ; i++)
|
||||
for (i = 0; i < (sizeof(boardList)/4) ; i++)
|
||||
if (strcmp(boardName, (boardList[i])->name) == 0) {
|
||||
boardDescription = (BoardResourcesType *) boardList[i];
|
||||
break;
|
||||
|
|
|
@ -30,9 +30,9 @@ static uint8_t i2c_MEMS_Read (t_mems_data *mems_data);
|
|||
|
||||
/* Functions -----------------------------------------------------------------*/
|
||||
uint8_t mems_Init(void)
|
||||
{
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
|
||||
|
||||
// GPIO assignments
|
||||
// PA1: SC2SDA (Serial Data)
|
||||
// PA2: SC2SCL (Serial Clock)
|
||||
|
@ -43,27 +43,27 @@ uint8_t mems_Init(void)
|
|||
SC2_MODE = SC2_MODE_I2C;
|
||||
GPIO_PACFGL &= 0xFFFFF00F;
|
||||
GPIO_PACFGL |= 0x00000DD0;
|
||||
|
||||
|
||||
SC2_RATELIN = 14; // generates standard 100kbps or 400kbps
|
||||
SC2_RATEEXP = 1; // 3 yields 100kbps; 1 yields 400kbps
|
||||
SC2_TWICTRL1 = 0; // start from a clean state
|
||||
SC2_TWICTRL2 = 0; // start from a clean state
|
||||
|
||||
SC2_TWICTRL2 = 0; // start from a clean state
|
||||
|
||||
ret = i2c_MEMS_Init();
|
||||
|
||||
//Add later if really needed
|
||||
#ifdef ST_DBG
|
||||
//Add later if really needed
|
||||
#ifdef ST_DBG
|
||||
if (!ret)
|
||||
i2c_DeInit(MEMS_I2C);
|
||||
#endif
|
||||
|
||||
|
||||
return ret;
|
||||
}/* end mems_Init */
|
||||
|
||||
uint8_t mems_GetValue(t_mems_data *mems_data)
|
||||
{
|
||||
uint8_t i;
|
||||
i = i2c_MEMS_Read(mems_data);
|
||||
uint8_t i;
|
||||
i = i2c_MEMS_Read(mems_data);
|
||||
return i;
|
||||
}/* end mems_GetValue() */
|
||||
|
||||
|
@ -72,7 +72,7 @@ uint8_t mems_GetValue(t_mems_data *mems_data)
|
|||
|
||||
/*******************************************************************************
|
||||
* Function Name : i2c_Send_Frame
|
||||
* Description : It sends I2C frame
|
||||
* Description : It sends I2C frame
|
||||
* Input : DeviceAddress is the destination device address
|
||||
* pBUffer is the buffer data
|
||||
* NoOfBytes is the number of bytes
|
||||
|
@ -85,24 +85,24 @@ static uint8_t i2c_Send_Frame (uint8_t DeviceAddress, uint8_t *pBuffer, uint8_t
|
|||
|
||||
SC2_TWICTRL1 |= SC_TWISTART; // send start
|
||||
WAIT_CMD_FIN();
|
||||
|
||||
|
||||
SEND_BYTE(DeviceAddress); // send the address low byte
|
||||
WAIT_TX_FIN();
|
||||
|
||||
|
||||
// loop sending the data
|
||||
for (i=0; i<NoOfBytes; i++) {
|
||||
halInternalResetWatchDog();
|
||||
|
||||
|
||||
data = *(pBuffer+i);
|
||||
|
||||
|
||||
SEND_BYTE(data);
|
||||
|
||||
|
||||
WAIT_TX_FIN();
|
||||
}
|
||||
|
||||
SC2_TWICTRL1 |= SC_TWISTOP;
|
||||
WAIT_CMD_FIN();
|
||||
|
||||
|
||||
return SUCCESS;
|
||||
}/* end i2c_Send_Frame() */
|
||||
|
||||
|
@ -118,25 +118,25 @@ static uint8_t i2c_Send_Frame (uint8_t DeviceAddress, uint8_t *pBuffer, uint8_t
|
|||
static uint8_t i2c_Receive_Frame (uint8_t slave_addr, uint8_t reg_addr, uint8_t *pBuffer, uint8_t NoOfBytes)
|
||||
{
|
||||
uint8_t i, addr = reg_addr;
|
||||
|
||||
|
||||
if (NoOfBytes > 1)
|
||||
addr += REPETIR;
|
||||
|
||||
|
||||
SC2_TWICTRL1 |= SC_TWISTART; // send start
|
||||
WAIT_CMD_FIN();
|
||||
|
||||
|
||||
SEND_BYTE(slave_addr | 0x00); // send the address low byte
|
||||
WAIT_TX_FIN();
|
||||
|
||||
|
||||
SEND_BYTE(addr);
|
||||
WAIT_TX_FIN();
|
||||
|
||||
SC2_TWICTRL1 |= SC_TWISTART; // send start
|
||||
WAIT_CMD_FIN();
|
||||
|
||||
|
||||
SEND_BYTE(slave_addr | 0x01); // send the address low byte
|
||||
WAIT_TX_FIN();
|
||||
|
||||
|
||||
// loop receiving the data
|
||||
for (i=0;i<NoOfBytes;i++){
|
||||
halInternalResetWatchDog();
|
||||
|
@ -152,7 +152,7 @@ static uint8_t i2c_Receive_Frame (uint8_t slave_addr, uint8_t reg_addr, uint8_t
|
|||
}
|
||||
|
||||
SC2_TWICTRL1 |= SC_TWISTOP; // send STOP
|
||||
WAIT_CMD_FIN();
|
||||
WAIT_CMD_FIN();
|
||||
|
||||
return SUCCESS;
|
||||
}/* end i2c_Receive_Frame() */
|
||||
|
@ -171,7 +171,7 @@ static uint8_t i2c_Receive_Frame (uint8_t slave_addr, uint8_t reg_addr, uint8_t
|
|||
uint8_t i2c_write_reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t reg_value)
|
||||
{
|
||||
uint8_t i2c_buffer[2];
|
||||
|
||||
|
||||
i2c_buffer[0] = reg_addr;
|
||||
i2c_buffer[1] = reg_value;
|
||||
|
||||
|
@ -195,7 +195,7 @@ uint8_t i2c_read_reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t *pBuffer, ui
|
|||
|
||||
/*******************************************************************************
|
||||
* Function Name : i2c_MEMS_Init
|
||||
* Description : It performs basic MEMS register writes for initialization
|
||||
* Description : It performs basic MEMS register writes for initialization
|
||||
* purposes
|
||||
* Input : None
|
||||
* Output : None
|
||||
|
@ -234,7 +234,7 @@ static uint8_t i2c_MEMS_Read (t_mems_data *mems_data)
|
|||
if (i2c_buffer[0] & (1 << 3))
|
||||
break;
|
||||
}
|
||||
i = i2c_read_reg (kLIS3L02DQ_SLAVE_ADDR, OUTX_L, i2c_buffer, 8);
|
||||
i = i2c_read_reg (kLIS3L02DQ_SLAVE_ADDR, OUTX_L, i2c_buffer, 8);
|
||||
|
||||
mems_data->outx_h = i2c_buffer[0];
|
||||
mems_data->outx_l = i2c_buffer[1];
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*
|
||||
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MFG_TOKEN_H_
|
||||
#define MFG_TOKEN_H_
|
||||
|
||||
|
||||
|
||||
// The manufacturing tokens live in the Info Blocks, while all other tokens
|
||||
// live in the Simulated EEPROM. This requires the token names to be defined
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
|
||||
/**
|
||||
* @brief Resets the watchdog timer. This function is pointed
|
||||
* to by the macro ::halResetWatchdog().
|
||||
* @warning Be very careful when using this as you can easily get into an
|
||||
* to by the macro ::halResetWatchdog().
|
||||
* @warning Be very careful when using this as you can easily get into an
|
||||
* infinite loop.
|
||||
*/
|
||||
void halInternalResetWatchDog( void );
|
||||
|
@ -162,13 +162,13 @@ void halInternalSearchForBiasTrim(void);
|
|||
* hardware peripherals. This function works by simply adding another
|
||||
* layer on top of halCommonDelayMicroseconds().
|
||||
*
|
||||
* @param ms The specified time, in milliseconds.
|
||||
* @param ms The specified time, in milliseconds.
|
||||
*/
|
||||
void halCommonDelayMilliseconds(uint16_t ms);
|
||||
|
||||
|
||||
/** @brief Puts the microcontroller to sleep in a specified mode, allows
|
||||
* the GPIO wake sources to be determined at runtime. This function
|
||||
* the GPIO wake sources to be determined at runtime. This function
|
||||
* requires the GPIO wake sources to be defined at compile time in the board
|
||||
* file.
|
||||
*
|
||||
|
@ -180,7 +180,7 @@ void halCommonDelayMilliseconds(uint16_t ms);
|
|||
* the chip from deep sleep. A high bit in the mask will enable waking
|
||||
* the chip if the corresponding GPIO changes state. bit0 is PA0, bit1 is
|
||||
* PA1, bit8 is PB0, bit16 is PCO, bit23 is PC7, bits[31:24] are ignored.
|
||||
*
|
||||
*
|
||||
* @sa ::SleepModes
|
||||
*/
|
||||
void halSleepWithOptions(SleepModes sleepMode, uint32_t gpioWakeBitMask);
|
||||
|
@ -209,12 +209,12 @@ void halSleepWithOptions(SleepModes sleepMode, uint32_t gpioWakeBitMask);
|
|||
* micro should be placed into ::SLEEPMODE_WAKETIMER. When the function returns,
|
||||
* this parameter provides the amount of time remaining out of the original
|
||||
* sleep time request (normally the return value will be 0).
|
||||
*
|
||||
*
|
||||
* @param gpioWakeBitMask A bit mask of the GPIO that are allowed to wake
|
||||
* the chip from deep sleep. A high bit in the mask will enable waking
|
||||
* the chip if the corresponding GPIO changes state. bit0 is PA0, bit1 is
|
||||
* PA1, bit8 is PB0, bit16 is PCO, bit23 is PC7, bits[31:24] are ignored.
|
||||
*
|
||||
*
|
||||
* @return An StStatus value indicating the success or
|
||||
* failure of the command.
|
||||
*/
|
||||
|
@ -248,7 +248,7 @@ void halInternalSleep(SleepModes sleepMode);
|
|||
* - [25] = PWRUP_SLEEPTMRCOMPB
|
||||
* - [24] = PWRUP_SLEEPTMRCOMPA
|
||||
* - [23:0] = corresponding GPIO activity
|
||||
*
|
||||
*
|
||||
* WakeInfoValid means that ::halSleepWithOptions (::halInternalSleep) has been called
|
||||
* at least once. Since the power on state clears the wake event info,
|
||||
* this bit says the sleep code has been called since power on.
|
||||
|
@ -260,7 +260,7 @@ void halInternalSleep(SleepModes sleepMode);
|
|||
* signal is set). The net affect of skipping sleep is the Low Voltage
|
||||
* domain never goes through a power/reset cycle.
|
||||
*
|
||||
* @return The events that caused the last wake from sleep.
|
||||
* @return The events that caused the last wake from sleep.
|
||||
*/
|
||||
uint32_t halGetWakeInfo(void);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* See hal/micro/cortexm3/stm32w108/board.h for source code.
|
||||
*@{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Define the number of LEDs in the specific board revision
|
||||
*/
|
||||
|
@ -134,7 +134,7 @@ typedef struct BoardIOStruct {
|
|||
/** Pointer to LED resources */
|
||||
const LedResourceType *leds;
|
||||
/** Pointer to button resources */
|
||||
const ButtonResourceType *buttons;
|
||||
const ButtonResourceType *buttons;
|
||||
} BoardIOType;
|
||||
|
||||
/**
|
||||
|
@ -227,7 +227,7 @@ extern BoardResourcesType const *boardDescription;
|
|||
|
||||
/** @brief Return pointer to board description structure
|
||||
*
|
||||
*
|
||||
*
|
||||
* @return Pointer to board description structure
|
||||
*/
|
||||
BoardResourcesType const *halBoardGetDescription(void);
|
||||
|
|
|
@ -17,12 +17,12 @@ void temperatureSensor_Init(void)
|
|||
halGpioConfig(TEMPERATURE_SENSOR_GPIO,GPIOCFG_ANALOG);
|
||||
/* Init ADC driver */
|
||||
halInternalInitAdc();
|
||||
|
||||
|
||||
/*
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
(see STM32W108 errata). As consequence, it is not reccomended to use this ADC driver for getting
|
||||
the temperature values.
|
||||
the temperature values.
|
||||
*/
|
||||
#ifdef ENABLE_ADC_EXTENDED_RANGE_BROKEN
|
||||
halAdcSetRange(TRUE);
|
||||
|
@ -35,18 +35,18 @@ uint32_t temperatureSensor_GetValue(void)
|
|||
static int16_t volts;
|
||||
|
||||
/*
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
NOTE:
|
||||
The ADC extended range is inaccurate due to the high voltage mode bug of the general purpose ADC
|
||||
(see STM32W108 errata). As consequence, it is not reccomended to use this ADC driver for getting
|
||||
the temperature values.
|
||||
the temperature values.
|
||||
*/
|
||||
halStartAdcConversion(ADC_USER_APP, ADC_REF_INT, ADC_SOURCE(halGetADCChannelFromGPIO(TEMPERATURE_SENSOR_GPIO),ADC_MUX_VREF2), ADC_CONVERSION_TIME_US_4096);
|
||||
|
||||
|
||||
halReadAdcBlocking(ADC_USER_APP, &ADCvalue); // This blocks for a while, about 4ms.
|
||||
|
||||
|
||||
// 100 uVolts
|
||||
volts = halConvertValueToVolts(ADCvalue);
|
||||
|
||||
return ((18641 - (int32_t)volts)*100)/1171;
|
||||
|
||||
return ((18641 - (int32_t)volts)*100)/1171;
|
||||
}/* end temperatureSensor_GetValue() */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue