#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_transceive(uint8_t opcode, uint8_t address, uint16_t value);


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"

uint16_t spi_proto_slaveaction(uint8_t opcode, uint8_t addr, uint16_t data);

/***** SLAVE END *****/

#endif
