SDK4.0 This document shows Ameba SDK 4.0 APIs

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

spi_api.h File Reference

This file provides following mbed SPI API. More...

`#include "device.h"`

## Enumerations
AmebaZ Only
enum | MBED_SPI_IDX { MBED_SPI0 = 0xF0, MBED_SPI1 = 0xF1 }

## Ameba Common
typedef struct spi_s | spi_t
void | spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
| Initializes the SPI device, include clock/function/interrupt/SPI registers. More...
void | spi_free (spi_t *obj)
| Deinitializes the SPI device, include interrupt/DMA/DISABLE SPI. More...
void | spi_format (spi_t *obj, int bits, int mode, int slave)
| Set SPI format,include DFS/Phase/Polarity. More...
void | spi_frequency (spi_t *obj, int hz)
| Set SPI baudrate. More...
int | spi_master_write (spi_t *obj, int value)
| Master send one frame use SPI. More...
int | spi_slave_receive (spi_t *obj)
| Get slave readable && busy state. More...
int | spi_slave_read (spi_t *obj)
| Slave receive one frame use SPI. More...
void | spi_slave_write (spi_t *obj, int value)
| Slave send one frame use SPI. More...
int | spi_busy (spi_t *obj)
| Get SPI busy state. More...
void | spi_flush_rx_fifo (spi_t *obj)
| SPI device to flush rx fifo. More...
void | spi_enable (spi_t *obj)
| Open SPI device clock. More...
void | spi_disable (spi_t *obj)
| Close SPI device clock. More...

## Detailed Description

This file provides following mbed SPI API.

mbed Microcontroller Library

Author

Version
  V1.0.0

Attention

Copyright (c) 2006-2013 ARM Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.