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 "sense_board_pins.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

void sendReplyTo (IPAddress primaryIP)
void setup ()
void loop ()

Variables

byte mac [6]
 Multi-Board Comms Testing - SECONDARY.
IPAddress staticIP (192, 168, 2, 101)
IPAddress gateway (192, 168, 2, 1)
IPAddress subnet (255, 255, 255, 0)
IPAddress dns (192, 168, 2, 1)
const int localPort = 5006
const int primaryListenPort = 5005
EthernetUDP udp
uint8_t packetBuffer [MAX_PACKET_SIZE]
uint8_t replyBuffer [MAX_PACKET_SIZE]

Function Documentation

◆ loop()

void loop ( )

Definition at line 115 of file main.cpp.

References delay(), packetBuffer, sendReplyTo(), Serial, and udp.

◆ sendReplyTo()

void sendReplyTo ( IPAddress primaryIP)

Definition at line 43 of file main.cpp.

References ack, chunk, chunks, daq::create_sensor_data_packet(), millis(), primaryListenPort, replyBuffer, Serial, and udp.

Referenced by loop().

◆ setup()

void setup ( void )

Variable Documentation

◆ dns

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

◆ gateway

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

◆ localPort

const int localPort = 5006

Definition at line 33 of file main.cpp.

◆ mac

byte mac[6]

Multi-Board Comms Testing - SECONDARY.

Listens on port 5006 for SENSOR_DATA (or any) packets from the primary. On receive: sends a reply SENSOR_DATA packet back to the primary at remoteIP():5005.

Uses: Arduino Ethernet, EthernetUDP, DAQv2-Comms (sensor packet format).

Definition at line 27 of file main.cpp.

◆ packetBuffer

uint8_t packetBuffer[MAX_PACKET_SIZE]

Definition at line 37 of file main.cpp.

◆ primaryListenPort

const int primaryListenPort = 5005

Definition at line 34 of file main.cpp.

Referenced by sendReplyTo().

◆ replyBuffer

uint8_t replyBuffer[MAX_PACKET_SIZE]

Definition at line 38 of file main.cpp.

Referenced by sendReplyTo().

◆ 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 36 of file main.cpp.