Herzog Library 00.00.01  rel_libdev.herzog.00.00.01.10606
Functions | Variables
spi_device.c File Reference
#include <stdint.h>
#include <string.h>
#include "spi_device.h"
#include "errno.h"

Functions

void SPI_DevSetClockDivider (uint8_t div)
 Set Clock Divider for SPI Device. More...
 
SPI_Device_tSPI_devRequest (const char *name)
 Request a SPI Device. More...
 
int32_t SPI_devInit (SPI_Device_t *dev, SPI_Device_init_t *init)
 Initialize SPI device. More...
 
int32_t SPI_devReadData (SPI_Device_t *dev, uint8_t cmd, uint8_t *data, uint32_t len)
 Read Data from SPI device. More...
 
int32_t SPI_devWriteData (SPI_Device_t *dev, uint8_t cmd, uint8_t *data, uint32_t len)
 Write Data to SPI device. More...
 
void SPI_Handler (void)
 

Variables

static const SPI_Device_tSPI_DeviceTable []
 The instance of SPI device. More...
 

Detailed Description

This file is proprietary to Indie Semiconductor. All rights reserved. Reproduction or distribution, in whole or in part, is forbidden except by express written permission of Indie Semiconductor.

Function Documentation

int32_t SPI_devInit ( SPI_Device_t dev,
SPI_Device_init_t init 
)

Initialize SPI device.

Parameters
devThe pointer to SPI device
initPointer to the initialization data struct.
Returns
0 for success or error code upon a failure.
int32_t SPI_devReadData ( SPI_Device_t dev,
uint8_t  cmd,
uint8_t *  data,
uint32_t  len 
)

Read Data from SPI device.

Parameters
devThe pointer to SPI device
cmdThe enumeration of SPI command.
dataPointer to the returned data block from SPI device.
lenThe length of the data block to be returned from SPI device.
Returns
0 for success or error code upon a failure.
SPI_Device_t* SPI_devRequest ( const char *  name)

Request a SPI Device.

Parameters
nameThe name string of SPI device.
Returns
The pointer to the SPI device instance.
void SPI_DevSetClockDivider ( uint8_t  div)

Set Clock Divider for SPI Device.

Parameters
divThe enumeration of the divider.
Returns
None.
int32_t SPI_devWriteData ( SPI_Device_t dev,
uint8_t  cmd,
uint8_t *  data,
uint32_t  len 
)

Write Data to SPI device.

Parameters
devThe pointer to SPI device
cmdThe enumeration of SPI command.
dataPointer to the data block to be sent to SPI device.
lenThe length of the data block to be sent to SPI device.
Returns
0 for success or error code upon a failure.
void SPI_Handler ( void  )

Variable Documentation

const SPI_Device_t* SPI_DeviceTable[]
static
Initial value:
= {
NULL,
}

The instance of SPI device.

The table of SPI device instances supported by the platform.