megaRF example for twi as slave
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include <conf_twi.h>
Macros | |
#define | SLAVE_BUS_ADDR 0xB0 /* !< TWI slave bus address */ |
#define | TWI_GCE 0x01 /* !< TWI slave general call enable */ |
Functions | |
int | main (void) |
TWI Slave Example Main. More... | |
static void | twi_Receive_Success (void) |
TWI receive success indication through yellow LED On. More... | |
static void | twi_Transmission_Failure (void) |
TWI transmission failure indication through red LED On. More... | |
static void | twi_Transmit_Success (void) |
TWI transmit success indication through green LED On. More... | |
Slave memory Test Pattern Constants | |
#define | PATTERN_TEST_LENGTH sizeof(test_pattern) |
const uint8_t | test_pattern [] |
uint8_t | data_received [PATTERN_TEST_LENGTH] = {0} |
#define PATTERN_TEST_LENGTH sizeof(test_pattern) |
#define SLAVE_BUS_ADDR 0xB0 /* !< TWI slave bus address */ |
Referenced by main().
#define TWI_GCE 0x01 /* !< TWI slave general call enable */ |
Referenced by main().
int main | ( | void | ) |
TWI Slave Example Main.
Main function.
The SAM3X_EK, SAM3X Arduino board and SAM4C_EK use two bytes length internal address EEPROM.
References board_init(), cpu_irq_enable, data_buffer, data_received, slave_data_buffer_t::rx_buffer, SLAVE_BUS_ADDR, sysclk_enable_peripheral_clock(), sysclk_init(), test_pattern, TWI_GCE, TWI_IDLE, twi_Receive_Success(), twi_slave_init(), twi_slave_start(), twi_slave_state_get(), twi_slave_status_get(), TWI_STATUS_NO_STATE, TWI_STATUS_RX_COMPLETE, TWI_STATUS_TX_COMPLETE, twi_Transmission_Failure(), and twi_Transmit_Success().
|
static |
TWI receive success indication through yellow LED On.
References LED_On, and twi_slave_status_reset().
Referenced by main().
|
static |
TWI transmission failure indication through red LED On.
References LED_On, and twi_slave_status_reset().
Referenced by main().
|
static |
TWI transmit success indication through green LED On.
References LED_On, and twi_slave_status_reset().
Referenced by main().
uint8_t data_received[PATTERN_TEST_LENGTH] = {0} |
Referenced by main(), sio2host_rx(), and sio2ncp_rx().
const uint8_t test_pattern[] |