Developer World
Spresense SDK Library release-v1.2.0-627f51e
Functions
Functions
Collaboration diagram for Functions:

Functions

FAR struct seq_s * seq_open (int type, int bustype)
 
void seq_close (FAR struct seq_s *seq)
 
int seq_read (FAR struct seq_s *seq, int fifoid, char *buffer, int length)
 
int seq_ioctl (FAR struct seq_s *seq, int fifoid, int cmd, unsigned long arg)
 
int seq_setinstruction (FAR struct seq_s *seq, const uint16_t *inst, uint16_t nr_insts)
 
void seq_setsample (FAR struct seq_s *seq, uint8_t sample, uint8_t offset, uint8_t elemsize, bool swapbyte)
 
void seq_setaddress (FAR struct seq_s *seq, uint32_t slave_addr)
 
int scu_spitransfer (int slavesel, uint16_t *inst, uint32_t nr_insts, uint8_t *buffer, int len)
 
int scu_i2ctransfer (int port, int slave, uint16_t *inst, uint32_t nr_insts, uint8_t *buffer, int len)
 
void scu_initialize (void)
 
void scu_uninitialize (void)
 

Detailed Description

Function Documentation

◆ scu_i2ctransfer()

int scu_i2ctransfer ( int  port,
int  slave,
uint16_t *  inst,
uint32_t  nr_insts,
uint8_t *  buffer,
int  len 
)

I2C data transfer via sequencer

This function use 'oneshot' feature on SCU. So user unnecessary to specify any opened sequencer. This function usefull for accessing register directly.

Parameters
[in]port: I2C port (0 or 1)
[in]slave: Slave address
[in]inst: Sequencer instruction
[in]nr_insts: Number of instructions
[out]buffer: Pointer to receive buffer, if no need to receive, then NULL.
[in]len: buffer length (ignored when buffer is NULL)
Returns
OK(0) is success. negative value is failure.

◆ scu_initialize()

void scu_initialize ( void  )

Initialize SCU

Warning
This API called from board_app_initialize(). Do not call this API from each sensor drivers.

◆ scu_spitransfer()

int scu_spitransfer ( int  slavesel,
uint16_t *  inst,
uint32_t  nr_insts,
uint8_t *  buffer,
int  len 
)

SPI data transfer via sequencer.

This function use 'oneshot' feature on SCU. So user unnecessary to specify any opened sequencer. This function usefull for accessing register directly.

Parameters
[in]slavesel: Slave select
[in]inst: Sequencer instruction
[in]nr_insts: Number of instructions
[out]buffer: Pointer to receive buffer, if no need to receive, then NULL.
[in]len: buffer length (ignored when buffer is NULL)
Returns
OK(0) is success. negative value is failure.

◆ scu_uninitialize()

void scu_uninitialize ( void  )

Uninitialize SCU

Warning
This API called from board_app_initialize(). Do not call this API from each sensor drivers.

◆ seq_close()

void seq_close ( FAR struct seq_s *  seq)

Close sequencer device

Parameters
[in]seq: Sequencer instance

◆ seq_ioctl()

int seq_ioctl ( FAR struct seq_s *  seq,
int  fifoid,
int  cmd,
unsigned long  arg 
)

Sequencer specific ioctl

This API should be called from each sensor driver ioctl().

Parameters
[in]seq: Sequencer instance
[in]fifoid: FIFO ID (decimator only)
[in]cmd: ioctl commands (SCUIOC_*).
[in,out]arg: Argument for each commands
See also
IOCTL commands
Returns
OK(0) is success. negative value is failure.

◆ seq_open()

FAR struct seq_s* seq_open ( int  type,
int  bustype 
)

Open sequencer

Parameters
[in]type: Sequencer type. Set one of the following definitions.
[in]bustype: Bustype. Set one of the foollowing definitions.
Returns
struct seq_s pointer is success. NULL is failure.

◆ seq_read()

int seq_read ( FAR struct seq_s *  seq,
int  fifoid,
char *  buffer,
int  length 
)

Read sequencer FIFO data

Parameters
[in]seq: Sequencer instance
[in]fifoid: FIFO ID (decimator only)
[out]buffer: Pointer to data receive buffer
[in]length: Buffer length
Returns
OK(0) is success. negative value is failure.

◆ seq_setaddress()

void seq_setaddress ( FAR struct seq_s *  seq,
uint32_t  slave_addr 
)

Set slave ID or address

Parameters
[in]seq: An instance of sequencer
[in]slave_addr: In SPI, slave select ID. In I2C, bus address.

◆ seq_setinstruction()

int seq_setinstruction ( FAR struct seq_s *  seq,
const uint16_t *  inst,
uint16_t  nr_insts 
)

Set cyclic sequencer instruction

Parameters
[in]seq: Sequencer instance
[in]inst: Pointer to instruction array
[in]nr_insts: Number of instructions
Returns
OK(0) is success. negative value is failure.

◆ seq_setsample()

void seq_setsample ( FAR struct seq_s *  seq,
uint8_t  sample,
uint8_t  offset,
uint8_t  elemsize,
bool  swapbyte 
)

Set sample data format

Parameters
[in]seq: Sequencer instance
[in]sample: Bytes per sample
[in]offset: Start offset of sampling data
[in]elemsize: Bytes of 1 element in sample
[in]swapbyte: Enable/Disable byte swapping
Returns
OK(0) is success. negative value is failure.