Classes | Macros | Typedefs | Functions
drivers/twihs/twihs.h File Reference

Two-Wire Interface High Speed (TWIHS) driver for SAM. More...

#include "compiler.h"
Include dependency graph for drivers/twihs/twihs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  twihs_options
 Input parameters when initializing the TWIHS module mode. More...
 
struct  twihs_packet
 Information concerning the data transmission. More...
 

Macros

#define TWIHS_TIMEOUT   30000
 
#define TWIHS_SUCCESS   0
 Return codes for TWIHS APIs. More...
 
#define TWIHS_INVALID_ARGUMENT   1
 
#define TWIHS_ARBITRATION_LOST   2
 
#define TWIHS_NO_CHIP_FOUND   3
 
#define TWIHS_RECEIVE_OVERRUN   4
 
#define TWIHS_RECEIVE_NACK   5
 
#define TWIHS_SEND_OVERRUN   6
 
#define TWIHS_SEND_NACK   7
 
#define TWIHS_BUSY   8
 
#define TWIHS_ERROR_TIMEOUT   9
 

Typedefs

typedef struct twihs_options twihs_options_t
 Input parameters when initializing the TWIHS module mode. More...
 
typedef struct twihs_packet twihs_packet_t
 Information concerning the data transmission. More...
 

Functions

static void twihs_clear_disable_clock_wait_state (Twihs *p_twihs)
 Clear clock wait state disable mode. More...
 
static void twihs_disable_alternative_command (Twihs *p_twihs)
 Enable alternative command mode. More...
 
static void twihs_disable_clock_wait_state (Twihs *p_twihs)
 Clock stretching disabled in slave mode, OVRE and UNRE will indicate overrun and underrun. More...
 
static void twihs_disable_highspeed (Twihs *p_twihs)
 Disable high speed mode. More...
 
void twihs_disable_interrupt (Twihs *p_twihs, uint32_t ul_sources)
 Disable TWIHS interrupts. More...
 
void twihs_disable_master_mode (Twihs *p_twihs)
 Disable TWIHS master mode. More...
 
static void twihs_disable_pec (Twihs *p_twihs)
 Disable packet error checking. More...
 
static void twihs_disable_slave_default_addr (Twihs *p_twihs)
 Acknowledge of the SMBus Default Address disabled. More...
 
void twihs_disable_slave_mode (Twihs *p_twihs)
 Disable TWIHS slave mode. More...
 
static void twihs_disable_slave_nack (Twihs *p_twihs)
 Normal value to be returned in the ACK cycle of the data phase in slave receiver mode. More...
 
static void twihs_disable_smbus (Twihs *p_twihs)
 Disable SMBus mode. More...
 
static void twihs_disable_smbus_host_header (Twihs *p_twihs)
 Acknowledge of the SMBus Host Header disabled. More...
 
static void twihs_enable_alternative_command (Twihs *p_twihs)
 Enable alternative command mode. More...
 
static void twihs_enable_highspeed (Twihs *p_twihs)
 Enable high speed mode. More...
 
void twihs_enable_interrupt (Twihs *p_twihs, uint32_t ul_sources)
 Enable TWIHS interrupts. More...
 
void twihs_enable_master_mode (Twihs *p_twihs)
 Enable TWIHS master mode. More...
 
static void twihs_enable_pec (Twihs *p_twihs)
 Enable packet error checking. More...
 
static void twihs_enable_slave_default_addr (Twihs *p_twihs)
 Acknowledge of the SMBus Default Address enabled. More...
 
void twihs_enable_slave_mode (Twihs *p_twihs)
 Enable TWIHS slave mode. More...
 
static void twihs_enable_slave_nack (Twihs *p_twihs)
 NACK value to be returned in the ACK cycle of the data phase in slave receiver mode. More...
 
static void twihs_enable_smbus (Twihs *p_twihs)
 Enable SMBus mode. More...
 
static void twihs_enable_smbus_host_header (Twihs *p_twihs)
 Acknowledge of the SMBus Host Header enabled. More...
 
static void twihs_enable_smbus_quick_command (Twihs *p_twihs)
 If Master mode is enabled, a SMBUS Quick Command is sent. More...
 
uint32_t twihs_get_interrupt_mask (Twihs *p_twihs)
 Read TWIHS interrupt mask. More...
 
uint32_t twihs_get_interrupt_status (Twihs *p_twihs)
 Get TWIHS interrupt status. More...
 
Pdc * twihs_get_pdc_base (Twihs *p_twihs)
 Get TWIHS PDC base address. More...
 
void twihs_mask_slave_addr (Twihs *p_twihs, uint32_t ul_mask)
 A mask can be applied on the slave device address in slave mode in order to allow multiple address answer. For each bit of the MASK field set to one the corresponding SADR bit will be masked. More...
 
uint32_t twihs_master_init (Twihs *p_twihs, const twihs_options_t *p_opt)
 Initialize TWIHS master mode. More...
 
uint32_t twihs_master_read (Twihs *p_twihs, twihs_packet_t *p_packet)
 Read multiple bytes from a TWIHS compatible slave device. More...
 
uint32_t twihs_master_write (Twihs *p_twihs, twihs_packet_t *p_packet)
 Write multiple bytes to a TWIHS compatible slave device. More...
 
uint32_t twihs_probe (Twihs *p_twihs, uint8_t uc_slave_addr)
 Test if a chip answers a given I2C address. More...
 
uint8_t twihs_read_byte (Twihs *p_twihs)
 Reads a byte from the TWIHS bus. More...
 
void twihs_read_write_protection_status (Twihs *p_twihs, uint32_t *p_status)
 Read the write protection status. More...
 
static void twihs_request_pec (Twihs *p_twihs)
 Request a packet error checking. More...
 
void twihs_reset (Twihs *p_twihs)
 Reset TWIHS. More...
 
static void twihs_send_clear (Twihs *p_twihs)
 If master mode is enabled, send a bus clear command. More...
 
void twihs_set_alternative_command (Twihs *p_twihs, uint32_t ul_alt_cmd)
 Set length/direction/PEC for alternative command mode. More...
 
void twihs_set_filter (Twihs *p_twihs, uint32_t ul_filter)
 Set the filter for TWIHS. More...
 
void twihs_set_slave_addr (Twihs *p_twihs, uint32_t ul_device_addr)
 Set TWIHS slave address. More...
 
uint32_t twihs_set_speed (Twihs *p_twihs, uint32_t ul_speed, uint32_t ul_mck)
 Set the I2C bus speed in conjunction with the clock frequency. More...
 
void twihs_set_write_protection (Twihs *p_twihs, bool flag)
 Enables/Disables write protection mode. More...
 
void twihs_slave_init (Twihs *p_twihs, uint32_t ul_device_addr)
 Initialize TWIHS slave mode. More...
 
uint32_t twihs_slave_read (Twihs *p_twihs, uint8_t *p_data)
 Read data from master. More...
 
uint32_t twihs_slave_write (Twihs *p_twihs, uint8_t *p_data)
 Write data to TWIHS bus. More...
 
void twihs_smbus_set_timing (Twihs *p_twihs, uint32_t ul_timing)
 Set the prescaler, TLOW:SEXT, TLOW:MEXT and clock high max cycles for SMBUS mode. More...
 
void twihs_write_byte (Twihs *p_twihs, uint8_t uc_byte)
 Sends a byte of data to one of the TWIHS slaves on the bus. More...
 

Detailed Description

Two-Wire Interface High Speed (TWIHS) driver for SAM.

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

Definition in file drivers/twihs/twihs.h.

Macro Definition Documentation

◆ TWIHS_ARBITRATION_LOST

#define TWIHS_ARBITRATION_LOST   2

Definition at line 59 of file drivers/twihs/twihs.h.

◆ TWIHS_BUSY

#define TWIHS_BUSY   8

Definition at line 65 of file drivers/twihs/twihs.h.

◆ TWIHS_ERROR_TIMEOUT

#define TWIHS_ERROR_TIMEOUT   9

Definition at line 66 of file drivers/twihs/twihs.h.

◆ TWIHS_INVALID_ARGUMENT

#define TWIHS_INVALID_ARGUMENT   1

Definition at line 58 of file drivers/twihs/twihs.h.

◆ TWIHS_NO_CHIP_FOUND

#define TWIHS_NO_CHIP_FOUND   3

Definition at line 60 of file drivers/twihs/twihs.h.

◆ TWIHS_RECEIVE_NACK

#define TWIHS_RECEIVE_NACK   5

Definition at line 62 of file drivers/twihs/twihs.h.

◆ TWIHS_RECEIVE_OVERRUN

#define TWIHS_RECEIVE_OVERRUN   4

Definition at line 61 of file drivers/twihs/twihs.h.

◆ TWIHS_SEND_NACK

#define TWIHS_SEND_NACK   7

Definition at line 64 of file drivers/twihs/twihs.h.

◆ TWIHS_SEND_OVERRUN

#define TWIHS_SEND_OVERRUN   6

Definition at line 63 of file drivers/twihs/twihs.h.

◆ TWIHS_SUCCESS

#define TWIHS_SUCCESS   0

Return codes for TWIHS APIs.

Definition at line 57 of file drivers/twihs/twihs.h.

◆ TWIHS_TIMEOUT

#define TWIHS_TIMEOUT   30000

Time-out value (number of attempts).

Definition at line 51 of file drivers/twihs/twihs.h.

Typedef Documentation

◆ twihs_options_t

Input parameters when initializing the TWIHS module mode.

◆ twihs_packet_t

typedef struct twihs_packet twihs_packet_t

Information concerning the data transmission.

Function Documentation

◆ twihs_clear_disable_clock_wait_state()

static void twihs_clear_disable_clock_wait_state ( Twihs p_twihs)
inlinestatic

Clear clock wait state disable mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 288 of file drivers/twihs/twihs.h.

◆ twihs_disable_alternative_command()

static void twihs_disable_alternative_command ( Twihs p_twihs)
inlinestatic

Enable alternative command mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 207 of file drivers/twihs/twihs.h.

◆ twihs_disable_clock_wait_state()

static void twihs_disable_clock_wait_state ( Twihs p_twihs)
inlinestatic

Clock stretching disabled in slave mode, OVRE and UNRE will indicate overrun and underrun.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 278 of file drivers/twihs/twihs.h.

◆ twihs_disable_highspeed()

static void twihs_disable_highspeed ( Twihs p_twihs)
inlinestatic

Disable high speed mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 126 of file drivers/twihs/twihs.h.

◆ twihs_disable_pec()

static void twihs_disable_pec ( Twihs p_twihs)
inlinestatic

Disable packet error checking.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 166 of file drivers/twihs/twihs.h.

◆ twihs_disable_slave_default_addr()

static void twihs_disable_slave_default_addr ( Twihs p_twihs)
inlinestatic

Acknowledge of the SMBus Default Address disabled.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 238 of file drivers/twihs/twihs.h.

◆ twihs_disable_slave_nack()

static void twihs_disable_slave_nack ( Twihs p_twihs)
inlinestatic

Normal value to be returned in the ACK cycle of the data phase in slave receiver mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 218 of file drivers/twihs/twihs.h.

◆ twihs_disable_smbus()

static void twihs_disable_smbus ( Twihs p_twihs)
inlinestatic

Disable SMBus mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 146 of file drivers/twihs/twihs.h.

◆ twihs_disable_smbus_host_header()

static void twihs_disable_smbus_host_header ( Twihs p_twihs)
inlinestatic

Acknowledge of the SMBus Host Header disabled.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 258 of file drivers/twihs/twihs.h.

◆ twihs_enable_alternative_command()

static void twihs_enable_alternative_command ( Twihs p_twihs)
inlinestatic

Enable alternative command mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 197 of file drivers/twihs/twihs.h.

◆ twihs_enable_highspeed()

static void twihs_enable_highspeed ( Twihs p_twihs)
inlinestatic

Enable high speed mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 116 of file drivers/twihs/twihs.h.

◆ twihs_enable_pec()

static void twihs_enable_pec ( Twihs p_twihs)
inlinestatic

Enable packet error checking.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 156 of file drivers/twihs/twihs.h.

◆ twihs_enable_slave_default_addr()

static void twihs_enable_slave_default_addr ( Twihs p_twihs)
inlinestatic

Acknowledge of the SMBus Default Address enabled.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 248 of file drivers/twihs/twihs.h.

◆ twihs_enable_slave_nack()

static void twihs_enable_slave_nack ( Twihs p_twihs)
inlinestatic

NACK value to be returned in the ACK cycle of the data phase in slave receiver mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 228 of file drivers/twihs/twihs.h.

◆ twihs_enable_smbus()

static void twihs_enable_smbus ( Twihs p_twihs)
inlinestatic

Enable SMBus mode.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 136 of file drivers/twihs/twihs.h.

◆ twihs_enable_smbus_host_header()

static void twihs_enable_smbus_host_header ( Twihs p_twihs)
inlinestatic

Acknowledge of the SMBus Host Header enabled.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 268 of file drivers/twihs/twihs.h.

◆ twihs_enable_smbus_quick_command()

static void twihs_enable_smbus_quick_command ( Twihs p_twihs)
inlinestatic

If Master mode is enabled, a SMBUS Quick Command is sent.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 106 of file drivers/twihs/twihs.h.

◆ twihs_request_pec()

static void twihs_request_pec ( Twihs p_twihs)
inlinestatic

Request a packet error checking.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 176 of file drivers/twihs/twihs.h.

◆ twihs_send_clear()

static void twihs_send_clear ( Twihs p_twihs)
inlinestatic

If master mode is enabled, send a bus clear command.

Parameters
p_twihsBase address of the TWIHS instance.

Definition at line 186 of file drivers/twihs/twihs.h.



inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:07