projekt z testami od ceedling. Dodatkowo skonfigurowany pugin do vscode do testowania. Dziala tez debug testow.

This commit is contained in:
2020-08-29 19:06:16 +02:00
commit 28153db8d1
13 changed files with 264 additions and 0 deletions

7
src/i2c.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef i2c_H
#define i2c_H
#include <stdint.h>
uint16_t i2c_readRegister(uint8_t registerAddress);
#endif // i2c_H

19
src/lights.c Normal file
View File

@@ -0,0 +1,19 @@
#include "lights.h"
#include <stdbool.h>
static bool areLightsOn = false;
void lights_SetHeadlightSwitchOff(void)
{
areLightsOn = false;
}
void lights_SetHeadlightSwitchOn(void)
{
areLightsOn = true;
}
bool lights_AreHeadlightsOn(void)
{
return areLightsOn;
}

10
src/lights.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef LIGHTS_H
#define LIGHTS_H
#include <stdbool.h>
void lights_SetHeadlightSwitchOff(void);
void lights_SetHeadlightSwitchOn(void);
bool lights_AreHeadlightsOn(void);
#endif // LIGHTS_H

9
src/tempSensor.c Normal file
View File

@@ -0,0 +1,9 @@
#include "tempSensor.h"
#include "i2c.h"
#include <stdint.h>
float tempSensor_getTemperature(void)
{
uint16_t rawValue = i2c_readRegister(0x03);
return -100.0f + (0.2f * (float)rawValue);
}

6
src/tempSensor.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef TEMPSENSOR_H
#define TEMPSENSOR_H
float tempSensor_getTemperature(void);
#endif // TEMPSENSOR_H