How to incorporate multiple OSS-ECALs in a user program (same MCU function)

To incorporate multiple OSS-ECALs (electronic components with the same MCU function) into a user program, refer to the following example.

Exe : Electronic Components ABC1 Sensor( ADC type ), ABC2 Sensor( ADC type ), HAL Renesas SSP

Step1 Create Folder

1 Create folder for OSS-ECAL (folder name is free)
2 Create folders for ABC1 and ABC2

Step2 Copy the ABC1 files

1 ABC1 files copy to ABC1 folder

Step3 Copy the ABC2 files

1 ABC2 files copy to ABC2 folder

Step4 Copy the Common files

1 Copy the latest version of “oss_ecal.h” and “OSS-ECAL Terms of Use.txt”
2 Copy “user_setting.c” and “user_setting.c” from ABC1

Step5 “user_setting.h” with MCU settings for ABC1 and ABC2

Configure the following settings in “user_setting.h” according to the MCU settings of ABC1.

1 Set ADC_VDD to MCU VDD voltage 3.3
2 Set ADC_BIT to MCU ADC bit length 12
3 Set CMP_ADC_NUM to OSS-ECAL number 2 of ADC type
4 Set ADC_ABC1 to the ADC Group g_adc0 used for ABC1
5 Set ADC_ABC1_CH to the ADC Channel ADC_REG_CHANNEL_0 used for ABC1
6 Copy the #define lines for ADC_ABC2 and ADC_ABC2_CH from “user_setting.h” of ABC2
7 Set ADC_ABC2 to the ADC Group g_adc0 used for ABC2
8 Set ADC_ABC2_CH to the ADC Channel ADC_REG_CHANNEL_1 used for ABC2

/*-- File Header Comment Start -----------------------------------------------*/
// File Name        : user_setting.h
// Reason for change: 01.00.00 : 15/11/'23 : New Release
// Specifications   : -
// HAL              : Renesas SSP
// Terms of Use     : OSS-ECAL Terms of Use.txt
// Nickname         : Blue Dragon
/*-- File Header Comment End -------------------------------------------------*/

// Define to prevent recursive inclusion
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef __USER_SETTING_H__
#define __USER_SETTING_H__


// Includes
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include "oss_ecal.h"
#include <hal_data.h>

#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */


// Immediate definitions
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ADC components common setting
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define ADC_VDD                 3.3F            // MCU Vdd Configures the reference voltage [V]
#define ADC_BIT                 12U             // MCU ADC bit  Note:iADC_bit is set according to MCU

// Hardware setting by user
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// OSS-ECAL DIO hard wiring

// OSS-ECAL ADC components hard wiring
#define CMP_ADC_NUM             2U              // OSS-ECAL ADC components number
#define ADC_ABC1                g_adc0          // ADC Group control( g_adc0 : Generated by configuration )
#define ADC_ABC1_CH             ADC_REG_CHANNEL_0 // ABC1 : MCU ADC Channel

#define ADC_ABC2                g_adc0          // ADC Group control( g_adc0 : Generated by configuration )
#define ADC_ABC2_CH             ADC_REG_CHANNEL_1 // ABC2 : MCU ADC Channel

// OSS-ECAL SPI components hard wiring

// OSS-ECAL I2C components hard wiring

// OSS-ECAL Wake-up components hard wiring


// Communication setting by user
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


// Typedef definitions
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ADC components object struct
typedef struct
{
        etCMP                   cmp;            // Components number codes
        const adc_instance_t*   obj;            // ADC object of SSP
        adc_register_t const    pin;            // ADC channel of SSP
}stADC_SSP_OBJ;


// External constants data
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extern const stADC_SSP_OBJ      tblADC[ CMP_ADC_NUM ];


// Exported global variables
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


// Exported public functions
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


#if defined(__cplusplus)
}
#endif /* __cplusplus */

#endif /* __USER_SETTING_H__ */

Step6 Added ABC2 information to “user_setting.c”

1 include path change
2 ABC2 #include added
3 Add ABC2 to tblADC

/*-- File Header Comment Start -----------------------------------------------*/
// File Name        : user_setting.c
// Reason for change: 01.00.00 : 15/11/'23 : New Release
// Specifications   : -
// HAL              : Renesas SSP
// Terms of Use     : OSS-ECAL Terms of Use.txt
// Nickname         : Blue Dragon
/*-- File Header Comment End -------------------------------------------------*/

// Includes
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include "ABC1/oABC1.h"

#include "ABC2/oABC2.h"

// Static variables declaration
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


// Global variables declaration
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


// Static constants data declaration
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


// Global constants data declaration
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// HAL GPIO object table for components

// HAL ADC object table for components
const stADC_SSP_OBJ tblADC[ CMP_ADC_NUM ] =
{
        { eABC1    , &ADC_ABC1        , ADC_ABC1_CH      },
        { eABC2    , &ADC_ABC2        , ADC_ABC2_CH      }
};

// HAL SPI object table for components

// HAL I2C object table for components


// Private functions prototypes
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


// Public functions prototypes
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


// Functions program
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Step7 Addition of oABC1 and oABC2 functions

1. Include ABC1 and ABC2 headers in the user program header file.

// user program header
#include "../oABC1.h"
#include "../oABC2.h"

2. Add API functions to the application, referring to “sample.c” in ABC1

// user application program
    etSTS sts = oABC1( eCMD_START_READ, &vgPHY1 );

or

// user application program
    etSTS sts = oABC1_START_READ( &vgPHY1 );

3. Add API functions to the application, referring to “sample.c” in ABC2

// user application program
    etSTS sts = oABC2( eCMD_START_READ, &vgPHY2 );

or

// user application program
    etSTS sts = oABC2_START_READ( &vgPHY2 );
OSS-ECAL English
error: Content is protected !!