Paparazzi UAS
v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
|
Platform-independent software I2C implementation. More...
#include "mcu_periph/softi2c.h"
#include "mcu_arch.h"
#include "mcu_periph/gpio.h"
#include "mcu_periph/sys_time.h"
#include "subsystems/datalink/telemetry.h"
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | softi2c_device |
Macros | |
#define | SOFTI2C0_DIVIDER 1 |
#define | SOFTI2C1_DIVIDER 1 |
Platform-independent software I2C implementation.
Can be used transparently in place of the hardware I2C in i2c.h.
This implementation can only be used as the (only) master on the I2C bus.
Definition in file softi2c.c.
struct softi2c_device |
Data Fields | ||
---|---|---|
uint8_t | bit_state | |
uint8_t | byte_state | |
struct i2c_periph * | periph | |
uint16_t | scl_pin | |
gpio_port_t | scl_port | |
uint16_t | sda_pin | |
gpio_port_t | sda_port |
#define SOFTI2C0_DIVIDER 1 |
Definition at line 45 of file softi2c.c.
Referenced by softi2c_event().
#define SOFTI2C1_DIVIDER 1 |
Definition at line 48 of file softi2c.c.
Referenced by softi2c_event().
|
static |
Definition at line 608 of file softi2c.c.
References I2C_TRANSACTION_QUEUE_LEN, p, softi2c_device::periph, softi2c_process_transaction(), i2c_periph::trans, i2c_periph::trans_extract_idx, and i2c_periph::trans_insert_idx.
Referenced by softi2c_event(), and softi2c_spin().
void softi2c_event | ( | void | ) |
Definition at line 624 of file softi2c.c.
References SOFTI2C0_DIVIDER, SOFTI2C1_DIVIDER, and softi2c_device_event().
Referenced by mcu_event().
|
static |
Definition at line 185 of file softi2c.c.
References gpio_clear(), and gpio_setup_output().
Referenced by softi2c_read_bit(), softi2c_write_bit(), softi2c_write_restart(), softi2c_write_start(), and softi2c_write_stop().
|
static |
Definition at line 166 of file softi2c.c.
References gpio_set(), gpio_setup_input(), and gpio_setup_input_pullup().
Referenced by softi2c_gpio_read(), softi2c_read_bit(), softi2c_setup_gpio(), softi2c_write_bit(), softi2c_write_restart(), and softi2c_write_stop().
|
static |
Definition at line 180 of file softi2c.c.
References gpio_get(), and softi2c_gpio_highz().
Referenced by softi2c_read_bit().
|
static |
Definition at line 650 of file softi2c.c.
References I2CIdle, i2c_periph::status, i2c_periph::trans_extract_idx, and i2c_periph::trans_insert_idx.
|
static |
Definition at line 483 of file softi2c.c.
References i2c_errors::ack_fail_cnt, i2c_transaction::buf, byte, i2c_periph::errors, I2CAddrRdSent, I2CAddrWrSent, I2CIdle, I2CReadingByte, I2CReadingLastByte, I2CRestartRequested, I2CSendingByte, I2CStartRequested, I2CStopRequested, I2CTransFailed, I2CTransRunning, I2CTransRx, I2CTransSuccess, I2CTransTxRx, i2c_periph::idx_buf, i2c_transaction::len_r, i2c_transaction::len_w, softi2c_device::periph, i2c_transaction::slave_addr, softi2c_read_byte(), softi2c_write_byte(), softi2c_write_restart(), softi2c_write_start(), softi2c_write_stop(), i2c_transaction::status, i2c_periph::status, and i2c_transaction::type.
Referenced by softi2c_device_event().
|
static |
Definition at line 325 of file softi2c.c.
References softi2c_device::bit_state, gpio_get(), softi2c_device::scl_pin, softi2c_device::scl_port, softi2c_device::sda_pin, softi2c_device::sda_port, softi2c_gpio_drive_low(), softi2c_gpio_highz(), and softi2c_gpio_read().
Referenced by softi2c_read_byte(), and softi2c_write_byte().
|
static |
Definition at line 448 of file softi2c.c.
References softi2c_device::byte_state, softi2c_read_bit(), and softi2c_write_bit().
Referenced by softi2c_process_transaction().
|
static |
|
static |
Definition at line 194 of file softi2c.c.
References gpio_enable_clock(), and softi2c_gpio_highz().
|
static |
Definition at line 645 of file softi2c.c.
References i2c_periph::reg_addr, softi2c_device_event(), and sys_time_usleep().
|
static |
Definition at line 654 of file softi2c.c.
References i2c_periph::errors, I2C_TRANSACTION_QUEUE_LEN, I2CTransFailed, I2CTransPending, i2c_errors::queue_full_cnt, i2c_transaction::status, i2c_periph::trans, i2c_periph::trans_extract_idx, and i2c_periph::trans_insert_idx.
|
static |
Definition at line 294 of file softi2c.c.
References softi2c_device::bit_state, gpio_get(), softi2c_device::scl_pin, softi2c_device::scl_port, softi2c_device::sda_pin, softi2c_device::sda_port, softi2c_gpio_drive_low(), and softi2c_gpio_highz().
Referenced by softi2c_read_byte(), and softi2c_write_byte().
|
static |
Definition at line 418 of file softi2c.c.
References softi2c_device::byte_state, softi2c_read_bit(), and softi2c_write_bit().
Referenced by softi2c_process_transaction().
|
static |
Definition at line 349 of file softi2c.c.
References softi2c_device::bit_state, gpio_get(), softi2c_device::scl_pin, softi2c_device::scl_port, softi2c_device::sda_pin, softi2c_device::sda_port, softi2c_gpio_drive_low(), and softi2c_gpio_highz().
Referenced by softi2c_process_transaction().
|
static |
Definition at line 288 of file softi2c.c.
References softi2c_device::sda_pin, softi2c_device::sda_port, and softi2c_gpio_drive_low().
Referenced by softi2c_process_transaction().
|
static |
Definition at line 380 of file softi2c.c.
References softi2c_device::bit_state, gpio_get(), softi2c_device::scl_pin, softi2c_device::scl_port, softi2c_device::sda_pin, softi2c_device::sda_port, softi2c_gpio_drive_low(), and softi2c_gpio_highz().
Referenced by softi2c_process_transaction().