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.

40 lines
934 B

#ifndef SPI_PROTO_H
#define SPI_PROTO_H
#include <stdint.h>
/***** MASTER *****/
#define SPI_WRITE_DATA 0x01
#define SPI_READ_DATA 0x10
#define SPI_NONE 0
uint16_t spi_master_communicate(uint8_t opcode, uint8_t address, uint16_t value)
uint8_t spi_proto_needs(uint8_t opcode);
uint16_t read_temperature(uint8_t number);
uint8_t read_var8(uint8_t number);
uint16_t read_var16(uint8_t number);
void write_var8(uint8_t number, uint8_t value);
void write_var16(uint8_t number, uint16_t value);
void call_func(uint8_t number);
/***** MASTER END *****/
/***** SLAVE *****/
/*
extern uint16_t *spi_proto_globals8[];
extern uint8_t *spi_proto_globals16[];
extern funptr_t spi_proto_funcs[];
*/
#include "spi_pointers.h"
uint8_t spi_proto_needswrite(uint8_t opcode);
uint16_t spi_proto_handlewrite(uint8_t opcode, uint8_t addr);
void spi_proto_handleread(uint8_t opcode, uint8_t addr, uint16_t data);
/***** SLAVE END *****/
#endif