35 #include "generated/flight_plan.h"
36 #include "generated/airframe.h"
43 #include "subsystems/navigation/nav.h"
52 #define OSD_STRING_SIZE 31
53 #define osd_sprintf _osd_sprintf
57 static bool _osd_sprintf(
char *buffer,
char *
string,
float value);
169 #if MAG_HEADING_AVAILABLE && !defined(SITL)
170 temp = DegOfRad(MAG_Heading);
227 #if USE_PAL_FOR_OSD_VIDEO
280 if (c >=
'0' && c <=
'9') {
287 if (c >=
'A' && c <=
'Z') {
290 if (c >=
'a' && c <=
'z') {
294 case (
'('): c = 0x3f;
break;
295 case (
')'): c = 0x40;
break;
296 case (
'.'): c = 0x41;
break;
297 case (
'?'): c = 0x42;
break;
298 case (
';'): c = 0x43;
break;
299 case (
':'): c = 0x44;
break;
300 case (
','): c = 0x45;
break;
302 case (
'/'): c = 0x47;
break;
303 case (
'"'): c = 0x48;
break;
304 case (
'-'): c = 0x49;
break;
305 case (
'<'): c = 0x4A;
break;
306 case (
'>'): c = 0x4B;
break;
307 case (
'@'): c = 0x4C;
break;
308 case (
' '): c = 0x00;
break;
309 case (
'\0'): c = 0xFF;
break;
333 while ( (*(
string + x) !=
'\0') && ( x < (
sizeof(
osd_string)-1) )) {
350 for (; x < char_nb; x++) {
381 char to_asc[10] = {48, 48, 48, 48, 48, 48, 48, 48, 48, 48};
389 while (*(
string + x) !=
'\0') {
390 if (*(
string + x) ==
'%') {
392 }
else if (*(
string + x) ==
'f') {
399 frac_nb = *(
string + param_end - 1) - 48;
405 y = (
sizeof(to_asc) - 3);
408 if (frac_nb > 0 && frac_nb <= 3) {
414 digit = (i_frac / x);
415 to_asc[y + z] = digit + 48;
426 to_asc[y] = (i_dec % 10) + 48;
430 y--; to_asc[y] =
'-';
439 for (x = 0; x < param_start; x++) {
440 *(buffer + x) = *(
string + x);
445 while (y <
sizeof(to_asc)) {
446 *(buffer + x) = to_asc[y];
453 *(buffer + x++) = *(
string + param_end);
454 }
while (*(
string + param_end) !=
'\0');
enum SPIClockPolarity cpol
clock polarity control
char osd_str_buf[OSD_STRING_SIZE]
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
uint16_t output_length
number of data words to write
Maxim MAX7456 single-channel monochrome on-screen display driver.
float h_speed_dir_f
Direction of horizontal ground speed.
#define LOW_BAT_LEVEL
low battery level in Volts (for 3S LiPo)
Some architecture independent helper functions for GPIOs.
float h_speed_norm_f
Norm of horizontal ground speed.
Maxim MAX7456 single-channel monochrome on-screen display driver.
SPI transaction structure.
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
enum SPIBitOrder bitorder
MSB/LSB order.
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
enum SPISlaveSelect select
slave selection behavior
Architecture independent SPI (Serial Peripheral Interface) API.
#define OSD_AUTO_INCREMENT_MODE
enum SPIClockPhase cpha
clock phase control
struct spi_transaction max7456_trans
static bool _osd_sprintf(char *buffer, char *string, float value)
Interface for electrical status: supply voltage, current, battery status, etc.
Architecture independent timing functions.
SPICallback after_cb
NULL or function called after the transaction.
char osd_string[OSD_STRING_SIZE]
uint16_t input_length
number of data words to read
uint8_t max7456_osd_status
Core autopilot interface common to all firmwares.
Rotorcraft navigation functions.
#define OSD_INVERT_PIXELS
static void osd_put_s(char *string, uint8_t attributes, uint8_t char_nb, uint8_t row, uint8_t column)
#define OSD_VIDEO_MODE_PAL
API to get/set the generic vehicle states.
void max7456_periodic(void)
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
uint16_t vsupply
supply voltage in decivolts
slave is selected before transaction and unselected after
enum SPIDataSizeSelect dss
data transfer word size
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
uint8_t osd_spi_tx_buffer[2]
volatile uint8_t * input_buf
pointer to receive buffer for DMA
SPICallback before_cb
NULL or function called before the transaction.
struct Electrical electrical
uint16_t osd_char_address
uint8_t osd_spi_rx_buffer[2]
#define GetPosAlt()
Get current altitude above MSL.
enum SPITransactionStatus status
static char ascii_to_osd_c(char c)