Initial commit
This commit is contained in:
103
src/sys.cpp
Normal file
103
src/sys.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @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(9600);
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user