void DiscoveryAll( void ) { /// unmute all devices : RDM_UnMute() /// implement DISCOVERY_COMMAND:DISC_UNMUTE RDM_UnMute( 0xFFFFFFFFFFFF );
/// discovery full range Discovery( 0, 0xFFFFFFFFFFFE ); }
void Discovery( long long low, long long high ) { unsigned char res;
while(1) { /// try to discover devices : RDM_Discovery() /// implement DISCOVERY_COMMAND:DISC_UNIQUE_BRANCH res = RDM_Discovery( low, high );
if( res == TARGET_IDENTIFIED ) /// target identified { /// mute identified target : RDM_Mute() /// implement DISCOVERY_COMMAND:DISC_MUTE RDM_Mute(target); continue; /// repeat } else if( res == DETECT_COLLISIONS ) /// detect collisions { Discovery( low, (low+high)/2 ); /// discovery low bound Discovery( (low+high)/2+1, high ); /// discovery high bound }
return; /// finish } }
沒有留言:
張貼留言