FutabaMDM166AA.cpp
changeset 31 0a2b658e0d56
parent 30 7f649078cb52
child 32 2c844ef1ff4b
     1.1 --- a/FutabaMDM166AA.cpp	Thu Feb 05 15:09:48 2015 +0100
     1.2 +++ b/FutabaMDM166AA.cpp	Thu Feb 05 22:26:15 2015 +0100
     1.3 @@ -86,6 +86,13 @@
     1.4  		//We don't set clock data here as it turns on clock display too and cause an unpleasant clock flash
     1.5  		//Only side effect from not doing this here is that for at most one minute the first time you cold boot your display the time should be wrong.
     1.6  		//SetClockData();
     1.7 +
     1.8 +		//Turns mast ON
     1.9 +		//SetIconNetwork(0,EIconOn);
    1.10 +		//Show volume label
    1.11 +		//SendCommandSymbolControl(EIconVolumeLabel,EIconOn);
    1.12 +		//Icon checks
    1.13 +		//SetAllIcons(EIconOn);
    1.14  		}
    1.15  	return success;
    1.16  	}
    1.17 @@ -128,6 +135,7 @@
    1.18      {
    1.19  	//That one also clear the symbols
    1.20      SetAllPixels(0x00);
    1.21 +	SendCommandClear(); //Clear icons too
    1.22      }
    1.23  
    1.24  /**
    1.25 @@ -381,6 +389,136 @@
    1.26  
    1.27  
    1.28  /**
    1.29 +*/
    1.30 +void MDM166AA::SetIconNetwork(int aIndex, int aStatus)
    1.31 +	{
    1.32 +	if (aIndex<0||aIndex>=IconNetworkCount())
    1.33 +		{
    1.34 +		//Out of range
    1.35 +		return;
    1.36 +		}
    1.37 +
    1.38 +	SendCommandSymbolControl((TIconId)(aIndex+EIconNetworkMast),(aStatus==0?EIconOff:EIconOn));
    1.39 +	}
    1.40 +
    1.41 +/**
    1.42 +*/
    1.43 +void MDM166AA::SetIconEmail(int aIndex, int aStatus)
    1.44 +	{
    1.45 +	if (aIndex<0||aIndex>=IconEmailCount())
    1.46 +		{
    1.47 +		//Out of range
    1.48 +		return;
    1.49 +		}
    1.50 +
    1.51 +	SendCommandSymbolControl((TIconId)(aIndex+EIconEnvelop),(aStatus==0?EIconOff:EIconOn));
    1.52 +	}
    1.53 +
    1.54 +/**
    1.55 +*/
    1.56 +void MDM166AA::SetIconMute(int aIndex, int aStatus)
    1.57 +	{
    1.58 +	if (aIndex<0||aIndex>=IconMuteCount())
    1.59 +		{
    1.60 +		//Out of range
    1.61 +		return;
    1.62 +		}
    1.63 +
    1.64 +	SendCommandSymbolControl((TIconId)(aIndex+EIconMute),(aStatus==0?EIconOff:EIconOn));
    1.65 +	}
    1.66 +
    1.67 +/**
    1.68 +*/
    1.69 +void MDM166AA::SetIconVolume(int aIndex, int aStatus)
    1.70 +	{
    1.71 +	if (aIndex<0||aIndex>=IconVolumeCount())
    1.72 +		{
    1.73 +		//Out of range
    1.74 +		return;
    1.75 +		}
    1.76 +
    1.77 +	if (aStatus<EIconOff||aStatus>EIconOn)
    1.78 +		{
    1.79 +		//Out of range
    1.80 +		return;
    1.81 +		}
    1.82 +
    1.83 +	SendCommandSymbolControl((TIconId)(aIndex+EIconVolumeLevel01),(TIconStatus)aStatus);
    1.84 +	}
    1.85 +
    1.86 +
    1.87 +/**
    1.88 +*/
    1.89 +void MDM166AA::SetIconPlay(int aIndex, int aStatus)
    1.90 +	{
    1.91 +	if (aIndex<0||aIndex>=IconPlayCount())
    1.92 +		{
    1.93 +		//Out of range
    1.94 +		return;
    1.95 +		}
    1.96 +
    1.97 +	SendCommandSymbolControl((TIconId)(aIndex+EIconPlay),(aStatus==0?EIconOff:EIconOn));
    1.98 +	}
    1.99 +
   1.100 +
   1.101 +/**
   1.102 +*/
   1.103 +void MDM166AA::SetIconPause(int aIndex, int aStatus)
   1.104 +	{
   1.105 +	if (aIndex<0||aIndex>=IconPauseCount())
   1.106 +		{
   1.107 +		//Out of range
   1.108 +		return;
   1.109 +		}
   1.110 +
   1.111 +	SendCommandSymbolControl((TIconId)(aIndex+EIconPause),(aStatus==0?EIconOff:EIconOn));
   1.112 +	}
   1.113 +
   1.114 +
   1.115 +/**
   1.116 +*/
   1.117 +void MDM166AA::SetIconRecording(int aIndex, int aStatus)
   1.118 +	{
   1.119 +	if (aIndex<0||aIndex>=IconRecordingCount())
   1.120 +		{
   1.121 +		//Out of range
   1.122 +		return;
   1.123 +		}
   1.124 +
   1.125 +	SendCommandSymbolControl((TIconId)(aIndex+EIconRecording),(aStatus==0?EIconOff:EIconOn));
   1.126 +	}
   1.127 +
   1.128 +/**
   1.129 +Set all our icons to the corresponding status.
   1.130 +*/
   1.131 +void MDM166AA::SetAllIcons(TIconStatus aStatus)
   1.132 +	{
   1.133 +	for (int i=EIconFirst;i<=EIconLast;i++)
   1.134 +		{
   1.135 +		SendCommandSymbolControl((TIconId)i,aStatus);
   1.136 +		}
   1.137 +	}
   1.138 +
   1.139 +/**
   1.140 +Symbols control
   1.141 +Segment On/Off and Grayscale/Brightness
   1.142 +[Code]1BH,30H,Ps,Pb
   1.143 +*/
   1.144 +void MDM166AA::SendCommandSymbolControl(TIconId aIconId, TIconStatus aStatus)
   1.145 +	{
   1.146 +	FutabaVfdReport report;
   1.147 +    report[0]=0x00; //Report ID
   1.148 +    report[1]=0x04; //Report size
   1.149 +    report[2]=0x1B; //Command ID
   1.150 +    report[3]=0x30; //Command ID
   1.151 +	report[4]=aIconId;
   1.152 +	report[5]=aStatus;
   1.153 +
   1.154 +    Write(report);
   1.155 +	}
   1.156 +
   1.157 +
   1.158 +/**
   1.159  Clock setting 
   1.160  [Code]1BH,00H,Pm,Ph 
   1.161  [Function]Setting the clock data. The setting data is cleared, if the Reset command is input or power is turned off.
   1.162 @@ -404,7 +542,6 @@
   1.163      Write(report);
   1.164  	}
   1.165  
   1.166 -
   1.167  /**
   1.168  Set display clock data according to local system time.
   1.169  This will only provide 30s accuracy.
   1.170 @@ -467,6 +604,7 @@
   1.171  Display RAM filled with 00H.
   1.172  Address Counter is set by 00H.
   1.173  Dimming is set to 50%.
   1.174 +Turn off all icons segments.
   1.175  */
   1.176  void MDM166AA::SendCommandReset()
   1.177  	{
   1.178 @@ -475,8 +613,6 @@
   1.179  	report[1]=0x01; //Report length.
   1.180  	report[2]=0x1F; //Command ID
   1.181  	Write(report);
   1.182 -	//Wait until reset is done. Is that needed?
   1.183 -	//sleep(2000);
   1.184  	}
   1.185  
   1.186