#include "board.h"
#include "sysclk.h"
#include "twi_master.h"
#include "led.h"
#include "conf_board.h"
Macros | |
Local Configuration Constants | |
#define | EEPROM_BUS_ADDR 0x50 |
TWI slave bus address. More... | |
#define | EEPROM_MEM_ADDR 0xaa |
TWI slave memory address. More... | |
#define | TWI_SPEED 50000 |
TWI data transfer rate. More... | |
Functions | |
int | main (void) |
TWI Master Example Main. More... | |
Slave EEPROM memory Test Pattern Constants | |
#define | PATTERN_TEST_LENGTH sizeof(test_pattern) |
const uint8_t | test_pattern [] |
#define EEPROM_BUS_ADDR 0x50 |
TWI slave bus address.
Referenced by main().
#define EEPROM_MEM_ADDR 0xaa |
TWI slave memory address.
Referenced by main().
#define PATTERN_TEST_LENGTH sizeof(test_pattern) |
Referenced by main().
#define TWI_SPEED 50000 |
TWI data transfer rate.
Referenced by main().
int main | ( | void | ) |
TWI Master Example Main.
The master example begins by initializing required board resources. The system clock, basic GPIO pin mapping, and interrupt vectors are established.
A memory location on a TWI slave is written with a fixed test pattern which is then read back into a separate buffer. As a basic sanity check, the original write-buffer values are compared with values read from the slave to a separate buffer. An LED on the development board is illuminated when there is a match between the written and read data.
The SAM3X_EK, SAM3X Arduino board and SAM4C_EK use two bytes length internal address EEPROM.
References addr, board_init(), EEPROM_BUS_ADDR, EEPROM_MEM_ADDR, irq_initialize_vectors, length, PATTERN_TEST_LENGTH, sysclk_init(), test_pattern, twi_master_read(), twi_master_setup(), twi_master_write(), twi_package_t, TWI_SPEED, and TWI_SUCCESS.
const uint8_t test_pattern[] |
Referenced by main().