Microchip® Advanced Software Framework

twi_slave_example.c File Reference

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

static void twi_Receive_Success ( void  )
static

TWI receive success indication through yellow LED On.

References LED_On, and twi_slave_status_reset().

Referenced by main().

static void twi_Transmission_Failure ( void  )
static

TWI transmission failure indication through red LED On.

References LED_On, and twi_slave_status_reset().

Referenced by main().

static void twi_Transmit_Success ( void  )
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[]
Initial value:
= {
0x05,
0x15,
0x25,
0x35,
0x45,
0x55,
0x65,
0x75,
0x85
}