TWIM Master Example for SAM.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
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, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, and stdio_serial_init().
Referenced by main().
|
static |
Initialize the TWIM module.
References cpu_speed, EXAMPLE_TWIM, sysclk_get_peripheral_bus_hz(), twim_config::twim_clk, twim_default_callback(), TWIM_MASTER_SPEED, 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_OK, sysclk_init(), write_data, and write_test().
|
static |
Read the data pattern from the target.
References EXAMPLE_TWIM, packet_rx, PATTERN_TEST_LENGTH, read_data, TARGET_ADDR_LGT, TARGET_ADDRESS, twi_master_read(), and VIRTUALMEM_ADDR.
Referenced by main().
|
static |
Write the data pattern to the target.
References EXAMPLE_TWIM, packet_tx, PATTERN_TEST_LENGTH, TARGET_ADDR_LGT, TARGET_ADDRESS, twi_master_write(), VIRTUALMEM_ADDR, and write_data.
Referenced by main().
uint32_t cpu_speed = 0 |
Referenced by init_test().
twi_package_t packet_rx |
Referenced by read_test().
twi_package_t packet_tx |
TWI data package.
Referenced by write_test().
uint8_t read_data[PATTERN_TEST_LENGTH] |
Array to store the received test data.
Referenced by main(), and read_test().
const uint8_t write_data[] |
Array to store the test data for sending.
Referenced by main(), and write_test().