forked from NachiketKelkar/AESD-Project_1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbist.c
More file actions
36 lines (32 loc) · 1.03 KB
/
bist.c
File metadata and controls
36 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/************************************************************************************************
* File name : bist.c *
* Authors : Puneet Bansal and Nachiket Kelkar *
* Description : The function definition used for built in self test. *
* Tools used : GNU make, gcc, arm-linux-gcc *
************************************************************************************************/
#include "bist.h"
#include <stdio.h>
#include "temp_i2c.h"
int lightSensorBIST(int fileDesc)
{
uint8_t* rb= malloc(6);
rb=lightSensorRead(fileDesc,IDREG,1);
if(rb == NULL)
{
return -1;
}
if(*rb!=0x50)
{
return -1;
}
return 0;
}
int tempSensorBIST(int fileDesc)
{
uint16_t retVal=temp_i2c_read_from_reg(fileDesc, CONFIG_REG_ADDR);
if(retVal == 10000)
return -1;
if(retVal!=DEFAULT_CONFIG)
return -1;
return 0;
}