projekt z testami od ceedling. Dodatkowo skonfigurowany pugin do vscode do testowania. Dziala tez debug testow.
This commit is contained in:
7
src/i2c.h
Normal file
7
src/i2c.h
Normal 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
19
src/lights.c
Normal 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
10
src/lights.h
Normal 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
9
src/tempSensor.c
Normal 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
6
src/tempSensor.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef TEMPSENSOR_H
|
||||
#define TEMPSENSOR_H
|
||||
|
||||
float tempSensor_getTemperature(void);
|
||||
|
||||
#endif // TEMPSENSOR_H
|
||||
Reference in New Issue
Block a user