skl-tunnel/radio/include/radio_hw_instance.hpp

39 lines
774 B
C++

//
// Created by erki on 4.06.22.
//
#ifndef SKL_TUNNEL_RADIO_HW_INSTANCE_HPP
#define SKL_TUNNEL_RADIO_HW_INSTANCE_HPP
#include <hal_spi_m_sync.h>
#include "radio_hw_registers.hpp"
namespace radio
{
struct HwInstance
{
static HwInstance* instance();
HwInstance();
HwInstance(const HwInstance&) = delete;
HwInstance(HwInstance&&) = delete;
HwInstance& operator=(const HwInstance&) = delete;
HwInstance& operator=(HwInstance&&) = delete;
void irq_handler();
uint8_t register_read(const Registers& address);
void register_write(const Registers& address, const uint8_t value);
private:
spi_m_sync_descriptor* m_spi = nullptr;
io_descriptor* m_spi_io = nullptr;
void m_wait_transition_complete();
};
}
#endif //SKL_TUNNEL_RADIO_HW_INSTANCE_HPP