1 /* 2 * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 * 4 * This file is part of HackRF. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; see the file COPYING. If not, write to 18 * the Free Software Foundation, Inc., 51 Franklin Street, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef __SPI_SSP_H__ 23 #define __SPI_SSP_H__ 24 25 #include <stdint.h> 26 #include <stddef.h> 27 28 #include "spi_bus.h" 29 30 #include "gpio.h" 31 32 #include <libopencm3/lpc43xx/ssp.h> 33 34 typedef struct ssp_config_t { 35 ssp_datasize_t data_bits; 36 uint8_t serial_clock_rate; 37 uint8_t clock_prescale_rate; 38 gpio_t gpio_select; 39 } ssp_config_t; 40 41 void spi_ssp_start(spi_bus_t* const bus, const void* const config); 42 void spi_ssp_stop(spi_bus_t* const bus); 43 void spi_ssp_transfer(spi_bus_t* const bus, void* const data, const size_t count); 44 void spi_ssp_transfer_gather(spi_bus_t* const bus, const spi_transfer_t* const transfers, const size_t count); 45 46 #endif/*__SPI_SSP_H__*/ 47