Milosch Meriac / rgb_sensor

Dependents:   rgb_sensor_buffer discrete_rgb_color_sensor_example

Files at this revision

API Documentation at this revision

Comitter:
meriac
Date:
Wed Jul 09 10:27:38 2014 +0000
Parent:
9:7bd80f4a965e
Commit message:
Added RGB_MASK declararation

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 17:24:41 2014 +0000
+++ b/rgb_sensor.cpp	Wed Jul 09 10:27:38 2014 +0000
@@ -140,7 +140,7 @@
     if(status & (1UL<<m_adc_channel))
     {
         /* always read sample to acknowledge IRQ */
-        sample = (((&LPC_ADC->ADDR0)[m_adc_channel])>>4) & 0xFFF;
+        sample = (((&LPC_ADC->ADDR0)[m_adc_channel])>>4) & RGB_MASK;
 
         if(!m_done)
         {
--- a/rgb_sensor.h	Thu Jul 03 17:24:41 2014 +0000
+++ b/rgb_sensor.h	Wed Jul 09 10:27:38 2014 +0000
@@ -22,6 +22,8 @@
 #ifndef __RGB_SENSOR_H__
 #define __RGB_SENSOR_H__
 
+#define RGB_MASK 0xFFF
+
 #ifndef RGB_LED_ON
 #define RGB_LED_ON true
 #endif/*RGB_LED_ON*/