/*

    this was set up in stm32cubeIde
    can be checked in main.c

    SPI config
    Full duplex, 2-line
    8 bits
    MSB first
    (CPOL = 0), (CPHA = 0), Mode 0 (somehting to do with how a high is read in as a high, etc)
        // https://www.youtube.com/watch?v=eFKeNPJq50g&list=LL&index=1&t=814s
    Baud prescaler = 16, its slow atm could speed this up
    NSS pulse         : Disabled, we constorl with normal GPIO

    GPIO-directions
        LoRa_NSS     Push-pull output, no pull       MCU             Active-low SPI CS
        LoRa_RESET   Push-pull output, no pull       MCU             Active-low reset
        LoRa_busy    Input, no pull                  SX1262          Command-busy status
        LoRa_DIO1    Rising-edge interrupt, no pull  SX1262          Radio IRQ line
        // i dont think i need this LoRa_RF_SW   Push-pull output, no pull       MCU             Module RF-switch input

    GPIO speeds (my best guess)
        LoRa_NSS   : HIGH speed, because it toggles around every SPI transaction.
        LoRa_RESET : LOW speed, because reset transitions are infrequent.
        LoRa_RF_SW : LOW speed, because RF mode-control transitions are infrequent.
 */


#ifndef SX126X_HAL_STM32_H
#define SX126X_HAL_STM32_H

#include "main.h"
#include "sx126x_hal.h"

typedef struct
{
    SPI_HandleTypeDef *spi;

    GPIO_TypeDef *nss_port;
    uint16_t nss_pin;

    GPIO_TypeDef *reset_port;
    uint16_t reset_pin;

    GPIO_TypeDef *busy_port;
    uint16_t busy_pin;
} sx126x_stm32_context_t;

#endif