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.
31 lines
752 B
31 lines
752 B
#ifndef __SPI_H
|
|
#define __SPI_H
|
|
|
|
#include "spi_proto.h"
|
|
|
|
#include "spi_config.h"
|
|
|
|
|
|
// copied/adapted from usbdrv.h
|
|
#define SPI_CONCAT(a, b) a ## b
|
|
|
|
#define SPI_OUTPORT(name) SPI_CONCAT(PORT, name)
|
|
#define SPI_INPORT(name) SPI_CONCAT(PIN, name)
|
|
#define SPI_DDRPORT(name) SPI_CONCAT(DDR, name)
|
|
|
|
#define SPI_SSOUT SPI_OUTPORT(SPI_SS_PORT)
|
|
#define SPI_SSIN SPI_INPORT(SPI_SS_PORT)
|
|
#define SPI_SSDDR SPI_DDRPORT(SPI_SS_PORT)
|
|
|
|
void spi_init();
|
|
void spi_mst_start_packet();
|
|
void spi_mst_end_packet();
|
|
void spi_mst_write(uint8_t len, uint8_t *data);
|
|
void spi_mst_read(uint8_t len, uint8_t *data);
|
|
void spi_mst_write_read(uint8_t len, uint8_t *data);
|
|
void spi_mst_packet_delay();
|
|
void spi_sla_handle_packet();
|
|
|
|
|
|
#endif
|