Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#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 "firmwares/rotorcraft/navigation.h"
#include "subsystems/datalink/telemetry.h"
#include "modules/display/max7456.h"
#include "modules/display/max7456_regs.h"
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 |
Maxim MAX7456 single-channel monochrome on-screen display driver.
Definition in file max7456.c.
struct MATRIX |
#define osd_sprintf _osd_sprintf |
enum osd_attributes |
|
static |
Definition at line 548 of file max7456.c.
References osd_string, OSD_STRING_SIZE, Int32Vect3::x, Int32Vect3::y, and Int32Vect3::z.
|
static |
Definition at line 369 of file max7456.c.
References c(), and PRINT_CONFIG_MSG().
Referenced by osd_put_s().
|
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().
|
static |
Definition at line 667 of file max7456.c.
References altitude, AP_MODE_AUTO1, AP_MODE_AUTO2, ap_state, autopilot, BLINK, C_JUST, calc_flight_time_left(), GpsState::course, electrical, GpsState::fix, GetPosAlt, gps, gps_course_deg, GPS_FIX_3D, home_direction(), INVERT, L_JUST, LOW_BAT_LEVEL, mag_course_deg, max_flyable_distance_left, MAX_PPRZ, pprz_autopilot::mode, osd_put_s(), osd_sprintf, osd_string, GpsState::pdop, FloatEulers::phi, FloatEulers::psi, R_JUST, stabilization_cmd, STALL_AIRSPEED, stateGetHorizontalSpeedNorm_f(), stateGetNedToBodyEulers_f(), stateGetPositionEnu_f(), stateGetSpeedEnu_f(), step, FloatEulers::theta, Electrical::vsupply, waypoint_get_x(), waypoint_get_y(), waypoints, point::x, EnuCoor_f::x, point::y, EnuCoor_f::y, and EnuCoor_f::z.
Referenced by max7456_periodic().
|
static |
Definition at line 287 of file max7456.c.
References UtmCoor_f::alt, GpsState::fix, VECTOR::fx, MATRIX::fx1, MATRIX::fx2, MATRIX::fx3, VECTOR::fy, MATRIX::fy1, MATRIX::fy2, MATRIX::fy3, VECTOR::fz, MATRIX::fz1, MATRIX::fz2, MATRIX::fz3, GetAltRef, gps, GPS_FIX_3D, home_dir_deg, stateGetHorizontalSpeedDir_f(), stateGetHorizontalSpeedNorm_f(), stateGetPositionEnu_f(), stateGetPositionUtm_f(), vMultiplyMatrixByVector(), vSubtractVectors(), waypoint_get_x(), waypoint_get_y(), WaypointX, WaypointY, EnuCoor_f::x, and EnuCoor_f::y.
Referenced by draw_osd(), and max7456_init().
void max7456_event | ( | void | ) |
Definition at line 1007 of file max7456.c.
References spi_transaction::input_buf, spi_transaction::input_length, max7456_osd_status, max7456_trans, osd_attr, OSD_AUTO_INCREMENT_MODE, osd_char_address, OSD_DMAL_REG, OSD_DMM_REG, osd_enable_val, OSD_FINISHED, OSD_IDLE, OSD_INIT1, OSD_INIT2, OSD_INIT3, OSD_INIT4, OSD_NVRAM_BUSY_FLAG, OSD_OSDBL_REG, OSD_READ_STATUS, OSD_RESET_BUSY_FLAG, OSD_S_STEP1, OSD_S_STEP2, OSD_S_STEP3, OSD_STAT_REG, osd_stat_reg, osd_string, OSD_VIDEO_MODE_PAL, OSD_VM0_REG, spi_transaction::output_buf, spi_transaction::output_length, spi_submit(), SPITransDone, SPITransSuccess, spi_transaction::status, and EnuCoor_f::x.
void max7456_init | ( | void | ) |
Definition at line 937 of file max7456.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, spi_transaction::cpha, spi_transaction::cpol, DefaultPeriodic, spi_transaction::dss, home_direction(), spi_transaction::input_buf, spi_transaction::input_length, max7456_osd_status, max7456_trans, osd_enable, osd_enable_val, OSD_IMAGE_ENABLE, osd_spi_rx_buffer, osd_spi_tx_buffer, OSD_UNINIT, spi_transaction::output_buf, spi_transaction::output_length, register_periodic_telemetry(), spi_transaction::select, send_mag_heading(), spi_transaction::slave_idx, SPICphaEdge1, SPICpolIdleLow, SPIDiv64, SPIDss8bit, SPIMSBFirst, and SPISelectUnselect.
void max7456_periodic | ( | void | ) |
Definition at line 966 of file max7456.c.
References draw_osd(), spi_transaction::input_length, max7456_osd_status, max7456_trans, osd_enable, osd_enable_val, OSD_IDLE, OSD_INIT1, OSD_INIT2, OSD_INIT3, OSD_OSDBL_REG_R, OSD_RESET, OSD_UNINIT, OSD_VM0_REG, spi_transaction::output_buf, spi_transaction::output_length, spi_submit(), SPITransDone, spi_transaction::status, and step.
|
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().
|
static |
Definition at line 252 of file max7456.c.
References dev, gps_course_deg, home_dir_deg, and mag_course_deg.
Referenced by max7456_init().
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().
Definition at line 267 of file max7456.c.
References VECTOR::fx, VECTOR::fy, and VECTOR::fz.
Referenced by home_direction().
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().
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().
Definition at line 143 of file max7456.c.
Referenced by max7456_event(), and osd_put_s().
uint16_t osd_char_address = 0 |
Definition at line 142 of file max7456.c.
Referenced by max7456_event(), and osd_put_s().
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] |
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().