gfurtadoalmeida / esp32-driver-mcp320x Goto Github PK
View Code? Open in Web Editor NEWESP32 driver for Microchip MCP3204 and MCP3208 12-bit ADCs.
License: MIT License
ESP32 driver for Microchip MCP3204 and MCP3208 12-bit ADCs.
License: MIT License
The voltage calculation for a reference voltage less than 4096 will always return 0 and any reference voltage other than 4096 will return an inaccurate voltage.
Here is a patch :
diff --git a/components/esp32_driver_mcp320x/src/mcp320x.c b/components/esp32_driver_mcp320x/src/mcp320x.c
index ce6e6fe..5af377d 100644
--- a/components/esp32_driver_mcp320x/src/mcp320x.c
+++ b/components/esp32_driver_mcp320x/src/mcp320x.c
@@ -40,7 +40,8 @@ mcp320x_t *mcp320x_install(mcp320x_config_t const *config)
mcp320x_t *dev = (mcp320x_t *)malloc(sizeof(mcp320x_t));
dev->spi_handle = spi_device_handle;
dev->mcp_model = config->device_model;
- dev->millivolts_per_resolution_step = config->reference_voltage / MCP320X_RESOLUTION;
+ dev->millivolts_per_resolution_step = (float)config->reference_voltage / (float)MCP320X_RESOLUTION;
return dev;
When I run the code, the displayed voltage couldn't go greater than somewhere around 70 mV. The hex value in rx buffer was responding properly to the input voltage though, so I modified the code a little bit. Change diff.patch -> diff.html
diff.patch
Cpu crashes when your example code is put in a while (1) loop with vtask delay
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.