glassboard-dev / mcp342x Goto Github PK
View Code? Open in Web Editor NEWC Driver for the MCP3426/7/8, 16-Bit, Multi-Channel Analog-To-Digital Converter with I2C Interface and On-Board Reference
License: MIT License
C Driver for the MCP3426/7/8, 16-Bit, Multi-Channel Analog-To-Digital Converter with I2C Interface and On-Board Reference
License: MIT License
It would be nice to grab usr functions from a BSP folder that are ready to use for a developers micro
The driver will follow the javadoc method of documenting the source and API
The final IF statement does an assignment instead of a comparison..
mcp342x_return_code_t mcp342x_writeConfig(mcp342x_dev_t *dev) {
mcp342x_return_code_t ret = MCP342x_RET_OK;
if( dev == NULL ) {
// The pointer to the mcp342x dev is NULL
ret = MCP342x_RET_NULL_PTR;
}
if( (dev->registers.bits.config.bits.conv_mode >= MCP342x_CM__MAX__) ||
(dev->registers.bits.config.bits.gain >= MCP342x_GAIN__MAX__) ||
(dev->registers.bits.config.bits.sample_rate >= MCP342x_SR__MAX__) ) {
// One of the config values provideed to use is not valid.
ret = MCP342x_RET_INV_PARAM;
}
if( ret = MCP342x_RET_OK ) {
// Write the config to our device
ret = dev->intf.write((dev->intf.i2c_addr << 1), &dev->registers.bits.config.byte, 0x01);
}
return ret;
}
The current source is built around using STM HAL I2c calls. We want these to be abstracted away through function pointers, as well as adding the ability to instantiate multiple entities of the driver if a developer has several ADC chips.
The API currently allows a user to sample any channel they want. In the future, it would be nice to have an API to retrieve samples from all enabled config. Offloading the work to sample multiple channels from the app to the driver.
The results are to be stored in an array, and currently they are placed at the address of the array itself and not the proper index.
The ADC sample channel function currently retries 10 times when sampling a channel. Add a configuration option to set the amount of retries that should be attempted.
When making the submodules public, we need to place a license on the source before releasing.
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.