Add [12_m1284p_WIZNET_HTTPServer_SDCARD_pages] prj

This commit is contained in:
maxxir_w
2019-01-18 14:35:51 +04:00
parent 4c8449a175
commit aa2ce7afd2
50 changed files with 17471 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#include <avr/io.h>
#include "spi.h"
/*
* Initialize SPI bus.
*/
void
spi_init(void)
{
// CS PIN for WIZNET ETHERNET
DDRB |= _BV(WIZNET_CS); // CS to OUT && Disable
SPI_WIZNET_DISABLE();
// CS PIN for SDCARD
DDRB |= _BV(SD_CS); // CS to OUT && Disable
SPI_SD_DISABLE();
/* Initalize ports for communication with SPI units. */
/* CSN=SS and must be output when master! */
DDRB |= _BV(MOSI) | _BV(SCK) | _BV(CSN);
PORTB |= _BV(MOSI) | _BV(SCK);
/* Enables SPI, selects "master", clock rate FCK / 4 - 4Mhz, and SPI mode 0 */
SPCR = _BV(SPE) | _BV(MSTR);
SPSR = 0x0;
//SPSR = _BV(SPI2X); //FCK / 2 - 8Mhz
}