This function reads the configuration settings saved in the flash ROM of the OS and reflects them on the specified COM port.

Syntax

int LoadConfig(
  const unsigned int com_port
);

Parameters

com_port
[in] Specify the port number to read the configuration settings.
ValueDescription
COM3 Bluetooth SPP (Master)
COM4 Bluetooth HID (Slave)
COM5 Bluetooth SPP (Slave)
It does not support the acquisition of other COM port settings.

Return value

The function reads normally (OK) or returns a failure (ERROR).
ValueDescription
OK Load succeeded.
ERROR Load failed.

Remarks

For details on errors, see GetErrorStatus function.
Also, make sure that the port is closed when using this function.
See the setconfig_comapi structure for the data structures.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main( void )
{
    int ch;

    if( LoadConfig( COM5 ) == ERROR )
    {
        SetDefault( COM5 );
        SaveConfig( COM5 );
    }

    ComOpen( COM5 );    // Open the COM port
    for(;;)
    {
        if( (ch = GetCom( 0 )) != -1)
        {
            putchar( ch );
            PutCom( ch );
        }
        if( (ch = getchar()) != EOF)
        {
            putchar( ch );
            PutCom( ch );
        }
        Idle();    // Very important to lower the power consumption
    }
}

Last updated: 2020/10/07