Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: rgb_sensor_buffer discrete_rgb_color_sensor_example
Revision 9:7bd80f4a965e, committed 2014-07-03
- Comitter:
- meriac
- Date:
- Thu Jul 03 17:24:41 2014 +0000
- Parent:
- 8:88acb970df76
- Child:
- 10:b95dfd2d6d4d
- Commit message:
- Allowing to ignore values at the beginning of each block to ignore rise times low pass.
Changed in this revision
| rgb_sensor.cpp | Show annotated file Show diff for this revision Revisions of this file |
| rgb_sensor.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/rgb_sensor.cpp Thu Jul 03 16:52:12 2014 +0000
+++ b/rgb_sensor.cpp Thu Jul 03 17:24:41 2014 +0000
@@ -145,10 +145,12 @@
if(!m_done)
{
/* filter value to remove ADC noise/conversion errors */
- m_adc_aggregation[m_rgb_channel] += filter(sample);
+ sample = filter(sample);
+ if(m_adc_count>=RGB_SENSOR_IGNORE)
+ m_adc_aggregation[m_rgb_channel] += sample;
m_adc_count++;
- if(m_adc_count>=RGB_OVERSAMPLING)
+ if(m_adc_count>=(RGB_OVERSAMPLING+RGB_SENSOR_IGNORE))
{
m_adc_count=0;
m_rgb_channel++;
--- a/rgb_sensor.h Thu Jul 03 16:52:12 2014 +0000 +++ b/rgb_sensor.h Thu Jul 03 17:24:41 2014 +0000 @@ -30,6 +30,11 @@ #define RGB_OVERSAMPLING 32 #endif/*RGB_OVERSAMPLING*/ +#ifndef RGB_SENSOR_IGNORE +#define RGB_SENSOR_IGNORE (RGB_OVERSAMPLING/2) +#endif/*RGB_SENSOR_IGNORE*/ + + #ifndef RGB_MAX_ADC_CLK #define RGB_MAX_ADC_CLK 6000000UL #endif/*RGB_MAX_ADC_CLK*/