Skip to content

Commit

Permalink
update library.json, license, minor edits (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart authored Dec 21, 2021
1 parent 83ded26 commit 5656047
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 72 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2010-2021 Rob Tillaart
Copyright (c) 2010-2022 Rob Tillaart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion Max44009.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//
// FILE: Max44009.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.5.0
// VERSION: 0.5.1
// PURPOSE: library for MAX44009 lux sensor Arduino
// URL: https://github.com/RobTillaart/MAX44009
//
// HISTORY
//
// 0.5.1 2021-12-21 update library.json, license, minor edits
// 0.5.0 2021-06-04 fix exponent math.
// 0.4.4 2021-05-27 arduino-lint
// 0.4.3 2020-12-30 arduino-ci, unit test
Expand Down
42 changes: 21 additions & 21 deletions Max44009.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// FILE: Max44009.h
// AUTHOR: Rob dot Tillaart at gmail dot com
// VERSION: 0.5.0
// VERSION: 0.5.1
// PURPOSE: library for MAX44009 lux sensor Arduino
// HISTORY: See Max440099.cpp

Expand Down Expand Up @@ -32,36 +32,36 @@
#include "Arduino.h"


#define MAX44009_LIB_VERSION (F("0.5.0"))
#define MAX44009_LIB_VERSION (F("0.5.1"))

#define MAX44009_DEFAULT_ADDRESS 0x4A
#define MAX44009_ALT_ADDRESS 0x4B
#define MAX44009_DEFAULT_ADDRESS 0x4A
#define MAX44009_ALT_ADDRESS 0x4B


// REGISTERS
#define MAX44009_INTERRUPT_STATUS 0x00
#define MAX44009_INTERRUPT_ENABLE 0x01
#define MAX44009_CONFIGURATION 0x02
#define MAX44009_LUX_READING_HIGH 0x03
#define MAX44009_LUX_READING_LOW 0x04
#define MAX44009_THRESHOLD_HIGH 0x05
#define MAX44009_THRESHOLD_LOW 0x06
#define MAX44009_THRESHOLD_TIMER 0x07
#define MAX44009_INTERRUPT_STATUS 0x00
#define MAX44009_INTERRUPT_ENABLE 0x01
#define MAX44009_CONFIGURATION 0x02
#define MAX44009_LUX_READING_HIGH 0x03
#define MAX44009_LUX_READING_LOW 0x04
#define MAX44009_THRESHOLD_HIGH 0x05
#define MAX44009_THRESHOLD_LOW 0x06
#define MAX44009_THRESHOLD_TIMER 0x07


// CONFIGURATION MASKS
#define MAX44009_CFG_CONTINUOUS 0x80
#define MAX44009_CFG_MANUAL 0x40
#define MAX44009_CFG_CDR 0x08
#define MAX44009_CFG_TIMER 0x07
#define MAX44009_CFG_CONTINUOUS 0x80
#define MAX44009_CFG_MANUAL 0x40
#define MAX44009_CFG_CDR 0x08
#define MAX44009_CFG_TIMER 0x07


// ERROR CODES
#define MAX44009_OK 0
#define MAX44009_ERROR_WIRE_REQUEST -10
#define MAX44009_ERROR_OVERFLOW -20
#define MAX44009_ERROR_HIGH_BYTE -30
#define MAX44009_ERROR_LOW_BYTE -31
#define MAX44009_OK 0
#define MAX44009_ERROR_WIRE_REQUEST -10
#define MAX44009_ERROR_OVERFLOW -20
#define MAX44009_ERROR_HIGH_BYTE -30
#define MAX44009_ERROR_LOW_BYTE -31


class Max44009
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/MAX44009/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/MAX44009.svg?maxAge=3600)](https://github.com/RobTillaart/MAX44009/releases)


# MAX44009 I2C LUX sensor

Library for MAX44009 / GY-49 I2C lux sensor
Library for MAX44009 / GY-49 I2C lux sensor.


## Description
Expand Down
7 changes: 2 additions & 5 deletions examples/max44009_interrupt/max44009_interrupt.ino
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
//
// FILE: max44009_interrupt.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of max44009 library
// DATE: 2020-01-30
//
// Released to the public domain
//


#include "Wire.h"
Expand Down Expand Up @@ -65,4 +61,5 @@ void loop()
}


// END OF FILE
// -- END OF FILE --

Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
//
// FILE: max44009_setAutomaticMode.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of max44009 library
// DATE: 2020-01-30
//
// Released to the public domain
//


#include "Wire.h"
Expand Down Expand Up @@ -66,4 +62,6 @@ void loop()
}
}

// END OF FILE

// -- END OF FILE --

Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
//
// FILE: max44009_setContinuousMode.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of max44009 library
// DATE: 2020-01-30
//
// Released to the public domain
//

// note that lux values are repeated a number of times
// if read faster than the integration time.
// So it makes no sense to call getLux() more than once
// per integration time.
// NB the getLux() call takes a bit more than 1 millisecond
// note that lux values are repeated a number of times
// if read faster than the integration time.
// So it makes no sense to call getLux() more than once
// per integration time.
// NB the getLux() call takes a bit more than 1 millisecond


#include "Wire.h"
Expand Down Expand Up @@ -73,3 +69,4 @@ void loop()


// -- END OF FILE --

8 changes: 2 additions & 6 deletions examples/max44009_setManualMode/max44009_setManualMode.ino
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
//
// FILE: max44009_setManualMode.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// PURPOSE: demo of max44009 library
// DATE: 2020-01-30
//
// Released to the public domain
//


#include "Wire.h"
#include "Max44009.h"
Expand Down Expand Up @@ -74,4 +69,5 @@ void loop()
}


// END OF FILE
// -- END OF FILE --

6 changes: 1 addition & 5 deletions examples/max44009_test01/max44009_test01.ino
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
//
// FILE: max44009_test01.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.2
// PURPOSE: demo of max44009 library
// DATE: 2015-08-06
//
// Released to the public domain
//


#include "Wire.h"
Expand Down Expand Up @@ -51,4 +47,4 @@ void loop()
}


// END OF FILE
// -- END OF FILE --
12 changes: 6 additions & 6 deletions examples/max44009_test02/max44009_test02.ino
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
//
// FILE: max44009_test02.ino
// AUTHOR: Moritz Ulmer
// VERSION: 0.3.1
// PURPOSE: demo of max44009 library
// DATE: 2020-01-19
//
// NOTE: To select the alternative I2C address on the GY-49 breakout board,
// the A0 pin has to be set to 3V3. It is soldered to GND by default.
// See switch S1 / jp1 in the schematics.
// Made for ESP specific; does not work on UNO;
// DATE: 2020-01-19
//
// Released to the public domain
//




#include "Wire.h"
Expand Down Expand Up @@ -53,4 +52,5 @@ void loop() {
}


// END OF FILE
// -- END OF FILE --

5 changes: 1 addition & 4 deletions examples/max44009_two_sensors/max44009_two_sensors.ino
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
//
// FILE: max44009_two_sensors.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo of max44009 library
// DATE: 2020-02-16
//
// Released to the public domain
//


#include "Wire.h"
Expand Down Expand Up @@ -64,3 +60,4 @@ void loop()


// -- END OF FILE --

4 changes: 2 additions & 2 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Syntax Coloring Map For Max44009
# Syntax Colouring Map For Max44009

# Datatypes (KEYWORD1)
# Data types (KEYWORD1)
Max44009 KEYWORD1


Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/Max44009.git"
},
"version": "0.5.0",
"version": "0.5.1",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Max44009
version=0.5.0
version=0.5.1
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Library for MAX44009 I2C LUX sensor Arduino.
Expand Down
32 changes: 28 additions & 4 deletions test/unit_test_001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

unittest_setup()
{
fprintf(stderr, "MAX44009_LIB_VERSION: %s\n", (char *) MAX44009_LIB_VERSION);
}


Expand All @@ -46,10 +47,35 @@ unittest_teardown()
}


unittest(test_constructor)
unittest(test_constants)
{
fprintf(stderr, "VERSION: %s\n", MAX44009_LIB_VERSION);
assertEqual(MAX44009_DEFAULT_ADDRESS, 0x4A);
assertEqual(MAX44009_ALT_ADDRESS , 0x4B);

assertEqual(MAX44009_INTERRUPT_STATUS , 0x00);
assertEqual(MAX44009_INTERRUPT_ENABLE , 0x01);
assertEqual(MAX44009_CONFIGURATION , 0x02);
assertEqual(MAX44009_LUX_READING_HIGH , 0x03);
assertEqual(MAX44009_LUX_READING_LOW , 0x04);
assertEqual(MAX44009_THRESHOLD_HIGH , 0x05);
assertEqual(MAX44009_THRESHOLD_LOW , 0x06);
assertEqual(MAX44009_THRESHOLD_TIMER , 0x07);

assertEqual(MAX44009_CFG_CONTINUOUS , 0x80);
assertEqual(MAX44009_CFG_MANUAL , 0x40);
assertEqual(MAX44009_CFG_CDR , 0x08);
assertEqual(MAX44009_CFG_TIMER , 0x07);

assertEqual(MAX44009_OK , 0 );
assertEqual(MAX44009_ERROR_WIRE_REQUEST, -10);
assertEqual(MAX44009_ERROR_OVERFLOW , -20);
assertEqual(MAX44009_ERROR_HIGH_BYTE , -30);
assertEqual(MAX44009_ERROR_LOW_BYTE , -31);
}


unittest(test_constructor)
{
Max44009 LuxA(0x4A);
Wire.begin();

Expand All @@ -62,8 +88,6 @@ unittest(test_constructor)

unittest(test_convertToLux)
{
fprintf(stderr, "VERSION: %s\n", MAX44009_LIB_VERSION);

Max44009 LuxA(0x4A);

assertEqualFloat(0.000, LuxA.convertToLux(0x00, 0x00), 0.0001);
Expand Down

0 comments on commit 5656047

Please sign in to comment.