Skip to content
Snippets Groups Projects
Commit 25646333 authored by Clément Foucher's avatar Clément Foucher
Browse files

Better comments for DataAcquisition functions.

Get rid of now unused function.
parent 6aa097b9
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
* function requires the presence of an "adc-channels" node in the * function requires the presence of an "adc-channels" node in the
* shield device-tree. * shield device-tree.
* *
* This function must be called *before* ADC is started. * @note This function must be called *before* ADC is started.
* *
* @param adc_number Number of the ADC on which channel is to be enabled. * @param adc_number Number of the ADC on which channel is to be enabled.
* @param channel_name Name of the channel using enumeration channel_t. * @param channel_name Name of the channel using enumeration channel_t.
...@@ -119,7 +119,7 @@ public: ...@@ -119,7 +119,7 @@ public:
* All other ADCs remain software triggered, thus will only be * All other ADCs remain software triggered, thus will only be
* acquired when triggerAcquisition() is called. * acquired when triggerAcquisition() is called.
* *
* This function must be called *before* ADC is started. * @note This function must be called *before* ADC is started.
*/ */
void enableTwistDefaultChannels(); void enableTwistDefaultChannels();
...@@ -132,18 +132,22 @@ public: ...@@ -132,18 +132,22 @@ public:
* of the function. The variable will be updated with the * of the function. The variable will be updated with the
* number of values that are available in the buffer. * number of values that are available in the buffer.
* *
* @note When calling this function, it invalidates the buffer * @note This function can't be called before the channel is enabled
* returned by a previous call to the same function. * and the DataAcquisition module is started, either explicitly
* However, different channels buffers are independent * or by starting the Uninterruptible task.
* from each other.
* *
* @note When using this functions, the user is responsible for data * @note When calling this function, it invalidates the buffer
* conversion. Use matching dataAcquisition.convert*() function * returned by a previous call to the same function.
* for this purpose. * However, different channels buffers are independent
* from each other.
* *
* @note When using this function, DO NOT use the function to get the * @note When using this functions, the user is responsible for data
* latest converted value for the same channel as this function * conversion. Use matching dataAcquisition.convert*() function
* will clear the buffer and disregard all values but the latest. * for this purpose.
*
* @note When using this function, DO NOT use the function to get the
* latest converted value for the same channel as this function
* will clear the buffer and disregard all values but the latest.
* *
* @param channel Name of the shield channel from which to obtain values. * @param channel Name of the shield channel from which to obtain values.
* @param number_of_values_acquired Pass an uint32_t variable. * @param number_of_values_acquired Pass an uint32_t variable.
...@@ -163,6 +167,10 @@ public: ...@@ -163,6 +167,10 @@ public:
* buffer, and thus can be called safely at any time after the * buffer, and thus can be called safely at any time after the
* module has been started. * module has been started.
* *
* @note This function can't be called before the channel is enabled
* and the DataAcquisition module is started, either explicitly
* or by starting the Uninterruptible task.
*
* @param channel Name of the shield channel from which to obtain value. * @param channel Name of the shield channel from which to obtain value.
* *
* @return Latest available value available from the given channel. * @return Latest available value available from the given channel.
...@@ -176,10 +184,14 @@ public: ...@@ -176,10 +184,14 @@ public:
* in the relevant unit for the channel: Volts, Amperes, or * in the relevant unit for the channel: Volts, Amperes, or
* Degree Celcius. * Degree Celcius.
* *
* @note When using this functions, you loose the ability to access raw * @note This function can't be called before the channel is enabled
* values using dataAcquisition.get*RawValues() function for the * and the DataAcquisition module is started, either explicitly
* matching channel, as dataAcquisition.get*() function clears the * or by starting the Uninterruptible task.
* buffer on each call. *
* @note When using this functions, you loose the ability to access raw
* values using dataAcquisition.get*RawValues() function for the
* matching channel, as dataAcquisition.get*() function clears the
* buffer on each call.
* *
* @param channel Name of the shield channel from which to obtain value. * @param channel Name of the shield channel from which to obtain value.
* @param dataValid Pointer to an uint8_t variable. This parameter is * @param dataValid Pointer to an uint8_t variable. This parameter is
...@@ -202,6 +214,8 @@ public: ...@@ -202,6 +214,8 @@ public:
* dataAcquisition.get*RawValues() function to relevant * dataAcquisition.get*RawValues() function to relevant
* unit for the data: Volts, Amperes, or Degree Celcius. * unit for the data: Volts, Amperes, or Degree Celcius.
* *
* @note This function can't be called before the channel is enabled.
*
* @param channel Name of the shield channel from which the value originates * @param channel Name of the shield channel from which the value originates
* @param raw_value Raw value obtained from which the value originates * @param raw_value Raw value obtained from which the value originates
* *
...@@ -213,6 +227,10 @@ public: ...@@ -213,6 +227,10 @@ public:
* @brief Use this function to tweak the conversion values for the * @brief Use this function to tweak the conversion values for the
* channel if default values are not accurate enough. * channel if default values are not accurate enough.
* *
* @note This function can't be called before the channel is enabled.
* The DataAcquisition must not have been started, neither explicitly
* nor by starting the Uninterruptible task.
*
* @param channel Name of the shield channel to set conversion values. * @param channel Name of the shield channel to set conversion values.
* @param gain Gain to be applied (multiplied) to the channel raw value. * @param gain Gain to be applied (multiplied) to the channel raw value.
* @param offset Offset to be applied (added) to the channel value * @param offset Offset to be applied (added) to the channel value
...@@ -223,9 +241,10 @@ public: ...@@ -223,9 +241,10 @@ public:
/** /**
* @brief Retrieve stored parameters from Flash memory and configure ADC parameters * @brief Retrieve stored parameters from Flash memory and configure ADC parameters
* *
* This function can only be called *after* all Twist channels have * @note This function can't be called before the *all* Twist channels have
* been added (you can use enableTwistDefaultChannels() for that * been enabled (you can use enableTwistDefaultChannels() for that
* purpose) and *before* ADC are started. * purpose). The DataAcquisition must not have been started, neither
* explicitly nor by starting the Uninterruptible task.
*/ */
void setTwistChannelsUserCalibrationFactors(); void setTwistChannelsUserCalibrationFactors();
...@@ -311,6 +330,10 @@ public: ...@@ -311,6 +330,10 @@ public:
* on this ADC will be acquired one after the other until all * on this ADC will be acquired one after the other until all
* configured channels have been acquired. * configured channels have been acquired.
* *
* @note This function can't be called before the at least one channel
* is enabled on the ADC and the DataAcquisition module is started,
* either explicitly or by starting the Uninterruptible task.
*
* @param adc_num Number of the ADC on which to acquire channels. * @param adc_num Number of the ADC on which to acquire channels.
*/ */
void triggerAcquisition(uint8_t adc_num); void triggerAcquisition(uint8_t adc_num);
...@@ -328,10 +351,14 @@ public: ...@@ -328,10 +351,14 @@ public:
* of the function. The variable will be updated with the * of the function. The variable will be updated with the
* number of values that are available in the buffer. * number of values that are available in the buffer.
* *
* @note When calling this function, it invalidates the buffer * @note This function can't be called before the pin is enabled.
* returned by a previous call to the same function. * The DataAcquisition module must have been started, either
* However, different channels buffers are independent * explicitly or by starting the Uninterruptible task.
* from each other. *
* @note When calling this function, it invalidates the buffer
* returned by a previous call to the same function.
* However, different channels buffers are independent
* from each other.
* *
* @note When using this functions, the user is responsible for data * @note When using this functions, the user is responsible for data
* conversion. Use matching dataAcquisition.convert*() function * conversion. Use matching dataAcquisition.convert*() function
...@@ -360,6 +387,10 @@ public: ...@@ -360,6 +387,10 @@ public:
* buffer, and thus can be called safely at any time after the * buffer, and thus can be called safely at any time after the
* module has been started. * module has been started.
* *
* @note This function can't be called before the pin is enabled.
* The DataAcquisition module must have been started, either
* explicitly or by starting the Uninterruptible task.
*
* @param adc_num Number of the ADC from which to obtain value. * @param adc_num Number of the ADC from which to obtain value.
* @param pin_num Number of the pin from which to obtain values. * @param pin_num Number of the pin from which to obtain values.
* @return Latest available value available from the given channel. * @return Latest available value available from the given channel.
...@@ -373,10 +404,14 @@ public: ...@@ -373,10 +404,14 @@ public:
* in the relevant unit for the channel: Volts, Amperes, or * in the relevant unit for the channel: Volts, Amperes, or
* Degree Celcius. * Degree Celcius.
* *
* @note When using this functions, you loose the ability to access raw * @note This function can't be called before the pin is enabled.
* values using dataAcquisition.get*RawValues() function for the * The DataAcquisition module must have been started, either
* matching channel, as dataAcquisition.get*() function clears the * explicitly or by starting the Uninterruptible task.
* buffer on each call. *
* @note When using this functions, you loose the ability to access raw
* values using dataAcquisition.get*RawValues() function for the
* matching channel, as dataAcquisition.get*() function clears the
* buffer on each call.
* *
* @param adc_num Number of the ADC from which to obtain value. * @param adc_num Number of the ADC from which to obtain value.
* @param pin_num Number of the pin from which to obtain values. * @param pin_num Number of the pin from which to obtain values.
...@@ -400,6 +435,8 @@ public: ...@@ -400,6 +435,8 @@ public:
* dataAcquisition.get*RawValues() function to relevant * dataAcquisition.get*RawValues() function to relevant
* unit for the data: Volts, Amperes, or Degree Celcius. * unit for the data: Volts, Amperes, or Degree Celcius.
* *
* @note This function can't be called before the pin is enabled.
*
* @param adc_num Number of the ADC from which the value originates. * @param adc_num Number of the ADC from which the value originates.
* @param pin_num Number of the pin from which to obtain values. * @param pin_num Number of the pin from which to obtain values.
* @param raw_value Raw value obtained from the channel buffer. * @param raw_value Raw value obtained from the channel buffer.
...@@ -412,6 +449,10 @@ public: ...@@ -412,6 +449,10 @@ public:
* @brief Use this function to tweak the conversion values for the * @brief Use this function to tweak the conversion values for the
* channel if default values are not accurate enough. * channel if default values are not accurate enough.
* *
* @note This function can't be called before the pin is enabled.
* The DataAcquisition module must not have been started, neither
* explicitly nor by starting the Uninterruptible task.
*
* @param adc_num Number of the ADC to set conversion values. * @param adc_num Number of the ADC to set conversion values.
* @param pin_num Number of the pin from which to obtain values. * @param pin_num Number of the pin from which to obtain values.
* @param gain Gain to be applied (multiplied) to the channel raw value. * @param gain Gain to be applied (multiplied) to the channel raw value.
......
...@@ -135,32 +135,6 @@ static bool initialized = false; ...@@ -135,32 +135,6 @@ static bool initialized = false;
///// /////
// ADC channels private functions // ADC channels private functions
static uint8_t _get_adc_number_by_address(uint32_t adc_address)
{
if (adc_address == 0x50000000)
{
return 1;
}
else if (adc_address == 0x50000100)
{
return 2;
}
else if (adc_address == 0x50000400)
{
return 3;
}
else if (adc_address == 0x50000500)
{
return 4;
}
else if (adc_address == 0x50000600)
{
return 5;
}
return 0;
}
/** /**
* Builds list of device-tree defined channels for each ADC. * Builds list of device-tree defined channels for each ADC.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment