Files
HMCLOCK/src/user_peripheral.h
2025-05-07 21:02:07 +08:00

155 lines
6.1 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
****************************************************************************************
*
* @file user_peripheral_proj.h
*
* @brief Peripheral project header file.
*
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
* All rights reserved. Confidential Information.
*
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
* revocable, non-sub-licensable right and license to use the Software, solely if used in
* or together with Renesas products. You may make copies of this Software, provided this
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
* reserves the right to change or discontinue the Software at any time without notice.
*
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
* SOFTWARE.
*
****************************************************************************************
*/
#ifndef _USER_PERIPHERAL_H_
#define _USER_PERIPHERAL_H_
/**
****************************************************************************************
* @addtogroup APP
* @ingroup RICOW
*
* @brief
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwble_config.h"
#include "app_task.h" // application task
#include "gapc_task.h" // gap functions and messages
#include "gapm_task.h" // gap functions and messages
#include "app.h" // application definitions
#include "co_error.h" // error code definitions
#include "arch_wdg.h"
#include "app_callback.h"
#include "app_default_handlers.h"
/*
* DEFINES
****************************************************************************************
*/
/* Duration of timer for connection parameter update request */
#define APP_PARAM_UPDATE_REQUEST_TO (100) // 1000*10ms = 10sec, The maximum allowed value is 41943sec (4194300 * 10ms)
/* Advertising data update timer */
#define APP_ADV_DATA_UPDATE_TO (3000) // 3000*10ms = 30sec, The maximum allowed value is 41943sec (4194300 * 10ms)
/* Manufacturer specific data constants */
#define APP_AD_MSD_COMPANY_ID (0xABCD)
#define APP_AD_MSD_COMPANY_ID_LEN (2)
#define APP_AD_MSD_DATA_LEN (sizeof(uint16_t))
#define APP_PERIPHERAL_CTRL_TIMER_DELAY 100
/*
* TYPE DEFINITIONS
****************************************************************************************
*/
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
void user_app_on_db_init_complete( void );
void user_app_before_sleep(void);
/**
****************************************************************************************
* @brief Application initialization function.
****************************************************************************************
*/
void user_app_init(void);
/**
****************************************************************************************
* @brief Advertising function.
****************************************************************************************
*/
void user_app_adv_start(void);
/**
****************************************************************************************
* @brief Connection function.
* @param[in] connection_idx Connection Id index
* @param[in] param Pointer to GAPC_CONNECTION_REQ_IND message
****************************************************************************************
*/
void user_app_connection(uint8_t connection_idx,
struct gapc_connection_req_ind const *param);
/**
****************************************************************************************
* @brief Undirect advertising completion function.
* @param[in] status Command complete event message status
****************************************************************************************
*/
void user_app_adv_undirect_complete(uint8_t status);
/**
****************************************************************************************
* @brief Disconnection function.
* @param[in] param Pointer to GAPC_DISCONNECT_IND message
****************************************************************************************
*/
void user_app_disconnect(struct gapc_disconnect_ind const *param);
/**
****************************************************************************************
* @brief Handles the messages that are not handled by the SDK internal mechanisms.
* @param[in] msgid Id of the message received.
* @param[in] param Pointer to the parameters of the message.
* @param[in] dest_id ID of the receiving task instance.
* @param[in] src_id ID of the sending task instance.
****************************************************************************************
*/
void user_catch_rest_hndl(ke_msg_id_t const msgid,
void const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id);
/// @} APP
#endif // _USER_PERIPHERAL_H_