You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.4 KiB
71 lines
1.4 KiB
/**
|
|
**************************************************************************************************
|
|
* @file hwd_spi.h
|
|
* @author Kerem Yollu & Edwin Koch
|
|
* @date 26.02.2023
|
|
* @version 1.0
|
|
**************************************************************************************************
|
|
* @brief
|
|
*
|
|
* **Detailed Description :**
|
|
*
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
#ifndef _HWD_SPI_H_
|
|
#define _HWD_SPI_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "hardwareDescription.h"
|
|
|
|
#define MAX_SPI_CHANNEL_COUNT 2
|
|
|
|
/*!
|
|
* RCC Bus number index list connected to the SPI
|
|
* */
|
|
static const uint8_t spiBus_No[MAX_SPI_CHANNEL_COUNT] = {
|
|
2, /*!< SPI 1 is connected to bus 2 */
|
|
1 /*!< SPI 2 is connected to bus 1 */
|
|
};
|
|
|
|
/*!
|
|
* RCC SPI clock enable bit position for the given register
|
|
*
|
|
*/
|
|
static const uint8_t spiBus_En_bitPos[MAX_SPI_CHANNEL_COUNT] = {
|
|
RCC_APB2ENR_SPI1EN_Pos,
|
|
RCC_APB1ENR_SPI2EN_Pos
|
|
};
|
|
|
|
/*!
|
|
* RCC SPI Reset Bit Position list
|
|
* */
|
|
static const uint8_t spiBus_Rst_bitPos[MAX_SPI_CHANNEL_COUNT] = {
|
|
RCC_APB2RSTR_SPI1RST_Pos,
|
|
RCC_APB1RSTR_SPI2RST_Pos
|
|
};
|
|
|
|
/**
|
|
* Enumof available spi hardware channels
|
|
*/
|
|
typedef enum{
|
|
SPI_CH_1,
|
|
SPI_CH_2
|
|
} spiCH_t;
|
|
/**
|
|
* SPI base address list
|
|
*/
|
|
static const uint32_t spiBase_Addr_List[MAX_SPI_CHANNEL_COUNT] = {
|
|
SPI1_BASE,
|
|
SPI2_BASE
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // _HWD_SPI_H_
|