Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/loggers/sdlogger_spi_direct.h"
#include "subsystems/datalink/pprzlog_transport.h"
#include "subsystems/datalink/telemetry.h"
#include "subsystems/radio_control.h"
#include "led.h"
Go to the source code of this file.
Macros | |
#define | PERIODIC_C_LOGGER |
#define | LOGGER_LED_ON {} |
#define | LOGGER_LED_OFF {} |
Functions | |
void | sdlogger_spi_direct_init (void) |
sdlogger_spi_direct_init Initialize the logger and SD Card. More... | |
void | sdlogger_spi_direct_periodic (void) |
sdlogger_spi_direct_periodic Periodic function called at module frequency More... | |
void | sdlogger_spi_direct_start (void) |
void | sdlogger_spi_direct_stop (void) |
void | sdlogger_spi_direct_index_received (void) |
sdlogger_spi_direct_index_received Callback from SD Card when block at index location is received. More... | |
void | sdlogger_spi_direct_multiwrite_written (void) |
sdlogger_spi_direct_multiwrite_written Called when a multiwrite is complete. More... | |
void | sdlogger_spi_direct_command (void) |
bool_t | sdlogger_spi_direct_check_free_space (struct sdlogger_spi_periph *p, uint8_t len) |
void | sdlogger_spi_direct_put_byte (struct sdlogger_spi_periph *p, uint8_t data) |
void | sdlogger_spi_direct_send_message (void *p) |
int | sdlogger_spi_direct_char_available (void *p) |
uint8_t | sdlogger_spi_direct_get_byte (void *p) |
Variables | |
struct sdlogger_spi_periph | sdlogger_spi |
Developed using Test Driven Development. Test code available at: https://github.com/bartslinger/paparazzi-unittest
Definition in file sdlogger_spi_direct.c.
#define LOGGER_LED_OFF {} |
Definition at line 43 of file sdlogger_spi_direct.c.
Referenced by sdlogger_spi_direct_index_received(), and sdlogger_spi_direct_periodic().
#define LOGGER_LED_ON {} |
Definition at line 42 of file sdlogger_spi_direct.c.
Referenced by sdlogger_spi_direct_command(), and sdlogger_spi_direct_periodic().
#define PERIODIC_C_LOGGER |
Definition at line 30 of file sdlogger_spi_direct.c.
int sdlogger_spi_direct_char_available | ( | void * | p | ) |
Definition at line 385 of file sdlogger_spi_direct.c.
Referenced by sdlogger_spi_direct_init().
bool_t sdlogger_spi_direct_check_free_space | ( | struct sdlogger_spi_periph * | p, |
uint8_t | len | ||
) |
Definition at line 349 of file sdlogger_spi_direct.c.
References FALSE, sdlogger_spi_periph::idx, sdlogger_spi_periph::sdcard_buf_idx, SDLOGGER_BUFFER_SIZE, SDLogger_Logging, sdlogger_spi_periph::status, and TRUE.
Referenced by sdlogger_spi_direct_init().
void sdlogger_spi_direct_command | ( | void | ) |
Definition at line 327 of file sdlogger_spi_direct.c.
References sdlogger_spi_periph::command, sdlogger_spi_periph::download_id, sdlogger_spi_periph::download_length, LOGGER_LED_ON, sdcard1, sdlogger_spi_periph::sdcard_buf_idx, SDCard_Idle, sdcard_spi_read_block(), SDLogger_Downloading, SDLogger_GettingIndexForDownload, sdlogger_spi, sdlogger_spi_direct_index_received(), sdlogger_spi_periph::status, and SDCard::status.
uint8_t sdlogger_spi_direct_get_byte | ( | void * | p | ) |
Definition at line 390 of file sdlogger_spi_direct.c.
Referenced by sdlogger_spi_direct_init().
void sdlogger_spi_direct_index_received | ( | void | ) |
sdlogger_spi_direct_index_received Callback from SD Card when block at index location is received.
Definition at line 219 of file sdlogger_spi_direct.c.
References sdlogger_spi_periph::download_address, sdlogger_spi_periph::download_id, sdlogger_spi_periph::download_length, SDCard::input_buf, sdlogger_spi_periph::last_completed, sdlogger_spi_periph::log_len, LOGGER_LED_OFF, sdlogger_spi_periph::next_available_address, SDCard::output_buf, SD_BLOCK_SIZE, sdcard1, sdlogger_spi_periph::sdcard_buf_idx, sdcard_spi_read_block(), sdcard_spi_write_block(), SDLogger_Downloading, SDLogger_GettingIndexForDownload, SDLogger_GettingIndexForUpdate, SDLogger_Ready, SDLogger_RetreivingIndex, sdlogger_spi, SDLogger_UpdatingIndex, and sdlogger_spi_periph::status.
Referenced by sdlogger_spi_direct_command(), and sdlogger_spi_direct_periodic().
void sdlogger_spi_direct_init | ( | void | ) |
sdlogger_spi_direct_init Initialize the logger and SD Card.
Definition at line 67 of file sdlogger_spi_direct.c.
References sdlogger_spi_periph::buffer, link_device::char_available, link_device::check_free_space, sdlogger_spi_periph::command, sdlogger_spi_periph::device, sdlogger_spi_periph::download_address, sdlogger_spi_periph::download_id, sdlogger_spi_periph::download_length, link_device::get_byte, sdlogger_spi_periph::idx, sdlogger_spi_periph::last_completed, sdlogger_spi_periph::log_len, sdlogger_spi_periph::next_available_address, link_device::periph, pprzlog_transport_init(), link_device::put_byte, sdcard1, sdlogger_spi_periph::sdcard_buf_idx, sdcard_spi_init(), SDLogger_Initializing, sdlogger_spi, sdlogger_spi_direct_char_available(), sdlogger_spi_direct_check_free_space(), sdlogger_spi_direct_get_byte(), sdlogger_spi_direct_put_byte(), sdlogger_spi_direct_send_message(), link_device::send_message, and sdlogger_spi_periph::status.
void sdlogger_spi_direct_multiwrite_written | ( | void | ) |
sdlogger_spi_direct_multiwrite_written Called when a multiwrite is complete.
Data stored in the logger buffer is then moved to the SD Card buffer, which is now available again.
Definition at line 312 of file sdlogger_spi_direct.c.
References sdlogger_spi_periph::buffer, sdlogger_spi_periph::idx, sdlogger_spi_periph::log_len, SDCard::output_buf, sdcard1, sdlogger_spi_periph::sdcard_buf_idx, and sdlogger_spi.
Referenced by sdlogger_spi_direct_periodic(), and sdlogger_spi_direct_put_byte().
void sdlogger_spi_direct_periodic | ( | void | ) |
sdlogger_spi_direct_periodic Periodic function called at module frequency
Definition at line 106 of file sdlogger_spi_direct.c.
References DefaultPeriodic, sdlogger_spi_periph::device, DOWNLINK_DEVICE, sdlogger_spi_periph::download_address, sdlogger_spi_periph::download_length, SDCard::input_buf, LOGGER_LED_OFF, LOGGER_LED_ON, sdlogger_spi_periph::next_available_address, SDCard::output_buf, pprzlog_tp, radio_control, SD_BLOCK_SIZE, sdcard1, sdlogger_spi_periph::sdcard_buf_idx, SDCard_Idle, SDCard_MultiWriteIdle, sdcard_spi_multiwrite_next(), sdcard_spi_multiwrite_start(), sdcard_spi_multiwrite_stop(), sdcard_spi_periodic(), sdcard_spi_read_block(), SDLogger_Downloading, SDLogger_GettingIndexForUpdate, SDLogger_Initializing, SDLogger_Logging, SDLogger_LoggingFinalBlock, SDLogger_Ready, SDLogger_RetreivingIndex, sdlogger_spi, sdlogger_spi_direct_index_received(), sdlogger_spi_direct_multiwrite_written(), SDLogger_StoppedLogging, SDLogger_UpdatingIndex, sdlogger_spi_periph::status, SDCard::status, pprzlog_transport::trans_tx, uart_check_free_space(), uart_put_byte(), and RadioControl::values.
void sdlogger_spi_direct_put_byte | ( | struct sdlogger_spi_periph * | p, |
uint8_t | data | ||
) |
Definition at line 360 of file sdlogger_spi_direct.c.
References sdlogger_spi_periph::buffer, sdlogger_spi_periph::idx, SDCard::output_buf, sdcard1, sdlogger_spi_periph::sdcard_buf_idx, SDCard_MultiWriteIdle, sdcard_spi_multiwrite_next(), SDLOGGER_BUFFER_SIZE, sdlogger_spi_direct_multiwrite_written(), and SDCard::status.
Referenced by sdlogger_spi_direct_init().
void sdlogger_spi_direct_send_message | ( | void * | p | ) |
Definition at line 380 of file sdlogger_spi_direct.c.
Referenced by sdlogger_spi_direct_init().
void sdlogger_spi_direct_start | ( | void | ) |
Definition at line 212 of file sdlogger_spi_direct.c.
void sdlogger_spi_direct_stop | ( | void | ) |
Definition at line 213 of file sdlogger_spi_direct.c.
struct sdlogger_spi_periph sdlogger_spi |
Definition at line 61 of file sdlogger_spi_direct.c.
Referenced by sdlogger_spi_direct_command(), sdlogger_spi_direct_index_received(), sdlogger_spi_direct_init(), sdlogger_spi_direct_multiwrite_written(), and sdlogger_spi_direct_periodic().