SAM4SD32 (SAM4S-EK2)
Loading...
Searching...
No Matches
twi_slave.h File Reference

TWI Slave driver for SAM. More...

#include "twi.h"
#include "sysclk.h"

Go to the source code of this file.

Macros

#define twi_slave_disable(p_twi)
#define twi_slave_enable(p_twi)

Typedefs

typedef Twitwi_slave_t
 This type can be used independently to refer to TWI slave module for the architecture used.

Functions

static void twi_slave_setup (twi_slave_t p_twi, uint32_t dw_device_addr)

Detailed Description

TWI Slave driver for SAM.

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

\cond ASF_LICENSE

Definition in file sam_twi/twi_slave.h.

Macro Definition Documentation

◆ twi_slave_disable

#define twi_slave_disable ( p_twi)
Value:
void twi_disable_slave_mode(Twi *p_twi)
Disable TWI slave mode.
Definition twi.c:501

Definition at line 91 of file sam_twi/twi_slave.h.

◆ twi_slave_enable

#define twi_slave_enable ( p_twi)
Value:
void twi_enable_slave_mode(Twi *p_twi)
Enable TWI slave mode.
Definition twi.c:486

Definition at line 89 of file sam_twi/twi_slave.h.

Function Documentation

◆ twi_slave_setup()

void twi_slave_setup ( twi_slave_t p_twi,
uint32_t dw_device_addr )
inlinestatic

Definition at line 45 of file sam_twi/twi_slave.h.

46{
47#if SAMG55
48 if (p_twi == TWI0) {
49 sysclk_enable_peripheral_clock(ID_FLEXCOM0);
50 } else if (p_twi == TWI1) {
51 sysclk_enable_peripheral_clock(ID_FLEXCOM1);
52 } else if (p_twi == TWI2) {
53 sysclk_enable_peripheral_clock(ID_FLEXCOM2);
54 } else if (p_twi == TWI3) {
55 sysclk_enable_peripheral_clock(ID_FLEXCOM3);
56 } else if (p_twi == TWI4) {
57 sysclk_enable_peripheral_clock(ID_FLEXCOM4);
58 } else if (p_twi == TWI5) {
59 sysclk_enable_peripheral_clock(ID_FLEXCOM5);
60 } else if (p_twi == TWI6) {
61 sysclk_enable_peripheral_clock(ID_FLEXCOM6);
62#ifdef _SAMG55_FLEXCOM7_INSTANCE_
63 } else if (p_twi == TWI7) {
64 sysclk_enable_peripheral_clock(ID_FLEXCOM7);
65#endif /* _SAMG55_FLEXCOM7_INSTANCE_*/
66 } else {
67 // Do Nothing
68 }
69#else
70#if (!(SAMG51 || SAMG53 || SAMG54))
71 if (p_twi == TWI0) {
72 sysclk_enable_peripheral_clock(ID_TWI0);
73 } else
74#endif
75 if (p_twi == TWI1) {
76 sysclk_enable_peripheral_clock(ID_TWI1);
77#if (SAM4N || SAMG)
78 } else if (p_twi == TWI2) {
79 sysclk_enable_peripheral_clock(ID_TWI2);
80#endif
81 } else {
82 // Do Nothing
83 }
84#endif
85
86 twi_slave_init(p_twi, dw_device_addr);
87}
void twi_slave_init(Twi *p_twi, uint32_t ul_device_addr)
Initialize TWI slave mode.
Definition twi.c:513
#define TWI0
(TWI0 ) Base Address
Definition sam4sd32c.h:419
#define ID_TWI1
Two Wire Interface 1 (TWI1).
Definition sam4sd32c.h:338
#define TWI1
(TWI1 ) Base Address
Definition sam4sd32c.h:421
#define ID_TWI0
Two Wire Interface 0 (TWI0).
Definition sam4sd32c.h:337

References ID_TWI0, ID_TWI1, TWI0, TWI1, and twi_slave_init().