![]() |
Data Logger BLE Cellular Board
|
common struct, enum, externs, prototypes More...
#include "bme68x.h"#include "jfet_files/HDC2080.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <zephyr/drivers/gpio.h>#include <zephyr/drivers/spi.h>Go to the source code of this file.
Classes | |
| struct | flashParametersStruct |
| Flash parameters structure. More... | |
Macros | |
| #define | VERSION_MAJOR 0 |
| #define | VERSION_MINOR 15 |
| #define | VERSION_DATE "BLE Sensor 07/20/26" |
| #define | BOARD_NAME "BLE Sensor Prototype" |
| #define | VERSION_DATE_EXT1 " (Bd 1.0 UART0)" |
| #define | VERSION_DATE_EXT2 " (Bd 1.0 No UART0)" |
| #define | VERSION_DATE_EXT3 " (Bd 1.0 NO SERIAL)" |
| #define | BOARD_NAME_EXT " V1.0 (nRF52832)" |
| #define | FALSE 0 |
| #define | TRUE 1 |
| #define | DEFAULT_DUTYCYCLE TEN_SECONDS |
| #define | SPI_BUF_SIZE 128 |
| #define | SPI_SLAVE 0 |
| #define | SLOW_FREQ 150000 |
| #define | FAST_FREQ 16000000 |
| #define | DATA_LENGTH 20 |
| #define | STR(x) |
| #define | EXPAND_AND_STR(x) |
| #define | LOWTEMPENABLE 0x01 |
| #define | LOWTEMPACTIVE 0x02 |
| #define | HIGHTEMPENABLE 0x04 |
| #define | HIGHTEMPACTIVE 0x08 |
| #define | LOWHUMIDITYENABLE 0x01 |
| #define | LOWHUMIDITYACTIVE 0x02 |
| #define | HIGHHUMIDITYENABLE 0x04 |
| #define | HIGHHUMIDITYACTIVE 0x08 |
| #define | MAX_PARAMETERS 3 |
| #define | MAX_FLASH_BYTES 0x200 |
| #define | FLASHPARAMETERSTART 0 |
| #define | FLASHBLESTART (FLASHPARAMETERSTART + 0x10) |
| #define | FLASHPARAMETERKEY 0X12345678 |
| #define | MAX_NUMBER_BLE_PACKETS 10 |
Enumerations | |
| enum | SENSORTYPE { SENSORTYPEHDC2080 , SENSORTYPEW25Q64JV , SENSORTYPEBME688 , SENSORTYPEUNKNOWN } |
Functions | |
| int | myPrintk (char *restrict fmt,...) |
| int | myPrintkW (char *restrict fmt,...) |
| prints a warning message to the UART | |
| int | myPrintkI (char *restrict fmt,...) |
| prints an information message to the UART | |
| int | myPrintkS (char *restrict fmt,...) |
| prints a status message to the UART | |
| int | myPrintkE (char *restrict fmt,...) |
| prints an error message to the UART | |
| int | init_i2c () |
| Initializes the I2C interface. | |
| void | hdc2080_rdy_seen (const struct device *dev, struct gpio_callback *cb, uint32_t pins) |
| Callback function for HDC2080 RDY pin. | |
| void | sw2_seen (const struct device *dev, struct gpio_callback *cb, uint32_t pins) |
| Callback function for SW2 button. | |
| uint8_t | bleCommand (uint8_t *data) |
| Executes a BLE command. | |
| int | getCmd (uint8_t *line) |
| int | initHDC2080 (void) |
| Initializes the HDC2080 sensor with default parameters. | |
| int | initW25Q64JV (void) |
| Initiailizes the W25Q64JW. | |
| int | initBME688 (void) |
| Initializes the BME688 sensor over SPI. Performs interface initialization, device reset, and basic data verification. | |
| void | readNVFlashxID (uint8_t *flashId) |
| reads the NV Flash ID over the SPI bus. | |
| void | readNVFlashxStatus (uint8_t *flashStatus) |
| reads the 3 NV Flash status registers over the SPI bus. | |
| void | flashxErasePage (uint32_t address) |
| erases a 256 byte page over the SPI bus. | |
| void | flashxEraseBlock1 (uint32_t address) |
| erases a 2K block page over the SPI bus. | |
| void | flashxEraseBlock2 (uint32_t address) |
| void | flashxEraseSector (uint32_t address) |
| erases a 256K byte sector over the SPI bus. | |
| void | flashxErase (void) |
| erases the entire 8 Mb over the SPI bus. | |
| void | flashxReadPage (uint32_t address, uint8_t *flashRead) |
| reads a 256 byte page over the SPI bus. | |
| void | flashxWritePage (uint32_t page, uint32_t address, uint8_t *data, uint16_t count) |
| writes data to address in serial flash over the SPI bus. | |
| void | flashxFillPage (uint32_t address, uint16_t data) |
| fills a 256 byte page with data over the SPI bus. | |
| void | flashxClearParameters (void) |
| clears/initializes the flash parameters in RAM | |
| void | setFlashxParameters (uint8_t display) |
| loads the NV Flash parameters from teh RAM flash parameters | |
| void | displayFlashxParameters (void) |
| displays the NV flash parameters. | |
| void | rescan (void) |
| rescan all I2C and SPI devices | |
| void | executeCmd (char *line) |
| executes the command in line array. | |
| int8_t | getCLICmd (char *line) |
| parses command line to find position of command in validCLICmds array. | |
| int | adc_sample (void) |
| get a single reading from ADC channel | |
| void | getFlashparameters (void) |
| Read the stored flash parameter block from serial flash. | |
| void | int64_to_string (int64_t num, char *str) |
| Converts a 64-bit signed integer to a null-terminated string. | |
| int | getBME688Data (int count, uint8_t quiet) |
| Triggers and retrieves measurement data from the BME688. | |
Variables | |
| uint16_t | manfID |
| uint16_t | deviceID |
| const struct device *const | i2c_dev |
| get the device structure for the I2C device defined by I2C_DEV_NODE | |
| const struct device *const | uart0_dev |
| float | hdcTemp |
| float | hdcHumidity |
| char * | cmdLineParameter [] |
| array of pointers to command line parameter strings | |
| uint8_t | numParameters |
| char | devIDStr [] |
| int | ret |
| uint8_t | buffer_tx [] |
| SPI transmit buffer. | |
| uint8_t | buffer_rx [] |
| SPI receive buffer0. | |
| struct spi_buf | tx_bufs [] |
| SPI TX buffer structure. | |
| struct spi_buf | rx_bufs [] |
| SPI RX buffer structure. | |
| struct spi_config | spi_cfg1 |
| SPI configuration. | |
| struct spi_config | spi_cfg2 |
| SPI configuration. | |
| const struct spi_buf_set | tx |
| SPI TX buffer structure. | |
| const struct spi_buf_set | rx |
| SPI RX buffer structure. | |
| const struct spi_cs_control | spi_cs1 |
| const struct spi_cs_control | spi_cs2 |
| const struct gpio_dt_spec | spics1n |
| const struct gpio_dt_spec | spics2n |
| const struct device *const | spi_dev |
| uint32_t | sensorTypePresentAll |
| float | adc_voltage [] |
| last ADC voltage read [0] battery | |
| uint8_t | flashReadIn [] |
| const struct gpio_dt_spec | baten |
| get the GPIO specification for the BATEN pin defined by BATEN_NODE | |
| struct k_sem | hdc_rdy_seen |
| struct k_sem | uart_rx_disabled_sem |
| char | resetCause [] |
| char | myStr [] |
| flashParametersStruct | flashParameters |
| working valuses of flash parameters in RAM | |
| uint8_t | tmpData [] |
| uint32_t | bleIndex |
| uint8_t | stopWDTFeed |
| stop Watch Dog Timer feed causing a WDT interrupt for testing | |
| uint8_t | hdcMinutes |
| struct bme68x_dev | bme688_dev |
| BME688 device. | |
| struct bme68x_data | BME688Data |
| char | cliCMD [] |
| uint8_t | sendingDeviceInfo |
| flag to indicate sending device info in BLE packet instead of sensor data | |
| long long | gatewayDateTime |
| char | gatewayEpoch [] |
common struct, enum, externs, prototypes
Definition in file jfet_common.h.
| #define BOARD_NAME "BLE Sensor Prototype" |
Definition at line 34 of file jfet_common.h.
| #define BOARD_NAME_EXT " V1.0 (nRF52832)" |
Definition at line 39 of file jfet_common.h.
| #define DATA_LENGTH 20 |
Definition at line 51 of file jfet_common.h.
| #define DEFAULT_DUTYCYCLE TEN_SECONDS |
Definition at line 44 of file jfet_common.h.
| #define EXPAND_AND_STR | ( | x | ) |
Definition at line 54 of file jfet_common.h.
| #define FALSE 0 |
Definition at line 41 of file jfet_common.h.
| #define FAST_FREQ 16000000 |
Definition at line 49 of file jfet_common.h.
| #define FLASHBLESTART (FLASHPARAMETERSTART + 0x10) |
Definition at line 78 of file jfet_common.h.
| #define FLASHPARAMETERKEY 0X12345678 |
Definition at line 79 of file jfet_common.h.
| #define FLASHPARAMETERSTART 0 |
Definition at line 77 of file jfet_common.h.
| #define HIGHHUMIDITYACTIVE 0x08 |
Definition at line 63 of file jfet_common.h.
| #define HIGHHUMIDITYENABLE 0x04 |
Definition at line 62 of file jfet_common.h.
| #define HIGHTEMPACTIVE 0x08 |
Definition at line 59 of file jfet_common.h.
| #define HIGHTEMPENABLE 0x04 |
Definition at line 58 of file jfet_common.h.
| #define LOWHUMIDITYACTIVE 0x02 |
Definition at line 61 of file jfet_common.h.
| #define LOWHUMIDITYENABLE 0x01 |
Definition at line 60 of file jfet_common.h.
| #define LOWTEMPACTIVE 0x02 |
Definition at line 57 of file jfet_common.h.
| #define LOWTEMPENABLE 0x01 |
Definition at line 56 of file jfet_common.h.
| #define MAX_FLASH_BYTES 0x200 |
Definition at line 76 of file jfet_common.h.
| #define MAX_NUMBER_BLE_PACKETS 10 |
Definition at line 82 of file jfet_common.h.
| #define MAX_PARAMETERS 3 |
Definition at line 75 of file jfet_common.h.
| #define SLOW_FREQ 150000 |
Definition at line 48 of file jfet_common.h.
| #define SPI_BUF_SIZE 128 |
Definition at line 46 of file jfet_common.h.
| #define SPI_SLAVE 0 |
Definition at line 47 of file jfet_common.h.
| #define STR | ( | x | ) |
Definition at line 53 of file jfet_common.h.
| #define TRUE 1 |
Definition at line 42 of file jfet_common.h.
| #define VERSION_DATE "BLE Sensor 07/20/26" |
Definition at line 33 of file jfet_common.h.
| #define VERSION_DATE_EXT1 " (Bd 1.0 UART0)" |
Definition at line 36 of file jfet_common.h.
| #define VERSION_DATE_EXT2 " (Bd 1.0 No UART0)" |
Definition at line 37 of file jfet_common.h.
| #define VERSION_DATE_EXT3 " (Bd 1.0 NO SERIAL)" |
Definition at line 38 of file jfet_common.h.
| #define VERSION_MAJOR 0 |
Definition at line 30 of file jfet_common.h.
| #define VERSION_MINOR 15 |
Definition at line 31 of file jfet_common.h.
| enum SENSORTYPE |
| Enumerator | |
|---|---|
| SENSORTYPEHDC2080 | |
| SENSORTYPEW25Q64JV | |
| SENSORTYPEBME688 | |
| SENSORTYPEUNKNOWN | |
Definition at line 68 of file jfet_common.h.
| int adc_sample | ( | void | ) |
get a single reading from ADC channel
will read ADC_1ST_CHANNEL_ID
resoultion set to ADC_RESOLUTION in millivolts
will printout floating point value based on 3.6V max
Definition at line 343 of file main.c.


| uint8_t bleCommand | ( | uint8_t * | data | ) |
Executes a BLE command.
| data | Pointer to the command data |
Definition at line 2239 of file main.c.


| void displayFlashxParameters | ( | void | ) |
displays the NV flash parameters.
This also first loads the RAM flash parameters from the NV Flash Parameters
so it reloads the RAM flash parameters.
Definition at line 1021 of file w25q64jv.c.


| void executeCmd | ( | char * | line | ) |
executes the command in line array.
Definition at line 270 of file jfet_commandLine.c.


| void flashxClearParameters | ( | void | ) |
clears/initializes the flash parameters in RAM
This is called on power up reset after the NV flash parameters have been erased
from Page 0 1nd 1. only called if the Key is not set in the NV Flash Parameters.
Definition at line 939 of file w25q64jv.c.


| void flashxErase | ( | void | ) |
erases the entire 8 Mb over the SPI bus.
Definition at line 379 of file w25q64jv.c.


| void flashxEraseBlock1 | ( | uint32_t | address | ) |
erases a 2K block page over the SPI bus.
| address | address of the block to be erased |
Definition at line 230 of file w25q64jv.c.

| void flashxEraseBlock2 | ( | uint32_t | address | ) |
| void flashxErasePage | ( | uint32_t | address | ) |
erases a 256 byte page over the SPI bus.
| address | address of the page to be erased |
Definition at line 180 of file w25q64jv.c.

| void flashxEraseSector | ( | uint32_t | address | ) |
erases a 256K byte sector over the SPI bus.
| address | address of the sector to be erased |
Definition at line 330 of file w25q64jv.c.


| void flashxFillPage | ( | uint32_t | address, |
| uint16_t | data ) |
fills a 256 byte page with data over the SPI bus.
| address | 24 bit memory address of page to write |
| data | byte to fill in page in NV memory |
Definition at line 752 of file w25q64jv.c.


| void flashxReadPage | ( | uint32_t | address, |
| uint8_t * | flashRead ) |
reads a 256 byte page over the SPI bus.
| address | 24 bit memory address of page to read |
| flashRead | - address of data array to received bytes from NV memory |
Definition at line 427 of file w25q64jv.c.

| void flashxWritePage | ( | uint32_t | page, |
| uint32_t | address, | ||
| uint8_t * | data, | ||
| uint16_t | count ) |
writes data to address in serial flash over the SPI bus.
| page | 24 bit memory address of page to write |
| address | address within page to begin writing |
| data | address of data array to get bytes to store bytes in NV memory |
| count | number of bytes to write |
Definition at line 542 of file w25q64jv.c.


| int getBME688Data | ( | int | count, |
| uint8_t | quiet ) |
Triggers and retrieves measurement data from the BME688.
| count | Number of samples to collect. |
| quiet | If TRUE, suppresses debug print output. |
Definition at line 1916 of file bme68x.c.


| int8_t getCLICmd | ( | char * | line | ) |
parses command line to find position of command in validCLICmds array.
goes through line array separated by spaces. cmdLineParameter[numParameters]
is an array of pointers to the various parameters in the line until the end of line then
searches cmd array for a match in validCLICmds array.
Definition at line 444 of file jfet_commandLine.c.


| int getCmd | ( | uint8_t * | line | ) |

| void getFlashparameters | ( | void | ) |
Read the stored flash parameter block from serial flash.
The flash parameter structure is stored in consecutive 256-byte pages. This function reads only the number of pages needed for the current sizeof(flashParametersStruct).
Definition at line 1183 of file w25q64jv.c.


| void hdc2080_rdy_seen | ( | const struct device * | dev, |
| struct gpio_callback * | cb, | ||
| uint32_t | pins ) |
Callback function for HDC2080 RDY pin.
| dev | Pointer to the device structure |
| cb | Pointer to the GPIO callback structure |
| pins | GPIO pin mask This function is a callback that is triggered when the HDC2080 RDY pin is activated. It checks if the specific pin associated with the HDC2080 is part of the pins that triggered the callback. If it is, it gives a semaphore to indicate that the HDC2080 RDY signal has been seen, allowing other parts of the program to proceed with reading data from the sensor or performing other actions that depend on the RDY signal. The function includes commented-out code for debugging purposes, which can be used to print the state of the pin and the pins that triggered the callback. |
Definition at line 2196 of file main.c.

| int init_i2c | ( | ) |
Initializes the I2C interface.
Note: The I2C speed is set to fast mode, and the device is configured as a controller. The function also includes debug print statements to indicate the status of the initialization process.
Definition at line 2160 of file main.c.


| int initBME688 | ( | void | ) |
| int initHDC2080 | ( | void | ) |
| int initW25Q64JV | ( | void | ) |
Initiailizes the W25Q64JW.
This will read the WHO_AM_I value to determine if a W25Q64JW is connected.
It will set SENSORTYPEW25Q64JW if a W25Q64JW is available.
Definition at line 1254 of file w25q64jv.c.


| void int64_to_string | ( | int64_t | num, |
| char * | str ) |
Converts a 64-bit signed integer to a null-terminated string.
| num | The 64-bit integer to convert. |
| str | Pointer to the destination buffer (must be large enough to hold the result). |
Definition at line 663 of file jfet_commandLine.c.

| int myPrintk | ( | char *restrict | fmt, |
| ... ) |
| int myPrintkE | ( | char *restrict | fmt, |
| ... ) |
prints an error message to the UART
| fmt | format string |
Definition at line 2452 of file main.c.

| int myPrintkI | ( | char *restrict | fmt, |
| ... ) |
prints an information message to the UART
| fmt | format string |
Definition at line 2386 of file main.c.

| int myPrintkS | ( | char *restrict | fmt, |
| ... ) |
prints a status message to the UART
| fmt | format string |
Definition at line 2419 of file main.c.

| int myPrintkW | ( | char *restrict | fmt, |
| ... ) |
prints a warning message to the UART
| fmt | format string |
Definition at line 2353 of file main.c.

| void readNVFlashxID | ( | uint8_t * | flashId | ) |
reads the NV Flash ID over the SPI bus.
| flashId | pointer to the buffer to receive the Flash ID bytes |
Definition at line 34 of file w25q64jv.c.

| void readNVFlashxStatus | ( | uint8_t * | flashStatus | ) |
reads the 3 NV Flash status registers over the SPI bus.
| flashStatus | pointer to the buffer to receive the Flash Status bytes |
Definition at line 61 of file w25q64jv.c.

| void rescan | ( | void | ) |
rescan all I2C and SPI devices
This function rescans all I2C and SPI devices by calling the initialization functions for each device. It checks if the HDC2080, W25Q64JV, and BME688 devices are available and properly initialized. If any of the initialization functions fail, it can be modified to handle the error accordingly. The function includes calls to the initialization functions for each device and can be expanded to include additional devices as needed. The current implementation assumes that the initialization functions will handle any necessary error reporting and that the rescan function will simply call them in sequence.
Definition at line 2281 of file main.c.


| void setFlashxParameters | ( | uint8_t | display | ) |
loads the NV Flash parameters from teh RAM flash parameters
| display | true to display parameters after the write, false to not display after a write |
Definition at line 1122 of file w25q64jv.c.


| void sw2_seen | ( | const struct device * | dev, |
| struct gpio_callback * | cb, | ||
| uint32_t | pins ) |
Callback function for SW2 button.
| dev | Pointer to the device structure |
| cb | Pointer to the GPIO callback structure |
| pins | GPIO pin mask This function is a callback that is triggered when the SW2 button is pressed. It checks if the specific pin associated with the SW2 button is part of the pins that triggered the callback. If it is, it gives a semaphore to indicate that the SW2 button has been seen, allowing other parts of the program to proceed with actions that depend on the SW2 button press. The function includes commented-out code for debugging purposes, which can be used to print the state of the pin and the pins that triggered the callback. |
Definition at line 2219 of file main.c.

|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |