Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* spi.h - initialization of SPI device */
- #ifndef SPI_H
- #define SPI_H
- //#include "task.h"
- #include "sysconfig.h"
- #include <avr/io.h>
- #define FOSC 6400000
- #define CS (1<<PB4)
- #define MOSI (1<<PB5)
- #define MISO (1<<PB6)
- #define SCK (1<<PB7)
- #define CS_DDR DDRB
- #define CS_PORT PORTB
- #define CS_ENABLE() (CS_PORT &= ~CS) // set SS high
- #define CS_DISABLE() (CS_PORT |= CS) // set SS low
- /* function prototypes */
- void spi_init_master(void); // initialize spi master device (usually MC)
- unsigned char spi_write(unsigned char c); // write to slave device via spi
- char spi_command(bool cmd, unsigned long arg, bool crc, uint16_t read);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement