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.
30 lines
492 B
30 lines
492 B
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "iopins.h"
|
|
|
|
#define PIN_MISO 12
|
|
#define PIN_MOSI 11
|
|
#define PIN_SCK 13
|
|
#define PIN_SS 10
|
|
|
|
/** Set SS to active state (LOW) */
|
|
#define spi_ss_enable() pin_low(PIN_SS)
|
|
|
|
/** Set SS to disabled state (HIGH) */
|
|
#define spi_ss_disable() pin_high(PIN_SS)
|
|
|
|
|
|
/** Init SPI (for SD card communication) */
|
|
void spi_init();
|
|
|
|
|
|
/**
|
|
* Write / read a byte to SPI.
|
|
*
|
|
* @param ch the written byte
|
|
* @return received byte
|
|
*/
|
|
uint8_t spi_write(const uint8_t b);
|
|
|
|
|