Mute: Difference between revisions

From Sharpfin
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 24: Line 24:
== Example ==
== Example ==


<pre>
<syntaxhighlight>
#include "mute.h"
#include "mute.h"
#include <string.h>
#include <string.h>
Line 31: Line 31:
main(int argc, char *argv[])
main(int argc, char *argv[])
{
{
   if (argc==2 && strcmp(argv[1],"on")==0) mute_set(SMUTE_ON) ;
   if (argc==2 && strcmp(argv[1],"on")==0) {
   else if (argc==2 && strcmp(argv[1],"off")==0) mute_set(SMUTE_OFF) ;
    mute_set(SMUTE_ON);
   else { printf("mutectl on|off
   } else if (argc==2 && strcmp(argv[1],"off")==0) {
") ; return ; }
    mute_set(SMUTE_OFF);
   } else {
    printf("mutectl on|off
");
    return;
  }
   printf("Mute state is %d
   printf("Mute state is %d
", mute_get()) ;
", mute_get());
}
}
</pre>
</syntaxhighlight>

Latest revision as of 11:00, 31 December 2011

Overview

The Libreciva mute function controls the radio's mute state.

In order to use the library function, you must include the header file:

<syntaxhighlight>

  1. include "mute.h"

</syntaxhighlight>

void mute_set(enum smute_e_state state)

This function changes the radio's mute state. The passed parameter is either:

  • SMUTE_ON
  • SMUTE_OFF

It is recommended that this function is called when the radio application first starts.

enum smute_e_state mute_get()

This function gets the current mute state. Note that this function will only produce an accurate response if mute_set() has been previously called.

Example

<syntaxhighlight>

  1. include "mute.h"
  2. include <string.h>
  3. include <stdio.h>

main(int argc, char *argv[]) {

 if (argc==2 && strcmp(argv[1],"on")==0) {
   mute_set(SMUTE_ON);
 } else if (argc==2 && strcmp(argv[1],"off")==0) {
   mute_set(SMUTE_OFF);
 } else {
   printf("mutectl on|off

");

   return;
 }
 printf("Mute state is %d

", mute_get()); } </syntaxhighlight>