Microchip® Advanced Software Framework

twihs_master_example.c File Reference

TWIHS MASTER Example for SAM.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include "asf.h"
#include "stdio_serial.h"
#include "conf_board.h"
#include "led.h"

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
Value:
"--TWIHS MASTER Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Name of the board.
Definition: same70_xplained.h:75
#define STRING_EOL
Definition: twihs_master_example.c:107

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 void configure_console ( void  )
static
static void mdelay ( uint32_t  ul_dly_ticks)
static

Wait for the given number of milliseconds (using the dwTimeStamp generated by the SAM microcontrollers' system tick).

Parameters
ul_dly_ticksDelay 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().

uint8_t gs_uc_test_data_rx[TEST_DATA_LENGTH] = { 0 }
static

Reception buffer.

Referenced by main().

const uint8_t test_data_tx[]
static
Initial value:
= {
'S', 'A', 'M', ' ', 'T', 'W', 'I', ' ',
'E', 'E', 'P', 'R', 'O', 'M', ' ',
'E', 'X', 'A', 'M', 'P', 'L', 'E'
}