Skip to content

Commit

Permalink
Add board_comp files for RT1060 and RT1170
Browse files Browse the repository at this point in the history
  • Loading branch information
jby-nxp committed Sep 16, 2024
1 parent 7e9ca9d commit b38a480
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 0 deletions.
46 changes: 46 additions & 0 deletions boards/rt1060/board_comp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2022 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/************************************************************************************
* Include
************************************************************************************/
#include "board_comp.h"

/************************************************************************************
*************************************************************************************
* Private type definitions and macros
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Private memory declarations
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Public functions
*************************************************************************************
************************************************************************************/

/*Initialize Button*/
button_status_t BOARD_InitButton(button_handle_t ButtonHandle)
{
/* Initialize Button component */
button_config_t buttonConfig;
button_status_t bStatus;

buttonConfig.gpio.port = BOARD_BUTTON_GPIO_PORT;
buttonConfig.gpio.pin = BOARD_BUTTON_GPIO_PIN;
buttonConfig.gpio.pinStateDefault = BOARD_BUTTON_GPIO_PIN_STATE_DEFAULT;
buttonConfig.gpio.direction = BOARD_BUTTON_GPIO_DIRECTION;

bStatus = BUTTON_Init((button_handle_t)ButtonHandle, &buttonConfig);

return bStatus;
}
60 changes: 60 additions & 0 deletions boards/rt1060/board_comp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2022 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef _BOARD_COMP_H_
#define _BOARD_COMP_H_

/*******************************************************************************
* Includes
******************************************************************************/
#include "board.h"
#include "fsl_component_button.h"

/*******************************************************************************
* Definitions
******************************************************************************/

/* The configuration of Button component. */

#ifndef BOARD_BUTTON_GPIO_PORT
#define BOARD_BUTTON_GPIO_PORT 5
#endif

#ifndef BOARD_BUTTON_GPIO_PIN
#define BOARD_BUTTON_GPIO_PIN BOARD_USER_BUTTON_GPIO_PIN
#endif

#ifndef BOARD_BUTTON_GPIO_PIN_STATE_DEFAULT
#define BOARD_BUTTON_GPIO_PIN_STATE_DEFAULT 1
#endif

#ifndef BOARD_BUTTON_GPIO_DIRECTION
#define BOARD_BUTTON_GPIO_DIRECTION kHAL_GpioDirectionIn
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*******************************************************************************
* API
******************************************************************************/

/*!
* @brief Initialize Button Component
*
* This API will initialize the button component
*
* @param ButtonHandle The button handle.
*/
button_status_t BOARD_InitButton(button_handle_t ButtonHandle);

#ifdef __cplusplus
}
#endif

#endif /* _BOARD_COMP_H_ */
46 changes: 46 additions & 0 deletions boards/rt1170/board_comp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2022 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/************************************************************************************
* Include
************************************************************************************/
#include "board_comp.h"

/************************************************************************************
*************************************************************************************
* Private type definitions and macros
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Private memory declarations
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Public functions
*************************************************************************************
************************************************************************************/

/*Initialize Button*/
button_status_t BOARD_InitButton(button_handle_t ButtonHandle)
{
/* Initialize Button component */
button_config_t buttonConfig;
button_status_t bStatus;

buttonConfig.gpio.port = BOARD_BUTTON_GPIO_PORT;
buttonConfig.gpio.pin = BOARD_BUTTON_GPIO_PIN;
buttonConfig.gpio.pinStateDefault = BOARD_BUTTON_GPIO_PIN_STATE_DEFAULT;
buttonConfig.gpio.direction = BOARD_BUTTON_GPIO_DIRECTION;

bStatus = BUTTON_Init((button_handle_t)ButtonHandle, &buttonConfig);

return bStatus;
}
60 changes: 60 additions & 0 deletions boards/rt1170/board_comp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2022 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef _BOARD_COMP_H_
#define _BOARD_COMP_H_

/*******************************************************************************
* Includes
******************************************************************************/
#include "board.h"
#include "fsl_component_button.h"

/*******************************************************************************
* Definitions
******************************************************************************/

/* The configuration of Button component. */

#ifndef BOARD_BUTTON_GPIO_PORT
#define BOARD_BUTTON_GPIO_PORT 5
#endif

#ifndef BOARD_BUTTON_GPIO_PIN
#define BOARD_BUTTON_GPIO_PIN BOARD_USER_BUTTON_GPIO_PIN
#endif

#ifndef BOARD_BUTTON_GPIO_PIN_STATE_DEFAULT
#define BOARD_BUTTON_GPIO_PIN_STATE_DEFAULT 1
#endif

#ifndef BOARD_BUTTON_GPIO_DIRECTION
#define BOARD_BUTTON_GPIO_DIRECTION kHAL_GpioDirectionIn
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*******************************************************************************
* API
******************************************************************************/

/*!
* @brief Initialize Button Component
*
* This API will initialize the button component
*
* @param ButtonHandle The button handle.
*/
button_status_t BOARD_InitButton(button_handle_t ButtonHandle);

#ifdef __cplusplus
}
#endif

#endif /* _BOARD_COMP_H_ */

0 comments on commit b38a480

Please sign in to comment.