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.
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_inst * | twis_instances [TWIS_INST_NUM] |
#define TWIS_SR_ERROR |
Define all error conditions.
Referenced by twis_interrupt_handler().
|
static |
Get TWIS channel number.
twis | Base address of the TWIS |
Referenced by twis_init(), and twis_set_callback().
|
static |
TWIS interrupt handler.
Base | address of the TWIS |
References dev_inst, twis_callback::error, twis_dev_inst::hw_dev, twis_callback::rx, status, twis_callback::stop, twis_clear_status(), twis_disable_interrupt(), twis_enable_interrupt(), twis_get_interrupt_mask(), twis_get_status(), TWIS_INTERRUPT_ALL, TWIS_INTERRUPT_BYTE_TRANS_FINISHED, TWIS_INTERRUPT_ERRORS, TWIS_INTERRUPT_RESTART_RECEIVED, TWIS_INTERRUPT_RX_BUFFER_READY, TWIS_INTERRUPT_SLAVEADR_MATCH, TWIS_INTERRUPT_TRANS_COMP, TWIS_SR_ERROR, and twis_callback::tx.
|
static |
Configure the TWIS Module.
dev_inst | Device structure pointer |
config | Configuration for the TWIS |
References twis_config::ack_general_call, twis_config::ack_slave_addr, twis_config::ack_smbus_default_addr, twis_config::ack_smbus_host_header, twis_config::chip, twis_config::enable_pec, twis_config::exp, twis_config::fs_dadrivel, twis_config::fs_daslew, twis_config::fs_filter, twis_config::hddat, twis_config::hs_dadrivel, twis_config::hs_daslew, twis_config::hs_filter, twis_dev_inst::hw_dev, twis_config::smbus, twis_config::stretch_clk_addr, twis_config::stretch_clk_data, twis_config::stretch_clk_hr, twis_config::sudat, twis_config::ten_bit, twis_config::tlows, and twis_config::ttouts.
Referenced by twis_init().
twis_callback_t twis_callback_pointer[TWIS_INST_NUM] |
struct twis_dev_inst* twis_instances[TWIS_INST_NUM] |