SatNOGS-COMMS
4.1.0
A COMMS subsystem for CubeSats
Toggle main menu visibility
Loading...
Searching...
No Matches
spi.hpp
Go to the documentation of this file.
1
/*
2
* SatNOGS-COMMS control library
3
*
4
* Copyright (C) 2022-2024, Libre Space Foundation <http://libre.space>
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*
19
* SPDX-License-Identifier: GNU General Public License v3.0 or later
20
*/
21
22
#pragma once
23
24
#include "
gpio.hpp
"
25
#include <cstddef>
26
#include <cstdint>
27
28
namespace
satnogs::comms::lib::bsp
29
{
40
class
spi
41
{
42
public
:
47
spi
() {}
48
~spi
() {}
49
58
virtual
void
59
read
(uint8_t *rx,
const
uint8_t *tx,
size_t
tx_len,
size_t
rx_len) = 0;
60
67
virtual
void
68
write
(
const
uint8_t *tx,
size_t
len) = 0;
69
78
virtual
gpio
&
79
cs
()
80
{
81
return
m_cs;
82
}
83
84
private
:
85
dummy_gpio
m_cs;
86
};
87
88
}
// namespace satnogs::comms::lib::bsp
satnogs::comms::lib::bsp::dummy_gpio
A dummy GPIO implementation with no effect. Can be used for CI testing or default construction of gpi...
Definition
gpio.hpp:119
satnogs::comms::lib::bsp::gpio
GPIO device abstraction.
Definition
gpio.hpp:38
satnogs::comms::lib::bsp::spi::cs
virtual gpio & cs()
Returns a GPIO control handle for the CS of the SPI. If this is performed automatically by the hardwa...
Definition
spi.hpp:79
satnogs::comms::lib::bsp::spi::spi
spi()
Construct a new SPI object.
Definition
spi.hpp:47
satnogs::comms::lib::bsp::spi::read
virtual void read(uint8_t *rx, const uint8_t *tx, size_t tx_len, size_t rx_len)=0
Performs an SPI read operation.
satnogs::comms::lib::bsp::spi::write
virtual void write(const uint8_t *tx, size_t len)=0
Performs an SPI write operation.
satnogs::comms::lib::bsp::spi::~spi
~spi()
Definition
spi.hpp:48
gpio.hpp
satnogs::comms::lib::bsp
Definition
adc.hpp:26
libsatnogs-comms
include
satnogs-comms-lib
bsp
spi.hpp
Generated by
1.17.0