50 } __attribute__((packed));
57 static uint16_t current_sequence_id = 0;
60 for (i = 0; i < array_size; i++) {
63 if (array[i] == sequence[current_sequence_id]) {
64 current_sequence_id++;
65 if (current_sequence_id >= sequence_size) {
67 current_sequence_id = 0;
71 current_sequence_id = 0;
75 if (array[i] == 0xFF) {
78 if (count_ff >= 1000) {
80 current_sequence_id = 0;
157 end_idx = seq_idx + 5;
161 for (i = 5; i < end_idx; i++) {
Write logs directly to flash memory chips.
static uint32_t dm_counter
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define DML_BUF_SIZE
The read buffer size.
The DML is busy stopping.
SPI transaction structure.
static uint8_t stop_log_sequence[6]
struct Imu imu
global IMU state
void direct_memory_logger_periodic(void)
void direct_memory_logger_set(uint8_t val)
enum DMLStatus status
The status of the Direct Memory Logger.
int32_t r
in rad/s with INT32_RATE_FRAC
struct Int32Vect3 accel
accelerometer measurements in m/s^2 in BFP with INT32_ACCEL_FRAC
void direct_memory_logger_init(void)
The DML is busy starting read.
enum SST25VFxxxxStatus status
The status of the SST25VFxxxx flash chip.
static struct LogStruct log_struct
The DML is busy erasing itself.
void sst25vfxxxx_init(struct SST25VFxxxx *sst, struct spi_periph *spi_p, const uint8_t slave_idx, SPICallback spi_cb)
Initializing the sst25vfxxxx chip.
Inertial Measurement Unit interface.
The chip is idle and can be used.
uint8_t buffer[DML_BUF_SIZE]
The buffer for writing and reading.
void uart_put_byte(struct uart_periph *p, long fd, uint8_t data)
Uart transmit implementation.
struct DirectMemoryLogger dml
static uint8_t start_log_sequence[6]
struct SST25VFxxxx sst
The memory chip.
void sst25vfxxxx_write(struct SST25VFxxxx *sst, uint8_t *transfer_buffer, uint8_t transfer_length)
Write bytes.
uint32_t flash_addr
The flash address to write at.
General stabilization interface for rotorcrafts.
The DML is starting the logger.
static void direct_memory_spi_cb(struct spi_transaction *trans)
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
int32_t p
in rad/s with INT32_RATE_FRAC
static int32_t seq_in_array(uint8_t *array, uint16_t array_size, uint8_t *sequence, uint16_t sequence_size)
void sst25vfxxxx_read(struct SST25VFxxxx *sst, uint8_t *transfer_buffer, uint8_t transfer_length)
Read bytes Need 5 more extra bytes because of SPI overhead.
void sst25vfxxxx_chip_erase(struct SST25VFxxxx *sst)
Full chip erase.
int32_t q
in rad/s with INT32_RATE_FRAC
void sst25vfxxxx_after_cb(struct SST25VFxxxx *sst)
Callback of the SPI after going one level higher for gathering the sst pointer.
struct Int32Rates gyro
gyroscope measurements in rad/s in BFP with INT32_RATE_FRAC