PreviousNext
setupRFPGM
Help > OS functions > RFPGM – wireless upload > setupRFPGM

Function

 

Setup RFPGM parameters

Purpose

 

Configure RFPGM behavior

Syntax

 

void setupRFPGM(uns8 x)

Parameters

 

x:                                                                                                               Factory default: 0x83

 

bit

7

6

5

4

3

2

1

0

 

RFPGM termination

by MCU pin

RFPGM termination

after ~1 min

0

RFPGM enable

0

LP RFPGM

Single / dual

channel

 

Bit 0,1: RFPGM single / dual channel mode

     00      Receiving on a single channel

     01      Reserved

     10      Reserved

     11      Receiving on a dual channel (default, can be changed by TR Configuration in IQRF IDE)

 

Bit 2: LP RFPGM

     0        Uploaded TRs use STD RX mode (default).

     1        Uploaded TRs use power-saving LP RX mode.

 

Bit 4: RFPGM invoking by reset. (This bit operates like enableRFPGM / disableRFPGM functions.)

     H – enabled

     L – disabled (default).

 

Bit 6: RFPGM termination automatically ~1 minute after entering RFPGM mode.

     H – enabled

     L – disabled (default)

 

Bit 7: RFPGM termination by MCU pin RB4.

     H – enabled (default)

     L – disabled

   If enabled, the termination is invoked by log. 0 for at least ~0.25 s for a single channel or ~0.5 s for    a dual channel on one of the dedicated pin(s):

         C5        for non-SMT TR modules, e.g. TR-72G

         Q12      for SMT TR modules, e.g.TR-76G

This time must be prolonged up to 2 s in case of strong RF noise.

 

Bits 3 and 5: Must be kept cleared

Return value

 

  –

Output values

 

TR Configuration stored in EEPROM is accordingly changed.

Preconditions

 

If RFPGM termination by MCU pin is enabled, pin RB4 must have a pull-up resistor. RB4 has an SW selectable internal pull-up, default enabled by OS after boot.

Remarks

 

     RFPGM invoking by runRFPGM is unconditional, independent on parameter x

     RFPGM termination by IQRF IDE is unconditional, independent on parameter x

     This function overrides the setting done by TR Configuration in IQRF IDE.

Side effects

 

  –

See also

 

runRFPGM, enableRFPGM

Example 1

 

void APPLICATION()

setupRFPGM(0x13);   // RFPGM entered:   after reset or runRFPGM

                     // RFPGM abandoned: by End RFPGM button only

                     // Dual channel

Example 2

 

setupRFPGM(0x90);   // RFPGM entered:   after reset or runRFPGM

                     // RFPGM abandoned: by dedicated pin or End RFPGM button only

                     // Single channel

 

 

 

 

Example 3

 

setupRFPGM(0xD3);   // RFPGM entered:   after reset or runRFPGM

                    // RFPGM abandoned: by dedicated pin or End RFPGM button

                    // or automatically ~1 min after reset

                    // Dual channel

Example 4

 

setupRFPGM(_ENABLE_ON_RESET | _DUAL_CHANNEL);

       // The same RFPGM setup as in Example 1 but using predefined constants.

       // See chapter Macros / Constants.