|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
30 #define PERIODIC_C_LOGGER
45 #define LOGGER_LED_ON LED_ON(LOGGER_LED);
46 #define LOGGER_LED_OFF LED_OFF(LOGGER_LED);
48 #define LOGGER_LED_ON {}
49 #define LOGGER_LED_OFF {}
52 #ifndef TELEMETRY_MODE_Main_empty
53 #warning You need to define a main telemetry mode named "empty" without any \
54 messages in your config file in /conf/telemetry/<your_config.xml>. \
56 Add <mode name="empty"></mode> to your main telemetry process.
59 #ifndef TELEMETRY_PROCESS_Logger
60 #error "You need to use a telemetry xml file with Logger process!"
63 #ifndef SDLOGGER_DOWNLOAD_DEVICE
64 #error No downlink device defined for SD Logger
67 #ifdef SDLOGGER_DOWNLOAD_DEVICE_LISTEN
69 #include "pprzlink/dl_protocol.h"
70 #include "generated/settings.h"
76 static struct download_port_t {
77 struct link_device *device;
78 struct pprz_transport transport;
83 static void sdlogger_spi_direct_download_port_init(
void) {
84 download_port.device = &((SDLOGGER_DOWNLOAD_DEVICE).device);
85 pprz_transport_init(&download_port.transport);
88 static void sdlogger_spi_direct_download_port_parse_msg(
void) {
89 switch (IdOfPprzMsg(download_port.msg_buf)) {
91 uint8_t index = DL_SETTING_index(download_port.msg_buf);
93 float value = DL_SETTING_value(download_port.msg_buf);
95 DlSetting(index, value);
96 pprz_msg_send_DL_VALUE(&download_port.transport.trans_tx, download_port.device, AC_ID, &index, &value);
105 static void sdlogger_spi_direct_download_port_periodic(
void) {
106 pprz_check_and_parse(download_port.device, &download_port.transport, download_port.msg_buf, &download_port.msg_available);
107 if (download_port.msg_available) {
108 sdlogger_spi_direct_download_port_parse_msg();
109 download_port.msg_available =
false;
112 #endif // SDLOGGER_DOWNLOAD_DEVICE_LISTEN
124 SDLOGGER_SPI_LINK_SLAVE_NUMBER);
153 #ifdef SDLOGGER_DOWNLOAD_DEVICE_LISTEN
154 sdlogger_spi_direct_download_port_init();
164 #ifdef SDLOGGER_DOWNLOAD_DEVICE_LISTEN
165 sdlogger_spi_direct_download_port_periodic();
197 #if PERIODIC_TELEMETRY
252 if ((SDLOGGER_DOWNLOAD_DEVICE).
device.check_free_space(&(SDLOGGER_DOWNLOAD_DEVICE), &
fd, 1)) {
262 (SDLOGGER_DOWNLOAD_DEVICE).
device.send_message(&(SDLOGGER_DOWNLOAD_DEVICE),
fd);
411 telemetry_mode_Main = TELEMETRY_MODE_Main_empty;
427 if (available >= len) {
437 if (
p->sdcard_buf_idx > 512) {
439 p->buffer[
p->idx++] = data;
457 for (i = 0; i < len; i++) {
void sdlogger_spi_direct_multiwrite_written(void)
sdlogger_spi_direct_multiwrite_written Called when a multiwrite is complete.
bool autopilot_get_motors_on(void)
get motors status
void sdcard_spi_multiwrite_start(struct SDCard *sdcard, uint32_t addr)
Start writing multiple blocks of 512 bytes to the SDCard.
@ SDCard_Idle
Initialization sequence succesful.
struct SDCard sdcard1
This is the definition of the SD card.
enum SDLoggerStatus status
void sdlogger_spi_direct_periodic(void)
sdlogger_spi_direct_periodic Periodic function called at module frequency
void sdlogger_spi_direct_start(void)
Initialize pprzlog transport.
void sdlogger_spi_direct_send_message(void *p, long fd)
void sdlogger_spi_direct_init(void)
sdlogger_spi_direct_init Initialize the logger and SD Card.
uint32_t download_address
uint32_t next_available_address
void sdlogger_spi_direct_command(void)
@ SDLogger_StoppedLogging
void sdcard_spi_multiwrite_stop(struct SDCard *sdcard)
Stop with multiwrite procedure.
@ SDLogger_RetreivingIndex
void sdcard_spi_periodic(struct SDCard *sdcard)
Periodic function of the SDCard.
void sdcard_spi_init(struct SDCard *sdcard, struct spi_periph *spi_p, const uint8_t slave_idx)
Configure initial values for SDCard.
int sdlogger_spi_direct_char_available(void *p)
struct sdlogger_spi_periph sdlogger_spi
#define SDLOGGER_BUFFER_SIZE
enum SDCardStatus status
The status of the SD card.
@ SDCard_MultiWriteIdle
CMD25 complete, ready to sent blocks.
struct link_device device
uint8_t buffer[SDLOGGER_BUFFER_SIZE]
void sdlogger_spi_direct_index_received(void)
sdlogger_spi_direct_index_received Callback from SD Card when block at index location is received.
@ SDLogger_GettingIndexForDownload
arch independent LED (Light Emitting Diodes) API
int sdlogger_spi_direct_check_free_space(struct sdlogger_spi_periph *p, long *fd, uint16_t len)
Common code for AP and FBW telemetry.
uint8_t output_buf[SD_BLOCK_SIZE+10]
The output buffer for the SPI transaction.
void sdcard_spi_write_block(struct SDCard *sdcard, uint32_t addr)
Write a single block (512 bytes) to the SDCard at a given address.
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
@ SDLogger_GettingIndexForUpdate
void sdlogger_spi_direct_stop(void)
struct pprzlog_transport pprzlog_tp
PPRZLOG transport structure.
void sdcard_spi_read_block(struct SDCard *sdcard, uint32_t addr, SDCardCallback callback)
Read a single block (512 bytes) from the SDCard at a given address.
void sdlogger_spi_direct_put_byte(struct sdlogger_spi_periph *p, long fd, uint8_t data)
void sdlogger_spi_direct_put_buffer(struct sdlogger_spi_periph *p, long fd, uint8_t *data, uint16_t len)
void sdcard_spi_multiwrite_next(struct SDCard *sdcard, SDCardCallback callback)
Write a(nother) data block (512 bytes) to the SDCard.
@ SDLogger_LoggingFinalBlock
uint8_t sdlogger_spi_direct_get_byte(void *p)
uint8_t input_buf[SD_BLOCK_SIZE+10]
The input buffer for the SPI transaction.
#define DefaultPeriodic
Set default periodic telemetry.