|
@@ -10,6 +10,7 @@
|
|
#include "hal_interface_api.h"
|
|
#include "hal_interface_api.h"
|
|
#include "linux/fcntl.h"
|
|
#include "linux/fcntl.h"
|
|
|
|
|
|
|
|
+static uint8_t i = 0;
|
|
/*
|
|
/*
|
|
* sensor number: 1
|
|
* sensor number: 1
|
|
* sensor name: +12V
|
|
* sensor name: +12V
|
|
@@ -27,14 +28,14 @@ int sensor_1_write(void)
|
|
|
|
|
|
int sensor_1_read(uint8_t *reading)
|
|
int sensor_1_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint8_t buf = 5;
|
|
|
|
|
|
+ //uint8_t buf = 5;
|
|
// int fd = open("/dev/i2c3", O_RDWR);
|
|
// int fd = open("/dev/i2c3", O_RDWR);
|
|
// stm32_i2c_master_write(fd, 0xAA, &buf, 1);
|
|
// stm32_i2c_master_write(fd, 0xAA, &buf, 1);
|
|
// stm32_i2c_master_read(fd, 0xAA, &buf, 1);
|
|
// stm32_i2c_master_read(fd, 0xAA, &buf, 1);
|
|
// close(fd);
|
|
// close(fd);
|
|
//printf("read sensor 1: %#x!\n", buf);
|
|
//printf("read sensor 1: %#x!\n", buf);
|
|
//*reading = buf;
|
|
//*reading = buf;
|
|
- *reading = 0xff;
|
|
|
|
|
|
+ *reading = i++;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -57,13 +58,13 @@ int sensor_2_write(void)
|
|
|
|
|
|
int sensor_2_read(uint8_t *reading)
|
|
int sensor_2_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint8_t buf = 4;
|
|
|
|
|
|
+// uint8_t buf = 4;
|
|
// int fd = open("/dev/i2c3", O_RDWR);
|
|
// int fd = open("/dev/i2c3", O_RDWR);
|
|
// stm32_i2c_master_write(fd, 0xAA, &buf, 1);
|
|
// stm32_i2c_master_write(fd, 0xAA, &buf, 1);
|
|
// stm32_i2c_master_read(fd, 0xAA, &buf, 1);
|
|
// stm32_i2c_master_read(fd, 0xAA, &buf, 1);
|
|
// close(fd);
|
|
// close(fd);
|
|
//*reading = buf;
|
|
//*reading = buf;
|
|
- *reading = 0xe0;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -86,13 +87,13 @@ int sensor_3_write(void)
|
|
|
|
|
|
int sensor_3_read(uint8_t *reading)
|
|
int sensor_3_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint8_t buf = 0;
|
|
|
|
|
|
+// uint8_t buf = 0;
|
|
// int fd = open("/dev/i2c3", O_RDWR);
|
|
// int fd = open("/dev/i2c3", O_RDWR);
|
|
// stm32_i2c_master_write(fd, 0x98, &buf, 1);
|
|
// stm32_i2c_master_write(fd, 0x98, &buf, 1);
|
|
// stm32_i2c_master_read(fd, 0x98, &buf, 1);
|
|
// stm32_i2c_master_read(fd, 0x98, &buf, 1);
|
|
// close(fd);
|
|
// close(fd);
|
|
//*reading = buf;
|
|
//*reading = buf;
|
|
- *reading = 0x80;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -116,13 +117,13 @@ int sensor_4_write(void)
|
|
|
|
|
|
int sensor_4_read(uint8_t *reading)
|
|
int sensor_4_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint8_t buf = 1;
|
|
|
|
|
|
+// uint8_t buf = 1;
|
|
// int fd = open("/dev/i2c3", O_RDWR);
|
|
// int fd = open("/dev/i2c3", O_RDWR);
|
|
// stm32_i2c_master_write(fd, 0x98, &buf, 1);
|
|
// stm32_i2c_master_write(fd, 0x98, &buf, 1);
|
|
// stm32_i2c_master_read(fd, 0x98, &buf, 1);
|
|
// stm32_i2c_master_read(fd, 0x98, &buf, 1);
|
|
// close(fd);
|
|
// close(fd);
|
|
//*reading = buf;
|
|
//*reading = buf;
|
|
- *reading = 0x8a;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -143,10 +144,10 @@ int sensor_5_write(void)
|
|
|
|
|
|
int sensor_5_read(uint8_t *reading)
|
|
int sensor_5_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint16_t buf;
|
|
|
|
|
|
+// uint16_t buf;
|
|
// stm32_adc_get_value(1, &buf);
|
|
// stm32_adc_get_value(1, &buf);
|
|
//*reading = buf>>4;
|
|
//*reading = buf>>4;
|
|
- *reading = 0x50;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -167,10 +168,10 @@ int sensor_6_write(void)
|
|
|
|
|
|
int sensor_6_read(uint8_t *reading)
|
|
int sensor_6_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint16_t buf;
|
|
|
|
|
|
+// uint16_t buf;
|
|
// stm32_adc_get_value(2, &buf);
|
|
// stm32_adc_get_value(2, &buf);
|
|
//*reading = buf>>4;
|
|
//*reading = buf>>4;
|
|
- *reading = 0x60;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -191,10 +192,10 @@ int sensor_7_write(void)
|
|
|
|
|
|
int sensor_7_read(uint8_t *reading)
|
|
int sensor_7_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint16_t buf;
|
|
|
|
|
|
+// uint16_t buf;
|
|
// stm32_adc_get_value(3, &buf);
|
|
// stm32_adc_get_value(3, &buf);
|
|
//*reading = buf>>4;
|
|
//*reading = buf>>4;
|
|
- *reading = 0x70;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -215,10 +216,10 @@ int sensor_8_write(void)
|
|
|
|
|
|
int sensor_8_read(uint8_t *reading)
|
|
int sensor_8_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint16_t buf;
|
|
|
|
|
|
+// uint16_t buf;
|
|
// stm32_adc_get_value(4, &buf);
|
|
// stm32_adc_get_value(4, &buf);
|
|
//*reading = buf>>4;
|
|
//*reading = buf>>4;
|
|
- *reading = 0x80;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -239,10 +240,10 @@ int sensor_9_write(void)
|
|
|
|
|
|
int sensor_9_read(uint8_t *reading)
|
|
int sensor_9_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint16_t buf;
|
|
|
|
|
|
+// uint16_t buf;
|
|
// stm32_adc_get_value(5, &buf);
|
|
// stm32_adc_get_value(5, &buf);
|
|
//*reading = buf>>4;
|
|
//*reading = buf>>4;
|
|
- *reading = 0x90;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -263,10 +264,10 @@ int sensor_10_write(void)
|
|
|
|
|
|
int sensor_10_read(uint8_t *reading)
|
|
int sensor_10_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint16_t buf;
|
|
|
|
|
|
+// uint16_t buf;
|
|
// stm32_adc_get_value(6, &buf);
|
|
// stm32_adc_get_value(6, &buf);
|
|
//*reading = buf>>4;
|
|
//*reading = buf>>4;
|
|
- *reading = 0xA0;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -287,10 +288,10 @@ int sensor_11_write(void)
|
|
|
|
|
|
int sensor_11_read(uint8_t *reading)
|
|
int sensor_11_read(uint8_t *reading)
|
|
{
|
|
{
|
|
- uint16_t buf;
|
|
|
|
|
|
+// uint16_t buf;
|
|
// stm32_adc_get_value(7, &buf);
|
|
// stm32_adc_get_value(7, &buf);
|
|
//*reading = buf>>4;
|
|
//*reading = buf>>4;
|
|
- *reading = 0xB0;
|
|
|
|
|
|
+ *reading = i;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|