firmware  v0.1.2
Chromation Spectrometer Dev-Kit
Functions
SpiMaster.h File Reference
#include <stdint.h>
#include "ReadWriteBits.h"
#include "Spi.h"

Go to the source code of this file.

Functions

uint8_t SpiMasterXfrByte (uint8_t byte)
 
void SpiMasterInit (void)
 

Detailed Description

API

void SpiMasterInit(void);
void SpiMasterXfrByte(uint8_t byte);

Definition in file SpiMaster.h.

Function Documentation

◆ SpiMasterInit()

void SpiMasterInit ( void  )
inline

SpiMasterInit behavior:

  • idles SlaveSelect high
  • makes SlaveSelect an output
  • makes Miso an input
  • enables pullup on Miso
  • makes DataReady an input
  • enables pullup on DataReady
  • makes Mosi an output
  • makes Sck an output
  • makes this MCU the SPI Master
  • sets SPI Clock to 10MHz ext osc divided by 8
  • enables the SPI hardware module
  • clears SPI interrupt flag

Definition at line 55 of file SpiMaster.h.

◆ SpiMasterXfrByte()

uint8_t SpiMasterXfrByte ( uint8_t  byte)
inline

SpiMasterXfrByte behavior:

  • selects the SPI slave
  • loads SPI data reg with the byte to send
  • waits until the transfer is done by reading the SPI Interrupt Flag
  • unselects the SPI slave
  • clears the SPI Interrupt Flag by reading the SPI data reg
  • returns the byte in the SPI data reg

Definition at line 21 of file SpiMaster.h.