Changed types in sensros functions. Creaded files fro sensor config. (DH).
This commit is contained in:
parent
50d7893963
commit
38f92547cf
43
fw/Core/Inc/config.h
Normal file
43
fw/Core/Inc/config.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* config.h
|
||||
*
|
||||
* Created on: Sep 5, 2021
|
||||
* Author: dukenuc
|
||||
*/
|
||||
|
||||
#ifndef INC_CONFIG_H_
|
||||
#define INC_CONFIG_H_
|
||||
|
||||
/* TODO: add comments to everything */
|
||||
|
||||
#define VENDOR_NAME_LENGTH 64
|
||||
#define PRODUCT_CODE_LENGTH 64
|
||||
#define PRODUCT_NAME_LENGTH 64
|
||||
#define REVISION_LENGTH 16
|
||||
#define SERIAL_NUMBER_LENGTH 64
|
||||
|
||||
#define CONFIG_OK 0
|
||||
#define CONFIG_ERROR -1
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* DEVICE ID */
|
||||
uint8_t vendor_name[VENDOR_NAME_LENGTH];
|
||||
uint8_t product_code[PRODUCT_CODE_LENGTH];
|
||||
uint8_t product_name[PRODUCT_NAME_LENGTH];
|
||||
uint8_t revision[REVISION_LENGTH];
|
||||
uint8_t serial_number[SERIAL_NUMBER_LENGTH];
|
||||
|
||||
/* DEVICE SPECIFIC CONFIG */
|
||||
uint8_t led_on;
|
||||
uint16_t led_co2_alert_limit1;
|
||||
uint16_t led_co2_alert_limit2;
|
||||
} config_t;
|
||||
|
||||
int8_t read_config(config_t *config);
|
||||
|
||||
int8_t write_config(config_t *config);
|
||||
|
||||
#endif /* INC_CONFIG_H_ */
|
||||
|
@ -52,6 +52,6 @@ int8_t scd4x_stop_periodic_measurement( void );
|
||||
|
||||
int8_t scd4x_perform_factory_reset( void );
|
||||
|
||||
int8_t scd4x_read_measurement(int * co2, int *temperature, int *relative_humidity);
|
||||
int8_t scd4x_read_measurement(uint16_t * co2, int16_t *temperature, uint16_t *relative_humidity);
|
||||
|
||||
#endif /* INC_SCD4X_H_ */
|
||||
|
@ -52,6 +52,6 @@ typedef enum {
|
||||
|
||||
int8_t sht4x_send_cmd(sht4x_cmd_t cmd);
|
||||
int8_t sht4x_read_data(uint8_t *buffer, int len);
|
||||
int8_t sht4x_measure(int *temperature, int *relative_humidity);
|
||||
int8_t sht4x_measure(int16_t *temperature, uint16_t *relative_humidity);
|
||||
|
||||
#endif /* INC_SHT4X_H_ */
|
||||
|
18
fw/Core/Src/config.c
Normal file
18
fw/Core/Src/config.c
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* config.c
|
||||
*
|
||||
* Created on: Sep 5, 2021
|
||||
* Author: dukenuc
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int8_t read_config(config_t *config)
|
||||
{
|
||||
return CONFIG_OK;
|
||||
}
|
||||
|
||||
int8_t write_config(config_t *config)
|
||||
{
|
||||
return CONFIG_OK;
|
||||
}
|
@ -263,7 +263,9 @@ int main(void)
|
||||
/* Read SCD4x data (if connected) */
|
||||
if (scd4x_is_connected == 1)
|
||||
{
|
||||
scd4x_read_measurement(&CO2, &T_SCD4x, &RH_SCD4x);
|
||||
scd4x_read_measurement(&CO2,
|
||||
&T_SCD4x,
|
||||
&RH_SCD4x);
|
||||
}
|
||||
|
||||
/* Read SPS30 data (if connected) */
|
||||
|
@ -43,7 +43,7 @@ int8_t scd4x_perform_factory_reset( void )
|
||||
return scd4x_send_cmd(SCD4X_PERFORM_FACTORY_RESET);
|
||||
}
|
||||
|
||||
int8_t scd4x_read_measurement(int * co2, int *temperature, int *relative_humidity)
|
||||
int8_t scd4x_read_measurement(uint16_t * co2, int16_t *temperature, uint16_t *relative_humidity)
|
||||
{
|
||||
uint8_t buffer[32];
|
||||
int result;
|
||||
|
@ -17,7 +17,7 @@ int8_t sht4x_read_data(uint8_t *buffer, int len)
|
||||
return SHT4X_OK;
|
||||
}
|
||||
|
||||
int8_t sht4x_measure(int *temperature, int *relative_humidity)
|
||||
int8_t sht4x_measure(int16_t *temperature, uint16_t *relative_humidity)
|
||||
{
|
||||
uint8_t buffer[32];
|
||||
int result;
|
||||
|
Loading…
Reference in New Issue
Block a user