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

Go to the source code of this file.

Macros

#define ETH_CLK_PIN   39
#define ETH_MISO_PIN   41
#define ETH_MOSI_PIN   40
#define ETH_CS_PIN   38

Functions

void setup ()
void printBoardInfo ()
 Prints all board networking information to Serial.
void printRawPacketData (const uint8_t *buffer, size_t size)
 Prints raw packet data in hex format for debugging.
void printPacketHeader (const daq::PacketHeader &header)
 Prints packet header information.
void printBoardHeartbeat (const daq::PacketHeader &header, const daq::BoardHeartbeatPacket &data)
 Prints Board Heartbeat packet information.
void printServerHeartbeat (const daq::PacketHeader &header, const daq::ServerHeartbeatPacket &data)
 Prints Server Heartbeat packet information.
void decodeAndPrintPacket (const uint8_t *buffer, size_t size)
 Attempts to decode and print packet information.
void loop ()

Variables

IPAddress staticIP (192, 168, 2, 101)
IPAddress gateway (192, 168, 2, 1)
IPAddress subnet (255, 255, 255, 0)
IPAddress dns (192, 168, 2, 1)
unsigned int localPort = 5006
uint8_t packetBuffer [MAX_PACKET_SIZE]
EthernetUDP udp
byte mac [] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE}

Macro Definition Documentation

◆ ETH_CLK_PIN

#define ETH_CLK_PIN   39

Definition at line 8 of file main.cpp.

Referenced by setup().

◆ ETH_CS_PIN

#define ETH_CS_PIN   38

Definition at line 11 of file main.cpp.

Referenced by setup().

◆ ETH_MISO_PIN

#define ETH_MISO_PIN   41

Definition at line 9 of file main.cpp.

Referenced by setup().

◆ ETH_MOSI_PIN

#define ETH_MOSI_PIN   40

Definition at line 10 of file main.cpp.

Referenced by setup().

Function Documentation

◆ decodeAndPrintPacket()

void decodeAndPrintPacket ( const uint8_t * buffer,
size_t size )

◆ loop()

void loop ( )

Definition at line 460 of file main.cpp.

References decodeAndPrintPacket(), delay(), MAX_PACKET_SIZE, packetBuffer, Serial, and udp.

◆ printBoardHeartbeat()

void printBoardHeartbeat ( const daq::PacketHeader & header,
const daq::BoardHeartbeatPacket & data )

◆ printBoardInfo()

void printBoardInfo ( )

Prints all board networking information to Serial.

Definition at line 62 of file main.cpp.

References dns, Ethernet, gateway, HEX, localPort, mac, Serial, and subnet.

Referenced by processCLI(), and setup().

◆ printPacketHeader()

void printPacketHeader ( const daq::PacketHeader & header)

◆ printRawPacketData()

void printRawPacketData ( const uint8_t * buffer,
size_t size )

Prints raw packet data in hex format for debugging.

Definition at line 110 of file main.cpp.

References HEX, and Serial.

Referenced by decodeAndPrintPacket().

◆ printServerHeartbeat()

void printServerHeartbeat ( const daq::PacketHeader & header,
const daq::ServerHeartbeatPacket & data )

Prints Server Heartbeat packet information.

Definition at line 259 of file main.cpp.

References daq::FIRING, daq::LOX_FILL, daq::POST_FIRE, daq::PRESSURIZING, printPacketHeader(), daq::SAFE, and Serial.

Referenced by decodeAndPrintPacket().

◆ 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

unsigned int localPort = 5006

Definition at line 18 of file main.cpp.

◆ mac

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE}

Definition at line 23 of file main.cpp.

◆ packetBuffer

uint8_t packetBuffer[MAX_PACKET_SIZE]

Definition at line 19 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 21 of file main.cpp.