/*!
 * @file        user_spi_config.h
 *
 * @brief       SPI configurations
 *
 * @version     V1.0.0
 *
 * @date        2026-03-25
 *
 * @attention
 *
 *  Copyright (C) 2026 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the Geehy Semiconductor Software License Agreement for the governing permissions
 *  and limitations under the License.
 */

#ifndef USER_SPI_CONFIG_H
#define USER_SPI_CONFIG_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes */
#include "g32a10xx_gpio.h"
#include "g32a10xx_spi.h"

/** @addtogroup Examples
  @{
*/

/** @addtogroup SPI_Examples
  @{
  */

/** @addtogroup SPI_CsDelayClk_Slave
  @{
*/

/** @defgroup SPI_CsDelayClk_Slave_INT_Macros INT_Macros
  @{
*/
/*******************************************************************************
                                MACROS
*******************************************************************************/
/* The SPI NSS, SCK, MISO, MOSI PIN */
#define SPI_NSS_PIN                      GPIO_PIN_4
#define SPI_NSS_GPIO_PORT                GPIOA
#define SPI_NSS_GPIO_CLK                 RCM_AHB_PERIPH_GPIOA
#define SPI_NSS_PIN_SOURCE               GPIO_PIN_SOURCE_4
#define SPI_NSS_AF                       GPIO_AF_PIN0

#define SPI_SCK_PIN                      GPIO_PIN_5
#define SPI_SCK_GPIO_PORT                GPIOA
#define SPI_SCK_GPIO_CLK                 RCM_AHB_PERIPH_GPIOA
#define SPI_SCK_PIN_SOURCE               GPIO_PIN_SOURCE_5
#define SPI_SCK_AF                       GPIO_AF_PIN0

#define SPI_MISO_PIN                     GPIO_PIN_6
#define SPI_MISO_GPIO_PORT               GPIOA
#define SPI_MISO_GPIO_CLK                RCM_AHB_PERIPH_GPIOA
#define SPI_MISO_PIN_SOURCE              GPIO_PIN_SOURCE_6
#define SPI_MISO_AF                      GPIO_AF_PIN0

#define SPI_MOSI_PIN                     GPIO_PIN_7
#define SPI_MOSI_GPIO_PORT               GPIOA
#define SPI_MOSI_GPIO_CLK                RCM_AHB_PERIPH_GPIOA
#define SPI_MOSI_PIN_SOURCE              GPIO_PIN_SOURCE_7
#define SPI_MOSI_AF                      GPIO_AF_PIN0

/* Buffsize */
#define BUFF_SIZE 56

/**@} end of group SPI_CsDelayClk_Slave_INT_Macros */
/*******************************************************************************
                                GLOBAL VARS
*******************************************************************************/
/** @defgroup SPI_CsDelayClk_Slave_INT_Variables INT_Variables
  @{
*/

/* SPI user configuration */
extern uint8_t g_spiBufferTx[BUFF_SIZE];
extern uint8_t g_spiBufferRx[BUFF_SIZE];

extern Gpio_ConfigType g_spiNssConfig;
extern Gpio_ConfigType g_spiSckConfig;
extern Gpio_ConfigType g_spiMisoConfig;
extern Gpio_ConfigType g_spiMosiConfig;
extern Spi_ConfigType g_spiConfig;

#ifdef __cplusplus
}
#endif

#endif /* USER_SPI_CONFIG_H */

/**@} end of group SPI_CsDelayClk_Slave_INT_Variables */
/**@} end of group SPI_CsDelayClk_Slave */
/**@} end of group SPI_Examples */
/**@} end of group Examples */
