lolxnano
Code to control the LoLX SiPM biasing board from the connected nanoPi
Loading...
Searching...
No Matches
NanoPi Class Reference

Class to control GPIO and SPI communication from a nanoPi Neo2. More...

#include <nanopi.h>

Public Member Functions

bool InitGPIO ()
 Initialize GPIO communication for LoLX-specific pins.
 
bool InitSPI ()
 Initialize SPI communication, not specific to LoLX.
 
void AddrOff ()
 Set the SPI channel select encoder to zero, i.e. select no SPI device.
 
void SetAddr (short addr)
 Select SPI device via the SPI channel select encoder.
 
bool HasSPI ()
 Check whether SPI was correctly initialized.
 
bool HasGPIO ()
 Check whether GPIO was correctly initialized.
 
void SendWord (short cselect, unsigned char *buf, uint8_t nbytes)
 Send data word via SPI.
 
uint8_t Exch8 (short cselect, uint8_t data)
 Exchange 1 byte.
 
uint16_t Exch16 (short cselect, uint16_t data)
 Exchange 2 bytes.
 
uint32_t Exch24 (short cselect, uint32_t data)
 Exchange 3 bytes.
 
uint32_t Exch32 (short cselect, uint32_t data)
 Exchange 4 bytes.
 
void ResetAll ()
 Set reset pin on all SPI devices.
 
void ResetHV ()
 Set reset pin on HV ADC and DAC.
 
void EnableQP (bool on=true)
 Enable/disable charge pump.
 
void StartADC ()
 Set ADC start pin HIGH.
 
void StopADC ()
 Set ADC start pin LOW.
 

Static Public Member Functions

static uint32_t SpiConvert (const uint32_t &input, unsigned short nbytes=4)
 Shuffle bytes around for correct SPI order and back.
 

Detailed Description

Class to control GPIO and SPI communication from a nanoPi Neo2.

Contains the communication routines for GPIO and SPI communication, including some specific to the LoLX SiPM biasing board

Member Function Documentation

◆ SendWord()

void NanoPi::SendWord ( short cselect,
unsigned char * buf,
uint8_t nbytes )

Send data word via SPI.

Parameters
cselectchannel select for target device (via encoder or separate pins)
bufcorrectly formatted data word, e.g. output of SpiConvert()
nbyteslength of data word in bytes
Here is the call graph for this function:

The documentation for this class was generated from the following files: