All checks were successful
continuous-integration/drone/push Build is passing
Init Serial with baudrate 115200
104 lines
3.2 KiB
C++
104 lines
3.2 KiB
C++
/**
|
|
* @file sys.cpp
|
|
* @author Pascal Lais (pascal_lais@gmx.de)
|
|
*
|
|
* @version 0.1
|
|
* @date 2020-08-02
|
|
*/
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Includes
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#include <Arduino.h>
|
|
#include <pins_arduino.h>
|
|
|
|
#include "opst.h"
|
|
#include "sys.h"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Defines
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#define OPST_PIN 2 //Either Pin 2 or Pin 3 can be used
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Datatypes
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Variables
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Function prototypes
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Function implementation
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void sysInit()
|
|
//-----------------------------------------------------------------------------
|
|
{
|
|
Serial.begin(115200);
|
|
pinMode(LED_BUILTIN, OUTPUT);
|
|
opstInit(OPST_PIN);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void sysLoop(uint32_t ts)
|
|
//-----------------------------------------------------------------------------
|
|
{
|
|
opstUpdate();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void sysLoop10ms(uint32_t ts)
|
|
//-----------------------------------------------------------------------------
|
|
{
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void sysLoop50ms(uint32_t ts)
|
|
//-----------------------------------------------------------------------------
|
|
{
|
|
digitalWrite(LED_BUILTIN, 1);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void sysLoop100ms(uint32_t ts)
|
|
//-----------------------------------------------------------------------------
|
|
{
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void sysLoop500ms(uint32_t ts)
|
|
//-----------------------------------------------------------------------------
|
|
{
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void sysLoop1000ms(uint32_t ts)
|
|
//-----------------------------------------------------------------------------
|
|
{
|
|
digitalWrite(LED_BUILTIN, 0);
|
|
if(opstFiFoOverrunDetected())
|
|
{
|
|
Serial.print("Overrun detected!\n");
|
|
}
|
|
Serial.print("Temp: ");
|
|
Serial.print(opstGetTemp());
|
|
Serial.print(", Pressure: ");
|
|
Serial.print(opstGetPressure());
|
|
Serial.print("\n");
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// EOF
|
|
//-----------------------------------------------------------------------------
|