19#include "../config/LinxConfig.h"
58#define EOF_RESTART_NOSTOP 2
76#define NVS_USERID 0x00
77#define NVS_ETHERNET_IP 0x02
78#define NVS_ETHERNET_PORT 0x06
79#define NVS_WIFI_IP 0x08
80#define NVS_WIFI_PORT 0x0C
81#define NVS_WIFI_SSID_SIZE 0x0E
82#define NVS_WIFI_SSID 0x0F
83#define NVS_WIFI_SECURITY_TYPE 0x30
84#define NVS_WIFI_PW_SIZE 0x31
85#define NVS_WIFI_PW 0x32
86#define NVS_SERIAL_INTERFACE_MAX_BAUD 0x72
98typedef enum LinxStatus
101 L_FUNCTION_NOT_SUPPORTED,
107typedef enum AioStatus
109 LANALOG_REF_MODE_ERROR=129,
110 LANALOG_REF_VAL_ERROR=130
113typedef enum DioStatus
115 LDIGITAL_PIN_DNE=128,
119typedef enum SPIStatus
121 LSPI_OPEN_FAIL = 128,
125typedef enum I2CStatus
135typedef enum UartStatus
139 LUART_AVAILABLE_FAIL,
149typedef enum ResetWhat
170 unsigned char DeviceFamily;
171 unsigned char DeviceId;
172 unsigned char DeviceNameLen;
173 const unsigned char* DeviceName;
174 unsigned char ListenerBufferSize;
180 unsigned char LinxApiMajor;
181 unsigned char LinxApiMinor;
182 unsigned char LinxApiSubminor;
189 unsigned char NumDigitalChans;
190 const unsigned char* DigitalChans;
195 unsigned char NumAiChans;
196 const unsigned char* AiChans;
197 unsigned char AiResolution;
198 unsigned long AiRefDefault;
199 unsigned long AiRefSet;
201 unsigned char NumAoChans;
202 const unsigned char* AoChans;
203 unsigned char AoResolution;
204 unsigned long AoRefDefault;
205 unsigned long AoRefSet;
211 unsigned char NumPwmChans;
212 const unsigned char* PwmChans;
218 unsigned char NumQeChans;
219 const unsigned char* QeChans;
225 unsigned char NumUartChans;
226 const unsigned char* UartChans;
227 unsigned long UartMaxBaud;
233 unsigned char NumI2cChans;
234 const unsigned char* I2cChans;
240 unsigned char NumSpiChans;
241 const unsigned char* SpiChans;
247 unsigned char NumCanChans;
248 const unsigned char* CanChans;
254 unsigned char NumServoChans;
255 const unsigned char* ServoChans;
260 unsigned short userId;
262 unsigned long ethernetIp;
263 unsigned short ethernetPort;
266 unsigned long WifiIp;
267 unsigned short WifiPort;
268 unsigned char WifiSsidSize;
270 unsigned char WifiSecurity;
271 unsigned char WifiPwSize;
276 unsigned long serialInterfaceMaxBaud;
281 ResetWhat ResetTarget=LRESET_NONE;
282 unsigned char WifiStatus=0xFF;
297 virtual int AnalogRead(
unsigned char numChans,
unsigned char* channels,
unsigned char* values) = 0;
298 virtual int AnalogReadNoPacking(
unsigned char numChans,
unsigned char* channels,
unsigned long* values);
299 virtual int AnalogSetRef(
unsigned char mode,
unsigned long voltage) = 0;
301 virtual int AnalogWrite(
unsigned char numChans,
unsigned char* channels,
unsigned char* values) = 0;
302 virtual int AnalogWriteNoPacking(
unsigned char numChans,
unsigned char* channels,
unsigned long* values);
307 virtual int DigitalWrite(
unsigned char numChans,
unsigned char* channels,
unsigned char* values) = 0;
308 virtual int DigitalWriteNoPacking(
unsigned char numChans,
unsigned char* channels,
unsigned char* values);
309 virtual int DigitalRead(
unsigned char numChans,
unsigned char* channels,
unsigned char* values) = 0;
310 virtual int DigitalReadNoPacking(
unsigned char numChans,
unsigned char* channels,
unsigned char* values);
311 virtual int DigitalWriteSquareWave(
unsigned char channel,
unsigned long freq,
unsigned long duration) = 0;
312 virtual int DigitalReadPulseWidth(
unsigned char stimChan,
unsigned char stimType,
unsigned char respChan,
unsigned char respType,
unsigned long timeout,
unsigned long* width) = 0;
317 virtual int PwmSetDutyCycle(
unsigned char numChans,
unsigned char* channels,
unsigned char* values) = 0;
318 virtual int PwmSetFrequency(
unsigned char numChans,
unsigned char* channels,
unsigned long* values);
323 virtual int SpiOpenMaster(
unsigned char channel) = 0;
324 virtual int SpiSetBitOrder(
unsigned char channel,
unsigned char bitOrder) = 0;
325 virtual int SpiSetMode(
unsigned char channel,
unsigned char mode) = 0;
326 virtual int SpiSetSpeed(
unsigned char channel,
unsigned long speed,
unsigned long* actualSpeed) = 0;
327 virtual int SpiWriteRead(
unsigned char channel,
unsigned char frameSize,
unsigned char numFrames,
unsigned char csChan,
unsigned char csLL,
unsigned char* sendBuffer,
unsigned char* recBuffer) = 0;
332 virtual int I2cOpenMaster(
unsigned char channel) = 0;
333 virtual int I2cSetSpeed(
unsigned char channel,
unsigned long speed,
unsigned long* actualSpeed) = 0;
334 virtual int I2cWrite(
unsigned char channel,
unsigned char slaveAddress,
unsigned char eofConfig,
unsigned char numBytes,
unsigned char* sendBuffer) = 0;
335 virtual int I2cRead(
unsigned char channel,
unsigned char slaveAddress,
unsigned char eofConfig,
unsigned char numBytes,
unsigned int timeout,
unsigned char* recBuffer) = 0;
336 virtual int I2cClose(
unsigned char channel) = 0;
341 virtual int UartOpen(
unsigned char channel,
unsigned long baudRate,
unsigned long* actualBaud) = 0;
342 virtual int UartSetBaudRate(
unsigned char channel,
unsigned long baudRate,
unsigned long* actualBaud) = 0;
343 virtual int UartGetBytesAvailable(
unsigned char channel,
unsigned char *numBytes) = 0;
344 virtual int UartRead(
unsigned char channel,
unsigned char numBytes,
unsigned char* recBuffer,
unsigned char* numBytesRead) = 0;
345 virtual int UartWrite(
unsigned char channel,
unsigned char numBytes,
unsigned char* sendBuffer) = 0;
346 virtual void UartWrite(
unsigned char channel,
char c);
347 virtual void UartWrite(
unsigned char channel,
const char s[]);
348 virtual void UartWrite(
unsigned char channel,
unsigned char c);
349 virtual void UartWrite(
unsigned char channel,
int n);
350 virtual void UartWrite(
unsigned char channel,
unsigned int n);
351 virtual void UartWrite(
unsigned char channel,
long n);
352 virtual void UartWrite(
unsigned char channel,
unsigned long n);
353 virtual void UartWrite(
unsigned char channel,
long n,
int base);
354 virtual void UartWriteln(
unsigned char channel);
355 virtual void UartWriteln(
unsigned char channel,
char c);
356 virtual void UartWriteln(
unsigned char channel,
const char s[]);
357 virtual void UartWriteln(
unsigned char channel,
unsigned char c);
358 virtual void UartWriteln(
unsigned char channel,
int n);
359 virtual void UartWriteln(
unsigned char channel,
long n);
360 virtual void UartWriteln(
unsigned char channel,
unsigned long n);
361 virtual void UartWriteln(
unsigned char channel,
long n,
int base);
362 virtual int UartClose(
unsigned char channel) = 0;
367 virtual int ServoOpen(
unsigned char numChans,
unsigned char* channels) = 0;
368 virtual int ServoSetPulseWidth(
unsigned char numChans,
unsigned char* channels,
unsigned short* pulseWidths) = 0;
369 virtual int ServoClose(
unsigned char numChans,
unsigned char* channels) = 0;
374 virtual int Ws2812Open(
unsigned short numLeds,
unsigned char dataChan);
375 virtual int Ws2812WriteOnePixel(
unsigned short pixelIndex,
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char refresh);
376 virtual int Ws2812WriteNPixels(
unsigned short startPixel,
unsigned short numPixels,
unsigned char* data,
unsigned char refresh);
377 virtual int Ws2812Refresh();
378 virtual int Ws2812Close();
383 unsigned char ReverseBits(
unsigned char b);
384 virtual unsigned long GetMilliSeconds() = 0;
385 virtual unsigned long GetSeconds() = 0;
386 virtual void DelayMs(
unsigned long ms);
387 virtual void NonVolatileWrite(
int address,
unsigned char data) = 0;
388 virtual unsigned char NonVolatileRead(
int address) = 0;
393 virtual void EnableDebug(
unsigned char channel);
395 virtual void DebugPrint(
char c);
396 virtual void DebugPrint(
const char s[]);
397 virtual void DebugPrint(
unsigned char c);
398 virtual void DebugPrint(
int n);
399 virtual void DebugPrint(
unsigned int n);
400 virtual void DebugPrint(
long n);
401 virtual void DebugPrint(
unsigned long n);
402 virtual void DebugPrint(
long n,
int base);
404 virtual void DebugPrintln();
405 virtual void DebugPrintln(
char c);
406 virtual void DebugPrintln(
const char s[]);
407 virtual void DebugPrintln(
unsigned char c);
408 virtual void DebugPrintln(
int n);
409 virtual void DebugPrintln(
long n);
410 virtual void DebugPrintln(
unsigned long n);
411 virtual void DebugPrintln(
long n,
int base);
413 virtual void DebugPrintPacket(
unsigned char direction,
const unsigned char* packetBuffer);
418 virtual int BoardCommands(
unsigned char command,
unsigned char numInputBytes,
unsigned char* input,
unsigned char* numResponseBytes,
unsigned char* response);
419 virtual int Reset(ResetWhat target);
427 virtual void UartWriteNumber(
unsigned char channel,
unsigned long n,
unsigned char bases);
Base class for board functionality; extended by family and board-specific code.
Definition: device/utility/LinxDevice.h:163