0
mirror of https://gitlab.com/hyperglitch/jellyfish.git synced 2025-12-29 07:36:29 +00:00
2025-06-12 10:31:43 +02:00

38 lines
1.0 KiB
C

/*
* SPDX-FileCopyrightText: 2025 Igor Brkic <igor@hyperglitch.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef JF_QSPI_H
#define JF_QSPI_H
#include <stdint.h>
#include <stdbool.h>
#include "cmsis_os.h"
#include "main.h"
typedef enum {
JF_CMD_NONE = 0x00,
JF_CMD_ADC_READ = 0x01,
JF_CMD_MEM_WRITE = 0x02,
JF_CMD_SET_RANGE = 0x04,
JF_CMD_LED_BLINK = 0x05,
JF_CMD_DAC_SET = 0x06
} jf_qspi_command_t;
typedef struct {
jf_qspi_command_t command;
uint32_t address;
uint8_t *buffer;
uint16_t size;
TaskHandle_t notify_task;
} jf_qspi_request_t;
void jf_qspi_init(QSPI_HandleTypeDef *hqspi);
bool jf_qspi_add_to_queue(jf_qspi_command_t command, uint32_t address, uint8_t *buffer, uint16_t size, bool blocking);
bool jf_qspi_add_to_queue_from_isr(jf_qspi_command_t command, uint32_t address, uint8_t *buffer, uint16_t size);
bool jf_qspi_direct_call(const jf_qspi_command_t command, const uint32_t address, uint8_t *buffer, const uint16_t size);
#endif //JF_QSPI_H