Skip to content

Commit 622b95a

Browse files
committed
Fixed function definitions
1 parent 13dac0f commit 622b95a

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

Diff for: VCNL4010.cpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void VCNL4010::writeByte(const uint8_t addr, const uint8_t data) { //
8787
** 111 250 **
8888
** These roughly equate to Hz (2,4,8,16,32,64,128 and 256) **
8989
*******************************************************************************************************************/
90-
void VCNL4010::setProximityHz(const uint8_t Hz=2) { // //
90+
void VCNL4010::setProximityHz(const uint8_t Hz) { // //
9191
uint8_t setValue; // temp variable for sampling rate //
9292
if (Hz>250) setValue = 7; // If value is bigger then set max //
9393
else if (Hz>=128) setValue = 6; // //
@@ -103,7 +103,7 @@ void VCNL4010::setProximityHz(const uint8_t Hz=2) { //
103103
** Method setLEDmA() sets the IR LED current output in milliamps. Range is between 0mA and 200mA, internally set **
104104
** in steps of 10mA with input values being truncated down to the next lower value **
105105
*******************************************************************************************************************/
106-
void VCNL4010::setLEDmA(const uint8_t mA=20) { // //
106+
void VCNL4010::setLEDmA(const uint8_t mA) { // //
107107
writeByte(VCNL4010_LED_CURRENT_REG,(uint8_t)(mA/10)); // Divide by 10 and write register //
108108
} // of method setLEDmA() // //
109109
/*******************************************************************************************************************
@@ -113,7 +113,7 @@ void VCNL4010::setLEDmA(const uint8_t mA=20) { //
113113
** 10 = 1.5625 MHz **
114114
** 11 = 3.125 MHz **
115115
*******************************************************************************************************************/
116-
void VCNL4010::setProximityFreq(const uint8_t value=0) { // Set Frequency value from list //
116+
void VCNL4010::setProximityFreq(const uint8_t value) { // Set Frequency value from list //
117117
uint8_t registerSetting = readByte(VCNL4010_PROXIMITY_TIMING_REG); // Get the register settings //
118118
registerSetting &= B11100111; // Mask the 2 timing bits //
119119
registerSetting |= (value&B00000011) << 3; // Add in 2 bits from value //
@@ -123,7 +123,7 @@ void VCNL4010::setProximityFreq(const uint8_t value=0) { //
123123
** Method setAmbientLight() sets the number of samples taken per second and the number of samples averaged to **
124124
** make a reading; each reading takes only 300microseconds and the default period for a measurement is 100ms. **
125125
*******************************************************************************************************************/
126-
void VCNL4010::setAmbientLight(uint8_t sample=2, uint8_t avg=32) { // //
126+
void VCNL4010::setAmbientLight(uint8_t sample, uint8_t avg) { // //
127127
sample--; // subtract one for offset //
128128
if (sample==6) sample==5; // Adjust nonexistent values //
129129
else if (sample==8) sample==6; // //
@@ -190,7 +190,7 @@ uint8_t VCNL4010::getInterrupt() { //
190190
** Bit 0 - high threshold interrupt **
191191
** The bit needs to be written as "1" in order to clear it, so send the bitwise not value **
192192
*******************************************************************************************************************/
193-
void VCNL4010::clearInterrupt(const uint8_t intVal=0) { // Set Interrupt bits //
193+
void VCNL4010::clearInterrupt(const uint8_t intVal) { // Set Interrupt bits //
194194
writeByte(VCNL4010_INTERRUPT_STATUS_REG,~intVal); // Write value to register //
195195
} // of method clearInterrupt() // //
196196
/*******************************************************************************************************************
@@ -200,13 +200,13 @@ void VCNL4010::clearInterrupt(const uint8_t intVal=0) { //
200200
** trigger an interrupt on threshold low or high value being exceeded for Proximity and ALS. Since only one can **
201201
** be used the ALS is chosen when both are set. Finally the low and high threshold values themselves **
202202
*******************************************************************************************************************/
203-
void VCNL4010::setInterrupt(const uint8_t count = 1, // //
204-
const bool ProxReady = false, // //
205-
const bool ALSReady = false, // //
206-
const bool ProxThreshold = false, // //
207-
const bool ALSThreshold = false, // //
208-
const uint16_t lowThreshold = 0, // //
209-
const uint16_t highThreshold = UINT16_MAX ) { // //
203+
void VCNL4010::setInterrupt(const uint8_t count , // //
204+
const bool ProxReady , // //
205+
const bool ALSReady , // //
206+
const bool ProxThreshold , // //
207+
const bool ALSThreshold , // //
208+
const uint16_t lowThreshold , // //
209+
const uint16_t highThreshold ) { // //
210210
uint8_t registerValue = 0; // Default to 1 count //
211211
if (count>=128) registerValue = B111; // Choose setting based on parameter//
212212
else if (count>=64) registerValue = B110; // //
@@ -231,7 +231,7 @@ void VCNL4010::setInterrupt(const uint8_t count = 1, //
231231
/*******************************************************************************************************************
232232
** Method setAmbientContinuous() sets or unsets the continuous measurement mode for the ambient light sensor **
233233
*******************************************************************************************************************/
234-
void VCNL4010::setAmbientContinuous(const bool ContinuousMode=true) { // Cont. Ambient sampling on/off //
234+
void VCNL4010::setAmbientContinuous(const bool ContinuousMode) { // Cont. Ambient sampling on/off //
235235
uint8_t commandBuffer = readByte(VCNL4010_COMMAND_REG); // get the register contents //
236236
commandBuffer &= B11111010; // Mask the 2 relevant bits //
237237
if (ContinuousMode==true) { // If we are turning on then write //
@@ -247,7 +247,7 @@ void VCNL4010::setAmbientContinuous(const bool ContinuousMode=true) { //
247247
/*******************************************************************************************************************
248248
** Method setProximityContinuous() sets or unsets the continuous measurement mode for the proximity sensor **
249249
*******************************************************************************************************************/
250-
void VCNL4010::setProximityContinuous(const bool ContinuousMode=true) { // Cont. Proximity sampling on/off //
250+
void VCNL4010::setProximityContinuous(const bool ContinuousMode) { // Cont. Proximity sampling on/off //
251251
uint8_t commandBuffer = readByte(VCNL4010_COMMAND_REG); // get the register contents //
252252
commandBuffer &= B11111100; // Mask the 2 relevant bits //
253253
if (ContinuousMode==true) { // If we are turning on then write //

Diff for: VCNL4010.h

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
** **
2525
** Vers. Date Developer Comments **
2626
** ====== ========== =================== ======================================================================== **
27+
** 1.0.2 2017-07-31 [email protected] Removed default definitions from function definitions, kept them in the **
28+
** the prototype definitions as this caused compiler errors on non-Windows **
2729
** 1.0.1 2017-01-02 [email protected] Moved readByte function back into priate area **
2830
** 1.0.0 2017-01-01 [email protected] Fixed error on continuous mode with proximity, ready for release **
2931
** 1.0.b2 2016-12-31 [email protected] Continued coding **

0 commit comments

Comments
 (0)