STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
main.cpp File Reference
#include <Arduino.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <daq-protocol.h>
#include <esp_mac.h>
#include <cstring>
#include <vector>
#include "STAR_ADS126X.h"
#include "adc_mappings.h"
#include "connector_adc_map.h"
#include "sense_board_pins.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Macros

#define PINS_ACTIVE_LAYOUT   sense_board_pins::PT_Board
 PT_BOARD_Multi_Send.
#define FILTER   ADS126X_SINC4
#define DATA_RATE   ADS126X_RATE_7200
#define TEST_PIN   1
#define NUM_PTS   10

Functions

SPIClass ADC_SPI (HSPI)
float convert_code_to_voltage (int32_t code)
void flush_cycles (int n)
bool read_one (int32_t &out_raw, float &out_volts)
void setup ()
void loop ()

Variables

static ADS126X ads126x
byte mac [6]
IPAddress staticIP (192, 168, 2, 101)
IPAddress gateway (192, 168, 2, 1)
IPAddress subnet (255, 255, 255, 0)
IPAddress dns (192, 168, 2, 1)
IPAddress receiverIP (192, 168, 2, 20)
const int receiverPort
EthernetUDP udp
uint8_t packetBuffer [MAX_PACKET_SIZE]

Macro Definition Documentation

◆ DATA_RATE

#define DATA_RATE   ADS126X_RATE_7200

Definition at line 34 of file main.cpp.

◆ FILTER

#define FILTER   ADS126X_SINC4

Definition at line 33 of file main.cpp.

◆ NUM_PTS

#define NUM_PTS   10

Definition at line 36 of file main.cpp.

Referenced by loop(), read_data(), and sendSensorDataPacketTo().

◆ PINS_ACTIVE_LAYOUT

#define PINS_ACTIVE_LAYOUT   sense_board_pins::PT_Board

PT_BOARD_Multi_Send.

Cycles through each PT (connectors 1–10), takes one measurement per PT, and sends DAQv2-Comms SENSOR_DATA packets over Ethernet to a Python GUI.

Loosely based on mini_daq/Simple_Test_Adnan (ADC, mux cycling, settle). Uses DAQv2-Comms for packet format and Ethernet/UDP for transport.

Definition at line 26 of file main.cpp.

◆ TEST_PIN

#define TEST_PIN   1

Definition at line 35 of file main.cpp.

Function Documentation

◆ ADC_SPI()

SPIClass ADC_SPI ( HSPI )

References HSPI.

◆ convert_code_to_voltage()

float convert_code_to_voltage ( int32_t code)

Definition at line 61 of file main.cpp.

Referenced by read_one().

◆ flush_cycles()

void flush_cycles ( int n)

Definition at line 65 of file main.cpp.

References ads126x, delayMicroseconds(), digitalRead(), LOW, and sense_board_pins::Pins.

Referenced by loop().

◆ loop()

◆ read_one()

bool read_one ( int32_t & out_raw,
float & out_volts )

Definition at line 74 of file main.cpp.

References ads126x, convert_code_to_voltage(), delayMicroseconds(), digitalRead(), LOW, sense_board_pins::Pins, and r.

Referenced by loop().

◆ setup()

Variable Documentation

◆ ads126x

ADS126X ads126x
static

Definition at line 38 of file main.cpp.

◆ dns

IPAddress dns(192, 168, 2, 1) ( 192 ,
168 ,
2 ,
1  )

◆ gateway

IPAddress gateway(192, 168, 2, 1) ( 192 ,
168 ,
2 ,
1  )

◆ mac

byte mac[6]

Definition at line 44 of file main.cpp.

◆ packetBuffer

uint8_t packetBuffer[MAX_PACKET_SIZE]

Definition at line 56 of file main.cpp.

◆ receiverIP

IPAddress receiverIP(192, 168, 2, 20) ( 192 ,
168 ,
2 ,
20  )

◆ receiverPort

const int receiverPort
Initial value:
=
5007

Definition at line 53 of file main.cpp.

◆ staticIP

IPAddress staticIP(192, 168, 2, 101) ( 192 ,
168 ,
2 ,
101  )

◆ subnet

IPAddress subnet(255, 255, 255, 0) ( 255 ,
255 ,
255 ,
0  )

◆ udp

EthernetUDP udp

Definition at line 55 of file main.cpp.