witekio

Dependents:   emma

Fork of TCS3200 by Grant Phillips

Files at this revision

API Documentation at this revision

Comitter:
pierre11
Date:
Thu Jan 11 09:28:04 2018 +0000
Parent:
0:b98e768bc655
Commit message:
witekio

Changed in this revision

TCS3200.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TCS3200.cpp	Tue May 03 20:45:40 2016 +0000
+++ b/TCS3200.cpp	Thu Jan 11 09:28:04 2018 +0000
@@ -10,48 +10,57 @@
     signal.fall(this,&TCS3200::LowTrigger);
 }
  
-long TCS3200::ReadRed() {
+long TCS3200::ReadRed() 
+{
     mS2=0;                    
     mS3=0;
     wait(0.1);     //Delay to allow frequency to change for the set color
     return(pulsewidth);
 }
 
-long TCS3200::ReadGreen() {
+long TCS3200::ReadGreen() 
+{
     mS2=1;                    
     mS3=1;
     wait(0.1);     //Delay to allow frequency to change for the set color
     return(pulsewidth);
 }
 
-long TCS3200::ReadBlue() {
+long TCS3200::ReadBlue() 
+{
     mS2=0;                    
     mS3=1;
     wait(0.1);     //Delay to allow frequency to change for the set color
     return(pulsewidth);
 }
 
-long TCS3200::ReadClear() {
+long TCS3200::ReadClear() 
+{
     mS2=1;                    
     mS3=0;
     wait(0.1);     //Delay to allow frequency to change for the set color
     return(pulsewidth);
 }
 
-void TCS3200::SetMode(TCS3200Mode mode) {
-    if(mode == POWERDOWN) {         //TCS3200 in power down
+void TCS3200::SetMode(TCS3200Mode mode)
+ {
+    if(mode == POWERDOWN) 
+    {         //TCS3200 in power down
         mS0 = 0;                     
         mS1 = 0;
     }
-    else if(mode == SCALE_2) {      //Output frequency at 2% scaling
+    else if(mode == SCALE_2) 
+    {      //Output frequency at 2% scaling
         mS0 = 0;                     
         mS1 = 1;
     }
-    else if(mode == SCALE_20) {     //Output frequency at 20% scaling
+    else if(mode == SCALE_20) 
+    {     //Output frequency at 20% scaling
         mS0 = 1;                     
         mS1 = 0;
     }
-    else if(mode == SCALE_100) {    //Output frequency at 100% scaling
+    else if(mode == SCALE_100) 
+    {    //Output frequency at 100% scaling
         mS0 = 1;                     
         mS1 = 1;
     }
@@ -61,11 +70,13 @@
     }
 }
 
-void TCS3200::HighTrigger() {
+void TCS3200::HighTrigger() 
+{
     timer.start();
 }
 
-void TCS3200::LowTrigger() {
+void TCS3200::LowTrigger() 
+{
     timer.stop();
     pulsewidth = timer.read_us();
     timer.reset();