Paparazzi UAS  v6.0_unstable-92-g17422e4-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
max7456.c File Reference

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

#include "std.h"
#include "inter_mcu.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 "subsystems/electrical.h"
#include "state.h"
#include "subsystems/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

struct VECTOR

Definition at line 84 of file point.c.

Data Fields
float fx
float fy
float fz
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

#define AMPS_LOW_PASS_FILTER_STRENGTH   6

Definition at line 67 of file max7456.c.

Referenced by calc_flight_time_left().

#define BAT_CAPACITY   5000.0

Definition at line 76 of file max7456.c.

Referenced by calc_flight_time_left().

#define IMU_MAG_X_SIGN   1

Definition at line 99 of file max7456.c.

Referenced by imu_scale_mag().

#define osd_sprintf   _osd_sprintf

Definition at line 59 of file max7456.c.

Referenced by draw_osd().

#define OSD_STRING_SIZE   31

Definition at line 58 of file max7456.c.

Referenced by _osd_sprintf(), and osd_put_s().

#define OSD_USE_FLOAT_LOW_PASS_FILTERING

Definition at line 62 of file max7456.c.

#define SPEED_LOW_PASS_FILTER_STRENGTH   6

Definition at line 71 of file max7456.c.

Referenced by calc_flight_time_left().

Enumeration Type Documentation

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.

Enumerator
BLINK 
INVERT 
L_JUST 
R_JUST 
C_JUST 

Definition at line 159 of file max7456.c.

Function Documentation

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

Definition at line 548 of file max7456.c.

References osd_string, OSD_STRING_SIZE, Int32Vect3::x, Int32Vect3::y, and Int32Vect3::z.

static char ascii_to_osd_c ( char  c)
static

Definition at line 369 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:

static void calc_flight_time_left ( void  )
static

Definition at line 414 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:

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

Definition at line 485 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, spi_submit(), and Int32Vect3::x.

Referenced by draw_osd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 252 of file max7456.c.

References gps_course_deg, home_dir_deg, and mag_course_deg.

Referenced by max7456_init().

+ Here is the caller graph for this function:

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

Definition at line 279 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:

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

Definition at line 267 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

float gps_course_deg = 0

Definition at line 176 of file max7456.c.

Referenced by draw_osd(), and send_mag_heading().

float home_dir_deg = 0

Definition at line 177 of file max7456.c.

Referenced by home_direction(), and send_mag_heading().

float mag_course_deg = 0

Definition at line 174 of file max7456.c.

Referenced by draw_osd(), and send_mag_heading().

float mag_heading_rad = 0

Definition at line 175 of file max7456.c.

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().

struct spi_transaction max7456_trans

Definition at line 134 of file max7456.c.

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

uint32_t max_flyable_distance_left = 0

Definition at line 172 of file max7456.c.

Referenced by calc_flight_time_left(), and draw_osd().

uint8_t osd_attr = false

Definition at line 143 of file max7456.c.

Referenced by max7456_event(), and osd_put_s().

char osd_char = ' '

Definition at line 140 of file max7456.c.

uint16_t osd_char_address = 0

Definition at line 142 of file max7456.c.

Referenced by max7456_event(), and osd_put_s().

uint8_t osd_enable = true

Definition at line 169 of file max7456.c.

Referenced by max7456_init(), and max7456_periodic().

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().

uint8_t osd_spi_rx_buffer[2]

Definition at line 137 of file max7456.c.

Referenced by max7456_init().

uint8_t osd_spi_tx_buffer[2]

Definition at line 136 of file max7456.c.

Referenced by max7456_init().

uint8_t osd_stat_reg = 0

Definition at line 171 of file max7456.c.

Referenced by max7456_event().

char osd_str_buf[OSD_STRING_SIZE]

Definition at line 139 of file max7456.c.

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().

uint8_t step = 0

Definition at line 141 of file max7456.c.

Referenced by draw_osd(), and max7456_periodic().