h2_leaksensor_code/include/spi_manager.h
2026-07-24 16:39:26 +02:00

26 lines
753 B
C

#ifndef SPI_MANAGER_H
#define SPI_MANAGER_H
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "config.h"
// =====================================================
// SPI MANAGER — SPI0 DEFAULT MUX, MCP251863 link
// =====================================================
// PA1=MOSI | PA2=MISO | PA3=SCK | PA4=CS (software)
// Mode 0,0 — MSB first — up to 4 MHz
// =====================================================
void SPI_Init(void);
void SPI_CS_Assert(void);
void SPI_CS_Deassert(void);
uint8_t SPI_TransferByte(uint8_t txByte);
void SPI_TransferBuffer(const uint8_t *txBuf, uint8_t *rxBuf, uint16_t len);
void SPI_Write(const uint8_t *data, uint16_t len);
void SPI_Read(uint8_t *buf, uint16_t len);
#endif // SPI_MANAGER_H