![]() |
SCAMP-5c SPI Interface
1.0.0
SCAMP-5c is connected to the flight computer via a SPI interface
|
the object-oriented interface of the spi bus More...
#include <scamp5c_spi.hpp>
Data Structures | |
class | packet |
the SPI packet class More... | |
Public Member Functions | |
int | OpenSPI (const char *dev_path, uint32_t d_clk=2500000) |
open the spi interface More... | |
int | CloseSPI (void) |
close the spi interface | |
int | StartThreads () |
start running the internal functions in different threads More... | |
int | EndThreads () |
stop the interface and close all threads created in the background More... | |
void | SetTransferSize (uint32_t s) |
change the transfer size More... | |
uint32_t | GetTransferSize () |
void | ResetAllCounters () |
uint32_t | GetTriggerCounter () |
uint32_t | GetTxSwapCounter () |
uint32_t | GetTransferCounter () |
uint32_t | GetSignatureCounter () |
uint32_t | GetHeaderCounter () |
uint32_t | GetPacketCounter () |
size_t | GetPacketQueueLength () |
get the number of packet in the packet queue | |
packet * | PopPacketFromQueue () |
get a packet from the queue as the packet is removed from queue | |
void | DeletePacket (packet *p) |
delete a packet taken from the packet queue | |
void | OpenTxBuffer () |
gain access to the transmit buffer | |
uint8_t * | GetTxBuffer () |
get the pointer to the transmit buffer thus modify the content in it | |
void | CloseTxBuffer () |
release access to the transmit buffer | |
Protected Attributes | |
int | dev_file |
uint8_t | mode |
uint8_t | bits |
uint32_t | clock |
std::thread * | th_transfer |
std::thread * | th_packet |
std::mutex | section_transfer |
std::mutex | section_tx_buffer |
std::mutex | section_packet_queue |
std::atomic< bool > | control_quit |
volatile uint32_t | trigger_counter |
volatile uint32_t | transfer_counter |
volatile uint32_t | tx_swap_counter |
volatile uint32_t | signature_counter |
volatile uint32_t | header_counter |
volatile uint32_t | packet_counter |
std::list< packet * > | packet_queue |
the object-oriented interface of the spi bus
int scamp5c_spi::OpenSPI | ( | const char * | dev_path, |
uint32_t | d_clk = 2500000 |
||
) |
open the spi interface
dev_path | the file device path of the spidev |
d_clk | the data clock frequency of the spi bus |
int scamp5c_spi::StartThreads | ( | ) |
start running the internal functions in different threads
This function starts the whole mechanism.
int scamp5c_spi::EndThreads | ( | ) |
stop the interface and close all threads created in the background
This function stops the whole mechanism.
|
inline |
change the transfer size
The transfer size can be changed from both the host and the SCAMP, so the transfer size may not always be the one set using this function.