Skip to content

Commit

Permalink
Move I2C Sensor code into separate library: pico-sensor-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
tjko committed Oct 5, 2024
1 parent 43d1874 commit c03e0f2
Show file tree
Hide file tree
Showing 27 changed files with 29 additions and 3,556 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "libs/pico-1wire-lib"]
path = libs/pico-1wire-lib
url = https://github.com/tjko/pico-1wire-lib.git
[submodule "libs/pico-sensor-lib"]
path = libs/pico-sensor-lib
url = https://github.com/tjko/pico-sensor-lib.git
23 changes: 5 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ target_sources(libb64 INTERFACE
# pico-telnetd
add_subdirectory(libs/pico-telnetd)

# pico-1wire-libe
# pico-1wire-lib
add_subdirectory(libs/pico-1wire-lib)

# pico-sensor-lib
add_subdirectory(libs/pico-sensor-lib)


# fanpico firmware

Expand All @@ -101,23 +104,6 @@ add_executable(fanpico
src/tacho.c
src/sensors.c
src/i2c.c
src/i2c_adt7410.c
src/i2c_aht.c
src/i2c_as621x.c
src/i2c_bmp180.c
src/i2c_bmp280.c
src/i2c_dps310.c
src/i2c_lps22.c
src/i2c_lps25.c
src/i2c_mcp9808.c
src/i2c_ms8607.c
src/i2c_pct2075.c
src/i2c_shtc3.c
src/i2c_sht3x.c
src/i2c_sht4x.c
src/i2c_stts22h.c
src/i2c_tmp102.c
src/i2c_tmp117.c
src/onewire.c
src/filters.c
src/filter_lossypeak.c
Expand Down Expand Up @@ -179,6 +165,7 @@ target_link_libraries(fanpico PRIVATE
bb_spi_lcd-lib
libb64
pico_1wire_lib
pico_sensor_lib
)

if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Raspberry Pi Pico C/C++ SDK is required for compiling the firmware:
* [libb64](https://github.com/libb64/libb64)
* [pico-telnetd](https://github.com/tjko/pico-telnetd)
* [pico-1wire-lib](https://github.com/tjko/pico-1wire-lib)
* [pico-sensor-lib](https://github.com/tjko/pico-sensor-lib)

##### Install Pico SDK
Pico SDK must be installed working before you can compile fanpico.
Expand Down
6 changes: 5 additions & 1 deletion credits.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FanPico: Smart PWM (PC) Fan Controller
FanPico: Smart PWM (PC) Fan Controller
Copyright (C) 2021-2024 Timo Kokkonen <[email protected]>
https://github.com/tjko/fanpico

Expand Down Expand Up @@ -43,3 +43,7 @@ https://github.com/tjko/pico-telnetd
pico-1wire-lib
Copryight (c) 2024 Timo Kokkonen ([email protected])
https://github.com/tjko/pico-1wire-lib

pico-sensor-lib
Copryight (c) 2024 Timo Kokkonen ([email protected])
https://github.com/tjko/pico-sensor-lib
1 change: 1 addition & 0 deletions libs/pico-sensor-lib
Submodule pico-sensor-lib added at 81b159
1 change: 1 addition & 0 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "pico/rand.h"
#include "hardware/watchdog.h"
#include "cJSON.h"
#include "pico_sensor_lib.h"
#include "fanpico.h"
#ifdef WIFI_SUPPORT
#include "lwip/ip_addr.h"
Expand Down
1 change: 1 addition & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "pico/stdlib.h"
#include "pico/mutex.h"
#include "cJSON.h"
#include "pico_sensor_lib.h"
#ifdef WIFI_SUPPORT
#include "lwip/ip_addr.h"
#endif
Expand Down
4 changes: 0 additions & 4 deletions src/fanpico.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,8 @@ uint64_t onewire_address(uint sensor);
void scan_i2c_bus();
void display_i2c_status();
void setup_i2c_bus(struct fanpico_config *config);
uint get_i2c_sensor_type(const char *name);
const char *i2c_sensor_type_str(uint type);
bool i2c_reserved_address(uint8_t addr);
int i2c_read_temps(struct fanpico_config *config);


/* tls.c */
int read_pem_file(char *buf, uint32_t size, uint32_t timeout, bool append);
#ifdef WIFI_SUPPORT
Expand Down
Loading

0 comments on commit c03e0f2

Please sign in to comment.