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);
168 #if MAG_HEADING_AVAILABLE && !defined(SITL)
169 temp = DegOfRad(MAG_Heading);
226 #if USE_PAL_FOR_OSD_VIDEO
279 if (c >=
'0' && c <=
'9') {
286 if (c >=
'A' && c <=
'Z') {
289 if (c >=
'a' && c <=
'z') {
293 case (
'('): c = 0x3f;
break;
294 case (
')'): c = 0x40;
break;
295 case (
'.'): c = 0x41;
break;
296 case (
'?'): c = 0x42;
break;
297 case (
';'): c = 0x43;
break;
298 case (
':'): c = 0x44;
break;
299 case (
','): c = 0x45;
break;
301 case (
'/'): c = 0x47;
break;
302 case (
'"'): c = 0x48;
break;
303 case (
'-'): c = 0x49;
break;
304 case (
'<'): c = 0x4A;
break;
305 case (
'>'): c = 0x4B;
break;
306 case (
'@'): c = 0x4C;
break;
307 case (
' '): c = 0x00;
break;
308 case (
'\0'): c = 0xFF;
break;
332 while ( (*(
string + x) !=
'\0') && ( x < (
sizeof(
osd_string)-1) )) {
349 for (; x < char_nb; x++) {
380 char to_asc[10] = {48, 48, 48, 48, 48, 48, 48, 48, 48, 48};
388 while (*(
string + x) !=
'\0') {
389 if (*(
string + x) ==
'%') {
391 }
else if (*(
string + x) ==
'f') {
398 frac_nb = *(
string + param_end - 1) - 48;
404 y = (
sizeof(to_asc) - 3);
407 if (frac_nb > 0 && frac_nb <= 3) {
413 digit = (i_frac / x);
414 to_asc[y + z] = digit + 48;
425 to_asc[y] = (i_dec % 10) + 48;
429 y--; to_asc[y] =
'-';
438 for (x = 0; x < param_start; x++) {
439 *(buffer + x) = *(
string + x);
444 while (y <
sizeof(to_asc)) {
445 *(buffer + x) = to_asc[y];
452 *(buffer + x++) = *(
string + param_end);
453 }
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.
float vsupply
supply voltage in V
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).
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)