|
Paparazzi UAS v7.1_unstable
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 "modules/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 604 of file softi2c.c.
References I2C_TRANSACTION_QUEUE_LEN, p, softi2c_device::periph, and softi2c_process_transaction().
Referenced by softi2c_event(), and softi2c_spin().
| void softi2c_event | ( | void | ) |
Definition at line 620 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 |
|
static |
Definition at line 479 of file softi2c.c.
References i2c_errors::ack_fail_cnt, i2c_transaction::buf, i2c_periph::errors, I2CAddrRdSent, I2CAddrWrSent, I2CFailed, 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_periph::status, i2c_transaction::status, and i2c_transaction::type.
Referenced by softi2c_device_event().
|
static |
Definition at line 321 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 444 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 softi2c_device::scl_pin, softi2c_device::scl_port, softi2c_device::sda_pin, softi2c_device::sda_port, and softi2c_gpio_highz().
|
static |
Definition at line 641 of file softi2c.c.
References p, and softi2c_device_event().
|
static |
Definition at line 650 of file softi2c.c.
References I2C_TRANSACTION_QUEUE_LEN, I2CTransFailed, I2CTransPending, p, and i2c_transaction::status.
|
static |
Definition at line 290 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 414 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 345 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 284 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 376 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().