Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
i2c_attempt4_nodouble_isr.c File Reference
#include "mcu_periph/i2c.h"
#include <stm32/rcc.h>
#include <stm32/gpio.h>
#include <stm32/flash.h>
#include <stm32/misc.h>
+ Include dependency graph for i2c_attempt4_nodouble_isr.c:

Go to the source code of this file.

Macros

#define I2C_DEBUG_LED
 
#define I2C_SR1_BIT_SB   (1<<0)
 
#define I2C_SR1_BIT_ADDR   (1<<1)
 
#define I2C_SR1_BIT_BTF   (1<<2)
 
#define I2C_SR1_BIT_RXNE   (1<<6)
 
#define I2C_SR1_BIT_TXE   (1<<7)
 
#define I2C_SR1_BIT_ERR_BUS   (1<<8)
 
#define I2C_SR1_BIT_ERR_ARLO   (1<<9)
 
#define I2C_SR1_BIT_ERR_AF   (1<<10)
 
#define I2C_SR1_BIT_ERR_OVR   (1<<11)
 
#define I2C_SR1_BITS_ERR   ((1<<8)|(1<<9)|(1<<10)|(1<<11)|(1<<12)|(1<<14)|(1<<15))
 
#define I2C_SR2_BIT_TRA   (1<<2)
 
#define I2C_SR2_BIT_BUSY   (1<<1)
 
#define I2C_SR2_BIT_MSL   (1<<0)
 
#define I2C_CR1_BIT_PE   (1<<0)
 
#define I2C_CR1_BIT_START   (1<<8)
 
#define I2C_CR1_BIT_STOP   (1<<9)
 
#define I2C_CR1_BIT_ACK   (1<<10)
 
#define I2C_CR1_BIT_POS   (1<<11)
 
#define I2C_CR1_BIT_SWRST   (1<<15)
 
#define I2C_CR2_BIT_ITERREN   (1<<8)
 
#define I2C_CR2_BIT_ITEVTEN   (1<<9)
 
#define I2C_CR2_BIT_ITBUFEN   (1<<10)
 
#define BIT_X_IS_SET_IN_REG(X, REG)   (((REG) & (X)) == (X))
 
#define __I2C_REG_CRITICAL_ZONE_START
 
#define __I2C_REG_CRITICAL_ZONE_STOP
 

Enumerations

enum  STMI2CSubTransactionStatus {
  STMI2C_SubTra_Busy, STMI2C_SubTra_Ready_StopRequested, STMI2C_SubTra_Ready, STMI2C_SubTra_Error,
  STMI2C_SubTra_Busy, STMI2C_SubTra_Ready_StopRequested, STMI2C_SubTra_Ready, STMI2C_SubTra_Busy,
  STMI2C_SubTra_Ready_StopRequested, STMI2C_SubTra_Ready, STMI2C_SubTra_Busy, STMI2C_SubTra_Ready_StopRequested,
  STMI2C_SubTra_Ready, STMI2C_SubTra_Error
}
 

Functions

static void LED1_ON (void)
 
static void LED1_OFF (void)
 
static void LED2_ON (void)
 
static void LED2_OFF (void)
 
static void LED_INIT (void)
 
static void LED_ERROR (uint8_t base, uint8_t nr)
 
static void LED_SHOW_ACTIVE_BITS (I2C_TypeDef *regs)
 
static void PPRZ_I2C_SEND_STOP (I2C_TypeDef *regs)
 
static void PPRZ_I2C_SEND_START (struct i2c_periph *periph)
 
static enum
STMI2CSubTransactionStatus 
stmi2c_send (I2C_TypeDef *regs, struct i2c_periph *periph, struct i2c_transaction *trans)
 
static enum
STMI2CSubTransactionStatus 
stmi2c_read1 (I2C_TypeDef *regs, struct i2c_transaction *trans)
 
static enum
STMI2CSubTransactionStatus 
stmi2c_read2 (I2C_TypeDef *regs, struct i2c_transaction *trans)
 
static enum
STMI2CSubTransactionStatus 
stmi2c_readmany (I2C_TypeDef *regs, struct i2c_periph *periph, struct i2c_transaction *trans)
 
static void stmi2c_clear_pending_interrupts (I2C_TypeDef *regs)
 
static void i2c_error (struct i2c_periph *periph)
 
static void i2c_irq (struct i2c_periph *periph)
 
void i2c_setbitrate (struct i2c_periph *periph, int bitrate)
 
void i2c_event (void)
 
bool_t i2c_submit (struct i2c_periph *periph, struct i2c_transaction *t)
 
bool_t i2c_idle (struct i2c_periph *periph)
 

Macro Definition Documentation

#define __I2C_REG_CRITICAL_ZONE_START

Definition at line 140 of file i2c_attempt4_nodouble_isr.c.

Referenced by stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

#define __I2C_REG_CRITICAL_ZONE_STOP

Definition at line 141 of file i2c_attempt4_nodouble_isr.c.

Referenced by stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

#define BIT_X_IS_SET_IN_REG (   X,
  REG 
)    (((REG) & (X)) == (X))
#define I2C_CR1_BIT_ACK   (1<<10)

Definition at line 123 of file i2c_attempt4_nodouble_isr.c.

Referenced by stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

#define I2C_CR1_BIT_PE   (1<<0)

Definition at line 120 of file i2c_attempt4_nodouble_isr.c.

Referenced by LED_SHOW_ACTIVE_BITS(), and PPRZ_I2C_SEND_START().

#define I2C_CR1_BIT_POS   (1<<11)

Definition at line 124 of file i2c_attempt4_nodouble_isr.c.

Referenced by stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

#define I2C_CR1_BIT_START   (1<<8)

Definition at line 121 of file i2c_attempt4_nodouble_isr.c.

Referenced by i2c_irq(), LED_SHOW_ACTIVE_BITS(), and PPRZ_I2C_SEND_START().

#define I2C_CR1_BIT_STOP   (1<<9)

Definition at line 122 of file i2c_attempt4_nodouble_isr.c.

Referenced by LED_SHOW_ACTIVE_BITS(), and PPRZ_I2C_SEND_STOP().

#define I2C_CR1_BIT_SWRST   (1<<15)

Definition at line 125 of file i2c_attempt4_nodouble_isr.c.

Referenced by LED_SHOW_ACTIVE_BITS().

#define I2C_CR2_BIT_ITBUFEN   (1<<10)
#define I2C_CR2_BIT_ITERREN   (1<<8)

Definition at line 129 of file i2c_attempt4_nodouble_isr.c.

Referenced by PPRZ_I2C_SEND_START().

#define I2C_CR2_BIT_ITEVTEN   (1<<9)

Definition at line 130 of file i2c_attempt4_nodouble_isr.c.

Referenced by PPRZ_I2C_SEND_START().

#define I2C_DEBUG_LED

Definition at line 8 of file i2c_attempt4_nodouble_isr.c.

Referenced by i2c_idle(), i2c_irq(), and PPRZ_I2C_SEND_START().

#define I2C_SR1_BIT_ADDR   (1<<1)
#define I2C_SR1_BIT_BTF   (1<<2)
#define I2C_SR1_BIT_ERR_AF   (1<<10)

Definition at line 107 of file i2c_attempt4_nodouble_isr.c.

#define I2C_SR1_BIT_ERR_ARLO   (1<<9)

Definition at line 106 of file i2c_attempt4_nodouble_isr.c.

#define I2C_SR1_BIT_ERR_BUS   (1<<8)

Definition at line 105 of file i2c_attempt4_nodouble_isr.c.

#define I2C_SR1_BIT_ERR_OVR   (1<<11)

Definition at line 108 of file i2c_attempt4_nodouble_isr.c.

#define I2C_SR1_BIT_RXNE   (1<<6)

Definition at line 102 of file i2c_attempt4_nodouble_isr.c.

Referenced by stmi2c_read1(), and stmi2c_readmany().

#define I2C_SR1_BIT_SB   (1<<0)
#define I2C_SR1_BIT_TXE   (1<<7)

Definition at line 103 of file i2c_attempt4_nodouble_isr.c.

Referenced by stmi2c_send().

#define I2C_SR1_BITS_ERR   ((1<<8)|(1<<9)|(1<<10)|(1<<11)|(1<<12)|(1<<14)|(1<<15))

Definition at line 110 of file i2c_attempt4_nodouble_isr.c.

Referenced by i2c_irq(), and LED_SHOW_ACTIVE_BITS().

#define I2C_SR2_BIT_BUSY   (1<<1)

Definition at line 115 of file i2c_attempt4_nodouble_isr.c.

Referenced by i2c_idle(), and LED_SHOW_ACTIVE_BITS().

#define I2C_SR2_BIT_MSL   (1<<0)

Definition at line 116 of file i2c_attempt4_nodouble_isr.c.

Referenced by LED_SHOW_ACTIVE_BITS().

#define I2C_SR2_BIT_TRA   (1<<2)

Definition at line 114 of file i2c_attempt4_nodouble_isr.c.

Referenced by LED_SHOW_ACTIVE_BITS().

Enumeration Type Documentation

Enumerator
STMI2C_SubTra_Busy 
STMI2C_SubTra_Ready_StopRequested 
STMI2C_SubTra_Ready 
STMI2C_SubTra_Error 
STMI2C_SubTra_Busy 
STMI2C_SubTra_Ready_StopRequested 
STMI2C_SubTra_Ready 
STMI2C_SubTra_Busy 
STMI2C_SubTra_Ready_StopRequested 
STMI2C_SubTra_Ready 
STMI2C_SubTra_Busy 
STMI2C_SubTra_Ready_StopRequested 
STMI2C_SubTra_Ready 
STMI2C_SubTra_Error 

Definition at line 332 of file i2c_attempt4_nodouble_isr.c.

Function Documentation

static void i2c_error ( struct i2c_periph periph)
inlinestatic
void i2c_event ( void  )

Definition at line 1218 of file i2c_attempt4_nodouble_isr.c.

References i2c_idle(), I2CIdle, I2CStartRequested, LED1_OFF(), LED1_ON(), LED2_OFF(), LED2_ON(), and PPRZ_I2C_SEND_START().

+ Here is the call graph for this function:

bool_t i2c_idle ( struct i2c_periph periph)

Definition at line 1342 of file i2c_attempt4_nodouble_isr.c.

References BIT_X_IS_SET_IN_REG, FALSE, I2C_DEBUG_LED, I2C_SR2_BIT_BUSY, I2CIdle, i2c_periph::reg_addr, i2c_periph::status, and TRUE.

Referenced by i2c_event(), and i2c_setbitrate().

+ Here is the caller graph for this function:

void i2c_setbitrate ( struct i2c_periph periph,
int  bitrate 
)

Definition at line 1190 of file i2c_attempt4_nodouble_isr.c.

References i2c_idle(), LED1_OFF(), LED1_ON(), LED2_OFF(), LED2_ON(), and i2c_periph::reg_addr.

+ Here is the call graph for this function:

static void LED1_OFF ( void  )
inlinestatic

Definition at line 21 of file i2c_attempt4_nodouble_isr.c.

Referenced by i2c_event(), i2c_irq(), i2c_setbitrate(), LED_ERROR(), LED_INIT(), LED_SHOW_ACTIVE_BITS(), PPRZ_I2C_SEND_START(), PPRZ_I2C_SEND_STOP(), and stmi2c_readmany().

+ Here is the caller graph for this function:

static void LED1_ON ( void  )
inlinestatic

Definition at line 16 of file i2c_attempt4_nodouble_isr.c.

Referenced by i2c_event(), i2c_irq(), i2c_setbitrate(), LED_ERROR(), LED_SHOW_ACTIVE_BITS(), PPRZ_I2C_SEND_START(), PPRZ_I2C_SEND_STOP(), and stmi2c_readmany().

+ Here is the caller graph for this function:

static void LED2_OFF ( void  )
inlinestatic

Definition at line 31 of file i2c_attempt4_nodouble_isr.c.

Referenced by i2c_event(), i2c_irq(), i2c_setbitrate(), LED_ERROR(), LED_INIT(), LED_SHOW_ACTIVE_BITS(), PPRZ_I2C_SEND_START(), PPRZ_I2C_SEND_STOP(), and stmi2c_readmany().

+ Here is the caller graph for this function:

static void LED2_ON ( void  )
inlinestatic

Definition at line 26 of file i2c_attempt4_nodouble_isr.c.

Referenced by i2c_event(), i2c_irq(), i2c_setbitrate(), LED_ERROR(), LED_SHOW_ACTIVE_BITS(), PPRZ_I2C_SEND_START(), PPRZ_I2C_SEND_STOP(), and stmi2c_readmany().

+ Here is the caller graph for this function:

static void LED_ERROR ( uint8_t  base,
uint8_t  nr 
)
inlinestatic

Definition at line 50 of file i2c_attempt4_nodouble_isr.c.

References LED1_OFF(), LED1_ON(), LED2_OFF(), and LED2_ON().

Referenced by i2c_error().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void LED_INIT ( void  )
inlinestatic

Definition at line 36 of file i2c_attempt4_nodouble_isr.c.

References LED1_OFF(), and LED2_OFF().

+ Here is the call graph for this function:

static void LED_SHOW_ACTIVE_BITS ( I2C_TypeDef *  regs)
inlinestatic
static void PPRZ_I2C_SEND_START ( struct i2c_periph periph)
inlinestatic
static void PPRZ_I2C_SEND_STOP ( I2C_TypeDef *  regs)
inlinestatic

Definition at line 268 of file i2c_attempt4_nodouble_isr.c.

References I2C_CR1_BIT_STOP, LED1_OFF(), LED1_ON(), LED2_OFF(), and LED2_ON().

Referenced by i2c_irq(), stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void stmi2c_clear_pending_interrupts ( I2C_TypeDef *  regs)
inlinestatic

Definition at line 630 of file i2c_attempt4_nodouble_isr.c.

References __attribute__(), BIT_X_IS_SET_IN_REG, I2C_CR2_BIT_ITBUFEN, I2C_SR1_BIT_ADDR, I2C_SR1_BIT_BTF, and I2C_SR1_BIT_SB.

Referenced by i2c_irq().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static enum STMI2CSubTransactionStatus stmi2c_send ( I2C_TypeDef *  regs,
struct i2c_periph periph,
struct i2c_transaction trans 
)
inlinestatic