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);
92 uint8_t ac_id = DL_SETTING_ac_id(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;
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++) {
bool autopilot_get_motors_on(void)
get motors status
Core autopilot interface common to all firmwares.
Common code for AP and FBW telemetry.
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
arch independent LED (Light Emitting Diodes) API
struct pprzlog_transport pprzlog_tp
PPRZLOG transport structure.
Initialize pprzlog transport.
void sdcard_spi_multiwrite_next(struct SDCard *sdcard, SDCardCallback callback)
Write a(nother) data block (512 bytes) to the SDCard.
void sdcard_spi_write_block(struct SDCard *sdcard, uint32_t addr)
Write a single block (512 bytes) to the SDCard at a given address.
void sdcard_spi_multiwrite_start(struct SDCard *sdcard, uint32_t addr)
Start writing multiple blocks of 512 bytes to the SDCard.
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 sdcard_spi_periodic(struct SDCard *sdcard)
Periodic function of the SDCard.
struct SDCard sdcard1
This is the definition of the SD card.
void sdcard_spi_init(struct SDCard *sdcard, struct spi_periph *spi_p, const uint8_t slave_idx)
Configure initial values for SDCard.
void sdcard_spi_multiwrite_stop(struct SDCard *sdcard)
Stop with multiwrite procedure.
@ SDCard_MultiWriteIdle
CMD25 complete, ready to sent blocks.
@ SDCard_Idle
Initialization sequence succesful.
enum SDCardStatus status
The status of the SD card.
uint8_t output_buf[SD_BLOCK_SIZE+10]
The output buffer for the SPI transaction.
uint8_t input_buf[SD_BLOCK_SIZE+10]
The input buffer for the SPI transaction.
void sdlogger_spi_direct_index_received(void)
sdlogger_spi_direct_index_received Callback from SD Card when block at index location is received.
uint8_t sdlogger_spi_direct_get_byte(void *p)
void sdlogger_spi_direct_command(void)
void sdlogger_spi_direct_put_buffer(struct sdlogger_spi_periph *p, long fd, uint8_t *data, uint16_t len)
struct sdlogger_spi_periph sdlogger_spi
void sdlogger_spi_direct_init(void)
sdlogger_spi_direct_init Initialize the logger and SD Card.
void sdlogger_spi_direct_put_byte(struct sdlogger_spi_periph *p, long fd, uint8_t data)
void sdlogger_spi_direct_stop(void)
void sdlogger_spi_direct_multiwrite_written(void)
sdlogger_spi_direct_multiwrite_written Called when a multiwrite is complete.
void sdlogger_spi_direct_send_message(void *p, long fd)
void sdlogger_spi_direct_periodic(void)
sdlogger_spi_direct_periodic Periodic function called at module frequency
int sdlogger_spi_direct_char_available(void *p)
int sdlogger_spi_direct_check_free_space(struct sdlogger_spi_periph *p, long *fd, uint16_t len)
void sdlogger_spi_direct_start(void)
uint8_t buffer[SDLOGGER_BUFFER_SIZE]
@ SDLogger_StoppedLogging
@ SDLogger_RetreivingIndex
@ SDLogger_GettingIndexForDownload
@ SDLogger_GettingIndexForUpdate
@ SDLogger_LoggingFinalBlock
struct link_device device
enum SDLoggerStatus status
#define SDLOGGER_BUFFER_SIZE
uint32_t download_address
uint32_t next_available_address
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.