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

Go to the source code of this file.

Classes

struct  PWMState

Functions

void initializeActuators ()
void processActuatorCommand (const std::vector< daq::ActuatorCommand > &commands)
void processPWMActuatorCommand (const std::vector< daq::PWMActuatorCommand > &commands)
void updatePWM ()
void readCurrentSensePins ()
void sendSensorDataPacket (const daq::SensorDataChunkCollection &chunk)
void setup ()
void loop ()

Variables

const unsigned long ADC_READ_INTERVAL_MS
byte mac [6]
IPAddress staticIP (192, 168, 2, 202)
IPAddress gateway (0, 0, 0, 0)
IPAddress subnet (255, 255, 255, 0)
IPAddress dns (192, 168, 2, 1)
const int udpPort = 5005
IPAddress receiverIP (192, 168, 2, 20)
const int receiverPort = 5006
EthernetUDP udp
uint8_t actuator_states [NUM_ACTUATORS]
PWMState pwm_states [NUM_ACTUATORS]
const uint8_t NUM_SENSORS = NUM_ACTUATORS
unsigned long lastAdcReadTime = 0

Function Documentation

◆ initializeActuators()

void initializeActuators ( )

◆ loop()

◆ processActuatorCommand()

void processActuatorCommand ( const std::vector< daq::ActuatorCommand > & commands)

◆ processPWMActuatorCommand()

void processPWMActuatorCommand ( const std::vector< daq::PWMActuatorCommand > & commands)

◆ readCurrentSensePins()

void readCurrentSensePins ( )

◆ sendSensorDataPacket()

void sendSensorDataPacket ( const daq::SensorDataChunkCollection & chunk)

◆ setup()

◆ updatePWM()

Variable Documentation

◆ actuator_states

uint8_t actuator_states[NUM_ACTUATORS]

Definition at line 31 of file main.cpp.

◆ ADC_READ_INTERVAL_MS

const unsigned long ADC_READ_INTERVAL_MS
Initial value:
=
1000

Definition at line 15 of file main.cpp.

◆ dns

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

◆ gateway

IPAddress gateway(0, 0, 0, 0) ( 0 ,
0 ,
0 ,
0  )

◆ lastAdcReadTime

unsigned long lastAdcReadTime = 0

Definition at line 45 of file main.cpp.

Referenced by loop().

◆ mac

byte mac[6]

Definition at line 19 of file main.cpp.

◆ NUM_SENSORS

const uint8_t NUM_SENSORS = NUM_ACTUATORS

Definition at line 44 of file main.cpp.

◆ pwm_states

◆ receiverIP

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

◆ receiverPort

const int receiverPort = 5006

◆ staticIP

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

◆ subnet

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

◆ udp

EthernetUDP udp

Definition at line 27 of file main.cpp.

◆ udpPort

const int udpPort = 5005

Definition at line 24 of file main.cpp.

Referenced by setup().