HT32SX Monarch Scan
Monarch Scan application for HT32SX
spi.h File Reference

: This file provides code for the configuration of the SPI instances. More...

#include "main.h"

Go to the source code of this file.

Functions

void MX_SPI1_Init (void)
 
uint16_t S2LPSpiWriteRegisters (uint8_t address, uint8_t n_bytes, uint8_t *buffer)
 SPI function to write registers of a slave device. More...
 
uint16_t S2LPSpiReadRegisters (uint8_t RegisterAddr, uint8_t NumByteToRead, uint8_t *pBuffer)
 SPI function to read registers from a slave device. More...
 
void S2LPSetSpiInUse (uint8_t state)
 Set the S2LP in use flag. More...
 
uint8_t S2LPGetSpiInUse (void)
 Get the S2LP in use flag. More...
 
uint16_t S2LPSpiCommandStrobes (uint8_t command)
 
uint16_t S2LPSpiReadFifo (uint8_t n_bytes, uint8_t *buffer)
 
uint16_t S2LPSpiWriteFifo (uint8_t n_bytes, uint8_t *buffer)
 

Variables

SPI_HandleTypeDef hspi1
 

Detailed Description

: This file provides code for the configuration of the SPI instances.

Attention

© Copyright (c) 2019 STMicroelectronics. All rights reserved.

This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause

Function Documentation

◆ S2LPGetSpiInUse()

uint8_t S2LPGetSpiInUse ( void  )

Get the S2LP in use flag.


Parameters
[in]none
[out]none
Return values
spi_in_use1 if in use, else 0

◆ S2LPSetSpiInUse()

void S2LPSetSpiInUse ( uint8_t  state)

Set the S2LP in use flag.


Parameters
[in]state1 if in use, else 0
[out]none
Return values
none

◆ S2LPSpiReadRegisters()

uint16_t S2LPSpiReadRegisters ( uint8_t  RegisterAddr,
uint8_t  NumByteToRead,
uint8_t *  pBuffer 
)

SPI function to read registers from a slave device.

Parameters
RegisterAddrregister address
NumByteToReadnumber of byte to read
pBufferbuffer to retrieve data from a slave
Return values
ErrorStatuserror status ErrorStatus This parameter can be: SUCCESS or ERROR.

◆ S2LPSpiWriteRegisters()

uint16_t S2LPSpiWriteRegisters ( uint8_t  address,
uint8_t  n_bytes,
uint8_t *  buffer 
)

SPI function to write registers of a slave device.

Parameters
RegisterAddrregister address
NumByteToReadnumber of byte to write
pBufferbuffer contains data to write
Return values
ErrorStatuserror status ErrorStatus This parameter can be: SUCCESS or ERROR.