Newer
Older
avrrfm / spi.h
@Torsten Römer Torsten Römer on 28 Jan 2025 646 bytes Initial commit
/* 
 * File:   spi.h
 * Author: torsten.roemer@luniks.net
 *
 * Created on 1. April 2023, 19:12
 */

#ifndef SPI_H
#define SPI_H

#include <stdio.h>
#include <avr/io.h>
#include "pins.h"

/**
 * Sets slow SPI speed.
 */
void spiSlow(void);

/**
 * Sets fast SPI speed.
 */
void spiFast(void);

/**
 * Selects the radio to talk to via SPI.
 */
void radioSel(void);

/**
 * Deselects the display to talk to via SPI.
 */
void radioDes(void);

/**
 * Transmits the given byte and returns the byte reveived at the same time.
 * @param data byte to be written
 * @return byte read while writing
 */
uint8_t transmit(uint8_t data);

#endif /* SPI_H */