Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
max7456.c File Reference

Maxim MAX7456 single-channel monochrome on-screen display driver. More...

#include "std.h"
#include "modules/core/commands.h"
#include "mcu_periph/sys_time.h"
#include "mcu_periph/gpio.h"
#include "mcu_periph/spi.h"
#include "generated/flight_plan.h"
#include "generated/airframe.h"
#include "autopilot.h"
#include "modules/energy/electrical.h"
#include "state.h"
#include "modules/datalink/telemetry.h"
#include "modules/display/max7456.h"
#include "modules/display/max7456_regs.h"
+ Include dependency graph for max7456.c:

Go to the source code of this file.

Data Structures

struct  VECTOR
 
struct  MATRIX
 

Macros

#define OSD_STRING_SIZE   31
 
#define osd_sprintf   _osd_sprintf
 
#define OSD_USE_FLOAT_LOW_PASS_FILTERING
 
#define AMPS_LOW_PASS_FILTER_STRENGTH   6
 
#define SPEED_LOW_PASS_FILTER_STRENGTH   6
 
#define BAT_CAPACITY   5000.0
 
#define IMU_MAG_X_SIGN   1
 

Enumerations

enum  max7456_osd_status_codes {
  OSD_UNINIT , OSD_INIT1 , OSD_INIT2 , OSD_INIT3 ,
  OSD_INIT4 , OSD_READ_STATUS , OSD_IDLE , OSD_S_STEP1 ,
  OSD_S_STEP2 , OSD_S_STEP3 , OSD_FINISHED
}
 
enum  osd_attributes {
  BLINK = OSD_BLINK_CHAR , INVERT = OSD_INVERT_PIXELS , L_JUST = 0x00 , R_JUST = 0x01 ,
  C_JUST = 0x02
}
 

Functions

static void send_mag_heading (struct transport_tx *trans, struct link_device *dev)
 
static void vSubtractVectors (VECTOR *svA, VECTOR svB, VECTOR svC)
 
static void vMultiplyMatrixByVector (VECTOR *svA, MATRIX smB, VECTOR svC)
 
static float home_direction (void)
 
static char ascii_to_osd_c (char c)
 
static void calc_flight_time_left (void)
 
static void draw_osd (void)
 
static void osd_put_s (char *string, uint8_t attributes, uint8_t char_nb, uint8_t row, uint8_t column)
 
static bool _osd_sprintf (char *buffer, char *string, float value)
 
void max7456_init (void)
 
void max7456_periodic (void)
 
void max7456_event (void)
 

Variables

struct spi_transaction max7456_trans
 
uint8_t osd_spi_tx_buffer [2]
 
uint8_t osd_spi_rx_buffer [2]
 
char osd_string [OSD_STRING_SIZE]
 
char osd_str_buf [OSD_STRING_SIZE]
 
char osd_char = ' '
 
uint8_t step = 0
 
uint16_t osd_char_address = 0
 
uint8_t osd_attr = false
 
uint8_t max7456_osd_status = OSD_UNINIT
 
uint8_t osd_enable = true
 
uint8_t osd_enable_val = OSD_IMAGE_ENABLE
 
uint8_t osd_stat_reg = 0
 
uint32_t max_flyable_distance_left = 0
 
float mag_course_deg = 0
 
float mag_heading_rad = 0
 
float gps_course_deg = 0
 
float home_dir_deg = 0
 

Detailed Description

Maxim MAX7456 single-channel monochrome on-screen display driver.

Definition in file max7456.c.


Data Structure Documentation

◆ VECTOR

struct VECTOR

Definition at line 84 of file point.c.

Data Fields
float fx
float fy
float fz

◆ MATRIX

struct MATRIX

Definition at line 90 of file point.c.

Data Fields
float fx1
float fx2
float fx3
float fy1
float fy2
float fy3
float fz1
float fz2
float fz3

Macro Definition Documentation

◆ AMPS_LOW_PASS_FILTER_STRENGTH

#define AMPS_LOW_PASS_FILTER_STRENGTH   6

Definition at line 67 of file max7456.c.

◆ BAT_CAPACITY

#define BAT_CAPACITY   5000.0

Definition at line 76 of file max7456.c.

◆ IMU_MAG_X_SIGN

#define IMU_MAG_X_SIGN   1

Definition at line 99 of file max7456.c.

◆ osd_sprintf

#define osd_sprintf   _osd_sprintf

Definition at line 59 of file max7456.c.

◆ OSD_STRING_SIZE

#define OSD_STRING_SIZE   31

Definition at line 58 of file max7456.c.

◆ OSD_USE_FLOAT_LOW_PASS_FILTERING

#define OSD_USE_FLOAT_LOW_PASS_FILTERING

Definition at line 62 of file max7456.c.

◆ SPEED_LOW_PASS_FILTER_STRENGTH

#define SPEED_LOW_PASS_FILTER_STRENGTH   6

Definition at line 71 of file max7456.c.

Enumeration Type Documentation

◆ max7456_osd_status_codes

Enumerator
OSD_UNINIT 
OSD_INIT1 
OSD_INIT2 
OSD_INIT3 
OSD_INIT4 
OSD_READ_STATUS 
OSD_IDLE 
OSD_S_STEP1 
OSD_S_STEP2 
OSD_S_STEP3 
OSD_FINISHED 

Definition at line 145 of file max7456.c.

◆ osd_attributes

Enumerator
BLINK 
INVERT 
L_JUST 
R_JUST 
C_JUST 

Definition at line 159 of file max7456.c.

Function Documentation

◆ _osd_sprintf()

static bool _osd_sprintf ( char *  buffer,
char *  string,
float  value 
)
static

Definition at line 537 of file max7456.c.

References osd_string, and OSD_STRING_SIZE.

◆ ascii_to_osd_c()

static char ascii_to_osd_c ( char  c)
static

Definition at line 358 of file max7456.c.

References PRINT_CONFIG_MSG().

Referenced by osd_put_s().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_flight_time_left()

static void calc_flight_time_left ( void  )
static

Definition at line 403 of file max7456.c.

References AMPS_LOW_PASS_FILTER_STRENGTH, autopilot, BAT_CAPACITY, Electrical::current, electrical, pprz_autopilot::launch, max_flyable_distance_left, SPEED_LOW_PASS_FILTER_STRENGTH, and stateGetHorizontalSpeedNorm_f().

Referenced by draw_osd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_osd()

◆ home_direction()

◆ max7456_event()

◆ max7456_init()

◆ max7456_periodic()

◆ osd_put_s()

static void osd_put_s ( char *  string,
uint8_t  attributes,
uint8_t  char_nb,
uint8_t  row,
uint8_t  column 
)
static

Definition at line 474 of file max7456.c.

References ascii_to_osd_c(), BLINK, C_JUST, idx, INVERT, max7456_osd_status, max7456_trans, osd_attr, osd_char_address, OSD_DMAH_REG, OSD_IDLE, OSD_S_STEP1, osd_string, OSD_STRING_SIZE, spi_transaction::output_buf, spi_transaction::output_length, R_JUST, and spi_submit().

Referenced by draw_osd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_mag_heading()

static void send_mag_heading ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 241 of file max7456.c.

References ABI_BROADCAST, imu_mag_t::abi_id, dev, gps_course_deg, home_dir_deg, and mag_course_deg.

Referenced by max7456_init().

+ Here is the caller graph for this function:

◆ vMultiplyMatrixByVector()

static void vMultiplyMatrixByVector ( VECTOR svA,
MATRIX  smB,
VECTOR  svC 
)
static

Definition at line 268 of file max7456.c.

References VECTOR::fx, MATRIX::fx1, MATRIX::fx2, MATRIX::fx3, VECTOR::fy, MATRIX::fy1, MATRIX::fy2, MATRIX::fy3, VECTOR::fz, MATRIX::fz1, MATRIX::fz2, and MATRIX::fz3.

Referenced by home_direction().

+ Here is the caller graph for this function:

◆ vSubtractVectors()

static void vSubtractVectors ( VECTOR svA,
VECTOR  svB,
VECTOR  svC 
)
static

Definition at line 256 of file max7456.c.

References VECTOR::fx, VECTOR::fy, and VECTOR::fz.

Referenced by home_direction().

+ Here is the caller graph for this function:

Variable Documentation

◆ gps_course_deg

float gps_course_deg = 0

Definition at line 176 of file max7456.c.

Referenced by draw_osd(), and send_mag_heading().

◆ home_dir_deg

float home_dir_deg = 0

Definition at line 177 of file max7456.c.

Referenced by home_direction(), and send_mag_heading().

◆ mag_course_deg

float mag_course_deg = 0

Definition at line 174 of file max7456.c.

Referenced by draw_osd(), and send_mag_heading().

◆ mag_heading_rad

float mag_heading_rad = 0

Definition at line 175 of file max7456.c.

◆ max7456_osd_status

uint8_t max7456_osd_status = OSD_UNINIT

Definition at line 168 of file max7456.c.

Referenced by max7456_event(), max7456_init(), max7456_periodic(), and osd_put_s().

◆ max7456_trans

struct spi_transaction max7456_trans

Definition at line 132 of file max7456.c.

Referenced by max7456_event(), max7456_init(), max7456_periodic(), and osd_put_s().

◆ max_flyable_distance_left

uint32_t max_flyable_distance_left = 0

Definition at line 172 of file max7456.c.

Referenced by calc_flight_time_left(), and draw_osd().

◆ osd_attr

uint8_t osd_attr = false

Definition at line 143 of file max7456.c.

Referenced by max7456_event(), and osd_put_s().

◆ osd_char

char osd_char = ' '

Definition at line 140 of file max7456.c.

◆ osd_char_address

uint16_t osd_char_address = 0

Definition at line 142 of file max7456.c.

Referenced by max7456_event(), and osd_put_s().

◆ osd_enable

uint8_t osd_enable = true

Definition at line 169 of file max7456.c.

Referenced by max7456_init(), and max7456_periodic().

◆ osd_enable_val

uint8_t osd_enable_val = OSD_IMAGE_ENABLE

Definition at line 170 of file max7456.c.

Referenced by max7456_event(), max7456_init(), and max7456_periodic().

◆ osd_spi_rx_buffer

uint8_t osd_spi_rx_buffer[2]

Definition at line 137 of file max7456.c.

Referenced by max7456_init().

◆ osd_spi_tx_buffer

uint8_t osd_spi_tx_buffer[2]

Definition at line 136 of file max7456.c.

Referenced by max7456_init().

◆ osd_stat_reg

uint8_t osd_stat_reg = 0

Definition at line 171 of file max7456.c.

Referenced by max7456_event().

◆ osd_str_buf

char osd_str_buf[OSD_STRING_SIZE]

Definition at line 139 of file max7456.c.

◆ osd_string

char osd_string[OSD_STRING_SIZE]

Definition at line 138 of file max7456.c.

Referenced by _osd_sprintf(), draw_osd(), max7456_event(), and osd_put_s().

◆ step

uint8_t step = 0

Definition at line 141 of file max7456.c.

Referenced by draw_osd(), and max7456_periodic().