How to incorporate OSS-ECAL into user programs

To incorporate OSS-ECAL into your user program, please refer to the following example.

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

Step1 “user_setting.h” with MCU settings for ABC1

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 ADC_ABC1 to the ADC Group g_adc0 used for ABC1
4 Set ADC_ABC1_CH to the ADC Channel ADC_REG_CHANNEL_0 used for ABC1

/*-- 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             1U              // 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

// 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__ */

Step2 Addition of oABC1 function

1. Include the ABC1 header in the user program header file.

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

2. Add API functions to your application with reference to “sample.c”

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

or

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