Microchip® Advanced Software Framework

twis.c File Reference

TWIS driver for SAM.

This file defines a useful set of functions for the TWIS on SAM4L devices.

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

#include "twis.h"
#include "sleepmgr.h"

Macros

#define TWIS_SR_ERROR
 Define all error conditions. More...
 

Functions

void twis_disable (struct twis_dev_inst *const dev_inst)
 Disable TWIS Module. More...
 
void twis_enable (struct twis_dev_inst *const dev_inst)
 Enable TWIS Module. More...
 
static uint32_t twis_find_ch_num (Twis *const twis)
 Get TWIS channel number. More...
 
void twis_get_config_defaults (struct twis_config *const cfg)
 Get the TWIS master default configurations. More...
 
enum status_code twis_init (struct twis_dev_inst *const dev_inst, Twis *const twis, struct twis_config *config)
 Initialize the TWI Slave Module. More...
 
static void twis_interrupt_handler (uint32_t ch)
 TWIS interrupt handler. More...
 
void twis_set_callback (struct twis_dev_inst *const dev_inst, twis_interrupt_source_t source, twis_callback_t callback, uint8_t irq_level)
 Set callback for TWIS. More...
 
static void twis_set_config (struct twis_dev_inst *const dev_inst, struct twis_config *config)
 Configure the TWIS Module. More...
 

Variables

twis_callback_t twis_callback_pointer [TWIS_INST_NUM]
 
struct twis_dev_insttwis_instances [TWIS_INST_NUM]
 

#define TWIS_SR_ERROR
Value:
(TWIS_SR_BUSERR \
| TWIS_SR_SMBPECERR \
| TWIS_SR_SMBTOUT \
| TWIS_SR_ORUN \
| TWIS_SR_URUN)

Define all error conditions.

Referenced by twis_interrupt_handler().

static uint32_t twis_find_ch_num ( Twis *const  twis)
static

Get TWIS channel number.

Parameters
twisBase address of the TWIS
Returns
TWIS channel number

Referenced by twis_init(), and twis_set_callback().

twis_callback_t twis_callback_pointer[TWIS_INST_NUM]
struct twis_dev_inst* twis_instances[TWIS_INST_NUM]