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.
42 lines
1.1 KiB
42 lines
1.1 KiB
/*
|
|
* i2s.h
|
|
*
|
|
* Created on: 2019-3-7
|
|
* Author: abagu
|
|
*/
|
|
|
|
#ifndef I2S_H_
|
|
#define I2S_H_
|
|
#include <stdint.h>
|
|
|
|
#include "i2c.h"
|
|
/*
|
|
* i2c swith to spi brigh (SC18IS602BXXX)
|
|
* */
|
|
|
|
typedef enum {
|
|
SC18_SPI_CLK_MODE_0 = 0, /*Clock Mode with Polarity = 0 and Phase = 0*/
|
|
SC18_SPI_CLK_MODE_1, /*Clock Mode with Polarity = 0 and Phase = 1*/
|
|
SC18_SPI_CLK_MODE_2, /*Clock Mode with Polarity = 1 and Phase = 0*/
|
|
SC18_SPI_CLK_MODE_3, /*Clock Mode with Polarity = 1 and Phase = 1*/
|
|
SC18_SPI_CLK_MODE_UNK
|
|
}eSC18_SPI_CLK_MODE;
|
|
|
|
typedef enum {
|
|
SC18_SPI_SPEED_1843K = 0,
|
|
SC18_SPI_SPEED_461K,
|
|
SC18_SPI_SPEED_115K,
|
|
SC18_SPI_SPEED_58K,
|
|
SC18_SPI_SPEED_UNK
|
|
}eSC18_SPI_SPEED;
|
|
|
|
typedef struct sc18is602_fmt {
|
|
eSC18_SPI_CLK_MODE mode; /*Clock Phase and Polarity mode*/
|
|
eSC18_SPI_SPEED speed; /*speed eg: 25000000- 25 M*/
|
|
int endian; /*0-Most significant bit is shifed out first*/
|
|
}sc18_spi_fmt_s;
|
|
|
|
int sc18_init(sc18_spi_fmt_s *fmt, i2c_t i2c);
|
|
int sc18_xfer(int cs, uint8_t *tx, uint32_t tx_elms, uint8_t *rx, uint32_t rx_elms);
|
|
void sc18_clear(void);
|
|
#endif /* I2S_H_ */
|
|
|