CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
flash_internal_spi.c File Reference
#include "main.h"
#include "littlefs/flash_internal_spi.h"
Include dependency graph for flash_internal_spi.c:

Functions

static void _chip_select_low (uint8_t chip_number)
 
static void _chip_select_high ()
 Deactivates the chip select for all lines.
 
static HAL_StatusTypeDef _SPI_fast_receive (SPI_HandleTypeDef *hspi, uint8_t *response, uint16_t response_size)
 Use DMA to speed up receiving. At least 3x faster than HAL_SPI_Receive when transferring 2048 bytes.
 
FLASH_error_enum_t FLASH_SPI_send_command (const FLASH_SPI_Data_t cmd[], uint8_t chip_number)
 
FLASH_error_enum_t FLASH_SPI_send_command_with_data (const FLASH_SPI_Data_t cmd[], FLASH_SPI_Data_t *data, uint8_t chip_number)
 
FLASH_error_enum_t FLASH_SPI_send_command_receive_response (const FLASH_SPI_Data_t cmd[], uint8_t *response, uint16_t response_size, uint8_t chip_number)
 
void FLASH_SPI_enable_then_disable_chip_select (uint8_t chip_number)
 
void HAL_SPI_RxCpltCallback (SPI_HandleTypeDef *hspi)
 

Variables

SPI_HandleTypeDef * hspi_flash_ptr = &hspi1
 
const uint16_t FLASH_SPI_TIMEOUT_MS = 25
 
volatile uint8_t SPI_DMA_receive_complete = 0
 

Function Documentation

◆ _chip_select_high()

static void _chip_select_high ( )
inlinestatic

Deactivates the chip select for all lines.

Here is the caller graph for this function:

◆ _chip_select_low()

static void _chip_select_low ( uint8_t chip_number)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _SPI_fast_receive()

static HAL_StatusTypeDef _SPI_fast_receive ( SPI_HandleTypeDef * hspi,
uint8_t * response,
uint16_t response_size )
static

Use DMA to speed up receiving. At least 3x faster than HAL_SPI_Receive when transferring 2048 bytes.

Here is the caller graph for this function:

◆ FLASH_SPI_enable_then_disable_chip_select()

void FLASH_SPI_enable_then_disable_chip_select ( uint8_t chip_number)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FLASH_SPI_send_command()

FLASH_error_enum_t FLASH_SPI_send_command ( const FLASH_SPI_Data_t cmd[],
uint8_t chip_number )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FLASH_SPI_send_command_receive_response()

FLASH_error_enum_t FLASH_SPI_send_command_receive_response ( const FLASH_SPI_Data_t cmd[],
uint8_t * response,
uint16_t response_size,
uint8_t chip_number )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FLASH_SPI_send_command_with_data()

FLASH_error_enum_t FLASH_SPI_send_command_with_data ( const FLASH_SPI_Data_t cmd[],
FLASH_SPI_Data_t * data,
uint8_t chip_number )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HAL_SPI_RxCpltCallback()

void HAL_SPI_RxCpltCallback ( SPI_HandleTypeDef * hspi)

Variable Documentation

◆ FLASH_SPI_TIMEOUT_MS

const uint16_t FLASH_SPI_TIMEOUT_MS = 25

◆ hspi_flash_ptr

SPI_HandleTypeDef* hspi_flash_ptr = &hspi1

◆ SPI_DMA_receive_complete

volatile uint8_t SPI_DMA_receive_complete = 0