SAM EDBG TWI Information Interface Example.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <string.h>
#include "conf_uart_serial.h"
Macros | |
#define | EDBG_ADDRESS 0x28; |
EDBG TWI interface address. More... | |
#define | EDBG_EXTEN_BOARDS_TOKEN 0xE1; |
Request token of EDBG TWI information interface. More... | |
#define | EDBG_KIT_DATA_TOKEN 0xD2; |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
#define | TIMEOUT 1000 |
Functions | |
static void | configure_console (void) |
Configure UART console. More... | |
static void | configure_i2c_master (void) |
Function for configuring I2C master module. More... | |
static void | decode_board_info (uint8_t *buffer) |
Function for show the extension boards information. More... | |
int | main (void) |
Main application. More... | |
static void | show_extension_boards_information (void) |
Function for show the extension boards information. More... | |
Variables | |
static struct usart_module | cdc_uart_module |
uint8_t | extension_info [64] |
uint8_t | extension_map [2] |
Extension board info structure. More... | |
struct i2c_master_module | i2c_master_instance |
I2C related structure. More... | |
struct i2c_master_packet | master_packet |
uint16_t | maximum_voltage |
uint16_t | minimum_current |
uint16_t | minimum_voltage |
uint8_t | read_buffer [1024] |
Read buffer. More... | |
#define EDBG_ADDRESS 0x28; |
EDBG TWI interface address.
Referenced by show_extension_boards_information().
#define EDBG_EXTEN_BOARDS_TOKEN 0xE1; |
Request token of EDBG TWI information interface.
Referenced by show_extension_boards_information().
#define EDBG_KIT_DATA_TOKEN 0xD2; |
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
#define TIMEOUT 1000 |
Referenced by show_extension_boards_information().
|
static |
Configure UART console.
References usart_config::baudrate, cdc_uart_module, CONF_STDIO_BAUDRATE, CONF_STDIO_MUX_SETTING, CONF_STDIO_PINMUX_PAD0, CONF_STDIO_PINMUX_PAD1, CONF_STDIO_PINMUX_PAD2, CONF_STDIO_PINMUX_PAD3, CONF_STDIO_USART_MODULE, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), and usart_get_config_defaults().
|
static |
Function for configuring I2C master module.
This function will configure the I2C master module with the SERCOM module to be used and pinmux settings
References i2c_master_enable(), i2c_master_get_config_defaults(), i2c_master_init(), i2c_master_instance, i2c_master_config::pinmux_pad0, and i2c_master_config::pinmux_pad1.
|
static |
Function for show the extension boards information.
show extension boards information
References extension_info, i, maximum_voltage, minimum_current, minimum_voltage, and printf.
Referenced by show_extension_boards_information().
int main | ( | void | ) |
Main application.
References configure_console(), configure_i2c_master(), show_extension_boards_information(), STRING_HEADER, and system_init().
|
static |
Function for show the extension boards information.
Send the request token
Get the extension boards info
Check and show info
show extension board info
References i2c_master_packet::address, i2c_master_packet::data, i2c_master_packet::data_length, decode_board_info(), EDBG_ADDRESS, EDBG_EXTEN_BOARDS_TOKEN, extension_map, i2c_master_packet::high_speed, i2c_master_packet::hs_master_code, i, i2c_master_instance, i2c_master_read_packet_wait(), i2c_master_write_packet_wait_no_stop(), j, master_packet, printf, read_buffer, STATUS_OK, i2c_master_packet::ten_bit_address, and TIMEOUT.
Referenced by main().
|
static |
uint8_t extension_info[64] |
Referenced by _decode_board_info(), and decode_board_info().
uint8_t extension_map[2] |
Extension board info structure.
Referenced by io1_board_get_info(), and show_extension_boards_information().
struct i2c_master_module i2c_master_instance |
I2C related structure.
struct i2c_master_packet master_packet |
Referenced by show_extension_boards_information().
uint16_t maximum_voltage |
Referenced by decode_board_info().
uint16_t minimum_current |
Referenced by decode_board_info().
uint16_t minimum_voltage |
Referenced by decode_board_info().
uint8_t read_buffer[1024] |
Read buffer.