Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Lab_6_WaG by
spi.h
00001 /****************************************************************************** 00002 * EECS 397 00003 * 00004 * Assignment Name: Lab 6: WaG 00005 * 00006 * Authors: Sam Morrison and Phong Nguyen 00007 * File name: spi.h 00008 * Purpose: Header for SPI driver 00009 * 00010 * Created: 03/01/2018 00011 * Last Modified: 03/29/2018 00012 * 00013 ******************************************************************************/ 00014 00015 #ifndef SPI_H 00016 #define SPI_H 00017 00018 #define SPI_NO_ID 0 00019 #define SPI_AS1107_ID 1 00020 #define AS1107_SPI_FREQ 1000000 00021 #define AS1107_SPI_NO_BITS 16 00022 00023 #include "mbed.h" 00024 #include "io_pins.h" 00025 00026 extern SPI wag_spi; 00027 00028 struct spi_cfg { 00029 int spi_id; //ID should be unique for each slave type 00030 DigitalOut spi_ncs; //The pin driving the slave's chip select 00031 int spi_mode; //SPI mode needed by this slave 00032 int spi_freq; //SPI frequency needed by this slave 00033 int spi_no_bits; //No. of data bits to be transfered each send to the slave 00034 }; 00035 00036 void spi_send(struct spi_cfg spi_config, int spi_data); 00037 00038 #endif
Generated on Mon Jul 18 2022 00:36:30 by
