TWIM Master Example for SAM.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include "conf_example.h"
#include "sleepmgr.h"
Macros | |
#define | PATTERN_TEST_LENGTH (sizeof(write_data)/sizeof(uint8_t)) |
Functions | |
static void | configure_console (void) |
Configure serial console. More... | |
static status_code_t | init_test (void) |
Initialize the TWIM module. More... | |
static status_code_t | read_test (void) |
Read the data pattern from the target. More... | |
static status_code_t | write_test (void) |
Write the data pattern to the target. More... | |
int | main (void) |
Variables | |
uint32_t | cpu_speed = 0 |
twi_package_t | packet_rx |
twi_package_t | packet_tx |
TWI data package. More... | |
uint8_t | read_data [PATTERN_TEST_LENGTH] |
Array to store the received test data. More... | |
const uint8_t | write_data [] |
Array to store the test data for sending. More... | |
#define PATTERN_TEST_LENGTH (sizeof(write_data)/sizeof(uint8_t)) |
Referenced by main(), read_test(), and write_test().
|
static |
Configure serial console.
References uart_rs232_options::baudrate, and stdio_serial_init().
Referenced by main().
|
static |
Initialize the TWIM module.
References cpu_speed, sysclk_get_peripheral_bus_hz(), twim_config::twim_clk, twim_default_callback(), twim_set_callback(), and twim_set_config().
Referenced by main().
int main | ( | void | ) |
References board_init(), BOARD_NAME, configure_console(), init_test(), PATTERN_TEST_LENGTH, read_data, read_test(), sleepmgr_enter_sleep(), status, STATUS_OK, sysclk_init(), write_data, and write_test().
|
static |
Read the data pattern from the target.
References packet_rx, PATTERN_TEST_LENGTH, read_data, and twi_master_read().
Referenced by main().
|
static |
Write the data pattern to the target.
References packet_tx, PATTERN_TEST_LENGTH, twi_master_write(), and write_data.
Referenced by main().
uint32_t cpu_speed = 0 |
Referenced by init_test().
twi_package_t packet_rx |
Referenced by read_test(), and read_test_pdca().
twi_package_t packet_tx |
TWI data package.
Referenced by write_test(), and write_test_pdca().
uint8_t read_data[PATTERN_TEST_LENGTH] |
Array to store the received test data.
Referenced by main(), read_test(), and read_test_pdca().
const uint8_t write_data[] |
Array to store the test data for sending.
Referenced by flash_rw_example(), main(), write_test(), and write_test_pdca().