TWIHS MASTER Example for SAM.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | AT24C_ADDRESS 0x50 |
Address of AT24C chips. More... | |
#define | EEPROM_MEM_ADDR 0 |
#define | EEPROM_MEM_ADDR_LENGTH 2 |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
#define | TEST_DATA_LENGTH (sizeof(test_data_tx) / sizeof(uint8_t)) |
Data to be sent. More... | |
#define | TWIHS_CLK 400000 |
TWI Bus Clock 400kHz. More... | |
#define | WAIT_TIME 10 |
EEPROM Wait Time. More... | |
Functions | |
static void | configure_console (void) |
Configure the Console UART. More... | |
int | main (void) |
Application entry point for TWI EEPROM example. More... | |
static void | mdelay (uint32_t ul_dly_ticks) |
Wait for the given number of milliseconds (using the dwTimeStamp generated by the SAM microcontrollers' system tick). More... | |
void | SysTick_Handler (void) |
Handler for System Tick interrupt. More... | |
Variables | |
volatile uint32_t | g_ul_ms_ticks = 0 |
Global timestamp in milliseconds since start of application. More... | |
static uint8_t | gs_uc_test_data_rx [TEST_DATA_LENGTH] = { 0 } |
Reception buffer. More... | |
static const uint8_t | test_data_tx [] |
#define AT24C_ADDRESS 0x50 |
Address of AT24C chips.
Referenced by main().
#define EEPROM_MEM_ADDR 0 |
Referenced by main().
#define EEPROM_MEM_ADDR_LENGTH 2 |
Referenced by main().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
#define TEST_DATA_LENGTH (sizeof(test_data_tx) / sizeof(uint8_t)) |
Data to be sent.
Referenced by main().
#define TWIHS_CLK 400000 |
TWI Bus Clock 400kHz.
Referenced by main().
#define WAIT_TIME 10 |
EEPROM Wait Time.
Referenced by main().
|
static |
Configure the Console UART.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, CONSOLE_UART_ID, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
Application entry point for TWI EEPROM example.
References twihs_packet::addr, twihs_packet::addr_length, AT24C_ADDRESS, board_init(), twihs_packet::buffer, twihs_packet::chip, configure_console(), EEPROM_MEM_ADDR, EEPROM_MEM_ADDR_LENGTH, gs_uc_test_data_rx, LED_Off, LED_On, twihs_packet::length, twihs_options::master_clk, mdelay(), pmc_enable_periph_clk(), twihs_options::speed, STRING_HEADER, sysclk_get_cpu_hz(), sysclk_get_peripheral_hz(), sysclk_init(), TEST_DATA_LENGTH, TWIHS_CLK, twihs_master_init(), twihs_master_read(), twihs_master_write(), TWIHS_SUCCESS, and WAIT_TIME.
|
static |
Wait for the given number of milliseconds (using the dwTimeStamp generated by the SAM microcontrollers' system tick).
ul_dly_ticks | Delay to wait for, in milliseconds. |
References g_ul_ms_ticks.
Referenced by main().
void SysTick_Handler | ( | void | ) |
Handler for System Tick interrupt.
Process System Tick Event increments the timestamp counter.
volatile uint32_t g_ul_ms_ticks = 0 |
Global timestamp in milliseconds since start of application.
Referenced by mdelay().
|
static |
Reception buffer.
Referenced by main().
|
static |