Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
generic_com.c File Reference
#include "std.h"
#include "modules/com/generic_com.h"
#include "mcu_periph/i2c.h"
#include "state.h"
#include "modules/gps/gps.h"
#include "modules/energy/electrical.h"
#include "generated/airframe.h"
#include "modules/core/commands.h"
#include "autopilot.h"
#include "modules/nav/common_nav.h"
Include dependency graph for generic_com.c:

Go to the source code of this file.

Macros

#define NB_DATA   24
#define GENERIC_COM_I2C_DEV   i2c0
#define GENERIC_COM_SLAVE_ADDR   0x26
#define FillBufWith32bit(_buf, _index, _value)
#define FillBufWith16bit(_buf, _index, _value)

Functions

void generic_com_init (void)
void generic_com_periodic (void)
void generic_com_event (void)
void start_com (void)
void stop_com (void)

Variables

struct i2c_transaction com_trans
bool active_com

Macro Definition Documentation

◆ FillBufWith16bit

#define FillBufWith16bit ( _buf,
_index,
_value )
Value:
{ \
_buf[_index] = (uint8_t) (_value); \
_buf[_index+1] = (uint8_t) ((_value) >> 8); \
}
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.

Definition at line 65 of file generic_com.c.

Referenced by generic_com_periodic().

◆ FillBufWith32bit

#define FillBufWith32bit ( _buf,
_index,
_value )
Value:
{ \
_buf[_index] = (uint8_t) (_value); \
_buf[_index+1] = (uint8_t) ((_value) >> 8); \
_buf[_index+2] = (uint8_t) ((_value) >> 16); \
_buf[_index+3] = (uint8_t) ((_value) >> 24); \
}

Definition at line 58 of file generic_com.c.

Referenced by generic_com_periodic().

◆ GENERIC_COM_I2C_DEV

#define GENERIC_COM_I2C_DEV   i2c0

Definition at line 41 of file generic_com.c.

Referenced by generic_com_periodic(), and stop_com().

◆ GENERIC_COM_SLAVE_ADDR

#define GENERIC_COM_SLAVE_ADDR   0x26

Definition at line 45 of file generic_com.c.

Referenced by generic_com_periodic(), and stop_com().

◆ NB_DATA

#define NB_DATA   24

Function Documentation

◆ generic_com_event()

void generic_com_event ( void )

Definition at line 93 of file generic_com.c.

References com_trans, I2CTransDone, I2CTransFailed, and I2CTransSuccess.

◆ generic_com_init()

void generic_com_init ( void )

Definition at line 52 of file generic_com.c.

References active_com, com_trans, and I2CTransDone.

◆ generic_com_periodic()

void generic_com_periodic ( void )

◆ start_com()

void start_com ( void )

Definition at line 101 of file generic_com.c.

References active_com, com_trans, and I2CTransDone.

◆ stop_com()

void stop_com ( void )

Definition at line 107 of file generic_com.c.

References active_com, com_trans, GENERIC_COM_I2C_DEV, GENERIC_COM_SLAVE_ADDR, and i2c_transmit().

Here is the call graph for this function:

Variable Documentation

◆ active_com

bool active_com

Definition at line 50 of file generic_com.c.

Referenced by generic_com_init(), generic_com_periodic(), start_com(), and stop_com().

◆ com_trans

struct i2c_transaction com_trans