mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Fri Jul 17 09:15:10 2015 +0100
Revision:
592:a274ee790e56
Parent:
579:53297373a894
Synchronized with git revision e7144f83a8d75df80c4877936b6ffe552b0be9e6

Full URL: https://github.com/mbedmicro/mbed/commit/e7144f83a8d75df80c4877936b6ffe552b0be9e6/

More API implementation for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 579:53297373a894 1 /**
mbed_official 579:53297373a894 2 * \page asfdoc_sam0_sercom_i2c_slave_basic_use_case Quick Start Guide for SERCOM I2C Slave - Basic
mbed_official 579:53297373a894 3 *
mbed_official 579:53297373a894 4 * In this use case, the I<SUP>2</SUP>C will used and set up as follows:
mbed_official 579:53297373a894 5 * - Slave mode
mbed_official 579:53297373a894 6 * - 100KHz operation speed
mbed_official 579:53297373a894 7 * - Not operational in standby
mbed_official 579:53297373a894 8 * - 10000 packet timeout value
mbed_official 579:53297373a894 9 *
mbed_official 579:53297373a894 10 * \section asfdoc_sam0_sercom_i2c_slave_basic_use_case_prereq Prerequisites
mbed_official 579:53297373a894 11 * The device must be connected to an I<SUP>2</SUP>C master.
mbed_official 579:53297373a894 12 *
mbed_official 579:53297373a894 13 * \section asfdoc_sam0_sercom_i2c_slave_basic_use_case_setup_code Setup
mbed_official 579:53297373a894 14 *
mbed_official 579:53297373a894 15 * \subsection asfdoc_sam0_sercom_i2c_slave_basic_use_setup_code Code
mbed_official 579:53297373a894 16 * The following must be added to the user application:
mbed_official 579:53297373a894 17 *
mbed_official 579:53297373a894 18 * A sample buffer to write from, a sample buffer to read to and length of buffers:
mbed_official 579:53297373a894 19 * \snippet qs_i2c_slave_basic_use.c packet_data
mbed_official 579:53297373a894 20 *
mbed_official 579:53297373a894 21 * Address to respond to:
mbed_official 579:53297373a894 22 * \snippet qs_i2c_slave_basic_use.c address
mbed_official 579:53297373a894 23 *
mbed_official 579:53297373a894 24 * Globally accessible module structure:
mbed_official 579:53297373a894 25 * \snippet qs_i2c_slave_basic_use.c module
mbed_official 579:53297373a894 26 *
mbed_official 579:53297373a894 27 * Function for setting up the module:
mbed_official 579:53297373a894 28 * \snippet qs_i2c_slave_basic_use.c initialize_i2c
mbed_official 579:53297373a894 29 *
mbed_official 579:53297373a894 30 * Add to user application \c main():
mbed_official 579:53297373a894 31 * \snippet qs_i2c_slave_basic_use.c run_initialize_i2c
mbed_official 579:53297373a894 32 *
mbed_official 579:53297373a894 33 * \subsection asfdoc_sam0_sercom_i2c_slave_basic_use_setup_workflow Workflow
mbed_official 579:53297373a894 34 * -# Configure and enable module.
mbed_official 579:53297373a894 35 * \snippet qs_i2c_slave_basic_use.c config
mbed_official 579:53297373a894 36 * -# Create and initialize configuration structure.
mbed_official 579:53297373a894 37 * \snippet qs_i2c_slave_basic_use.c init_conf
mbed_official 579:53297373a894 38 * -# Change address and address mode settings in the configuration.
mbed_official 579:53297373a894 39 * \snippet qs_i2c_slave_basic_use.c conf_changes
mbed_official 579:53297373a894 40 * -# Initialize the module with the set configurations.
mbed_official 579:53297373a894 41 * \snippet qs_i2c_slave_basic_use.c init_module
mbed_official 579:53297373a894 42 * -# Enable the module.
mbed_official 579:53297373a894 43 * \snippet qs_i2c_slave_basic_use.c enable_module
mbed_official 579:53297373a894 44 * -# Create variable to hold transfer direction.
mbed_official 579:53297373a894 45 * \snippet qs_i2c_slave_basic_use.c dir
mbed_official 579:53297373a894 46 * -# Create packet variable to transfer.
mbed_official 579:53297373a894 47 * \snippet qs_i2c_slave_basic_use.c pack
mbed_official 579:53297373a894 48 *
mbed_official 579:53297373a894 49 * \section asfdoc_sam0_sercom_i2c_slave_basic_use_implementation Implementation
mbed_official 579:53297373a894 50 * \subsection asfdoc_sam0_sercom_i2c_slave_basic_use_implementation_code Code
mbed_official 579:53297373a894 51 * Add to user application \c main():
mbed_official 579:53297373a894 52 * \snippet qs_i2c_slave_basic_use.c while
mbed_official 579:53297373a894 53 * \subsection i2c_slave_basic_use_implementation_workflow Workflow
mbed_official 579:53297373a894 54 * -# Wait for start condition from master and get transfer direction.
mbed_official 579:53297373a894 55 * \snippet qs_i2c_slave_basic_use.c get_dir
mbed_official 579:53297373a894 56 * -# Depending on transfer direction, set up buffer to read to or write from,
mbed_official 579:53297373a894 57 * and write or read from master.
mbed_official 579:53297373a894 58 * \snippet qs_i2c_slave_basic_use.c transfer
mbed_official 579:53297373a894 59 */
mbed_official 579:53297373a894 60 /**
mbed_official 579:53297373a894 61 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
mbed_official 579:53297373a894 62 */
mbed_official 579:53297373a894 63
mbed_official 579:53297373a894 64 #include <asf.h>
mbed_official 579:53297373a894 65 #include <conf_clocks.h>
mbed_official 579:53297373a894 66