Description of the task:
Synaptron is engineering new appliances to control electricity consumption and command electric devices in houses, factories and offices. We are looking for small footprint code in C and Python to read temperature, humidity, altitude and pressure from a BME 280 sensor. The code will be included in the main loop, it will be called with no argument passed.
On exit will return temperature, humidity, altitude and pressure in a buffer (C) or a list (Python) as float type with 2 digits after the decimal separator (i.e. xx.dd).
The code must address the bare sensor, NOT an existing module: init task should be provided the arguments for chip addressing and any other chip configuration variable. The init code should take care of testing if the sensor is present and correctly working. Should any issue rise the init code must return an appropriate error number based on the found issue (if any).
We expect all the code is ready for use returning the correct values without any further processing for compensation or other correction issues.
Requirements and Rules:
Please optimize code for minimum footprint
The code must be well structured in functions/modules
All the source code must be clearly commented
Only standard C functions and Python 3. X functions allowed, no microcontroller or IDE specific functions
Only full stable, working code will be evaluated (no bugs or missing functions allowed)
Please, clearly specify the hardware requirements and connections to readily test your code.
If C code issued: please, make the code compilable by common IDEs or compilers.
The code neatness will account for up to 40 points.
Clear comments for every function and relevant code will account for up to 40 points.
The smallest memory footprint submitted will receive a bonus prize of 20 points.
Prizes and Rewards:
The top 5 scores will receive a full feedback about their work.
Every score above 80 points will be in a list of candidates for other similar tasks.
The top performer will be mentioned as a member in the development team of our product and will be inserted in the permanent list of our freelance C/Python programmers.