-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (HW 2.1) upgrade to hardware version 2.1 and implement related f…
…eatures (#45) * Push from internal dev branch * Bug fixes
- Loading branch information
1 parent
977a841
commit f679476
Showing
76 changed files
with
3,415 additions
and
1,103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* @file BH1750.h | ||
* @author TheRealKasumi | ||
* @brief Contains a class for reading the BH1750 I²C light sensor. | ||
* | ||
* @copyright Copyright (c) 2022 | ||
* | ||
*/ | ||
#ifndef BH1750_H | ||
#define BH1750_H | ||
|
||
#include <stdint.h> | ||
#include <Wire.h> | ||
#include "logging/Logger.h" | ||
|
||
namespace TesLight | ||
{ | ||
class BH1750 | ||
{ | ||
public: | ||
enum BH1750Res | ||
{ | ||
BH1750_HIGH = 0b00010000, | ||
BH1750_LOW = 0b00010011 | ||
}; | ||
|
||
BH1750(const uint8_t deviceAddress); | ||
BH1750(const uint8_t deviceAddress, const TesLight::BH1750::BH1750Res resolution); | ||
~BH1750(); | ||
|
||
bool begin(); | ||
|
||
bool setResolution(const TesLight::BH1750::BH1750Res resolution); | ||
TesLight::BH1750::BH1750Res getResolution(); | ||
|
||
bool getLux(float &lux); | ||
|
||
private: | ||
uint8_t deviceAddress; | ||
TesLight::BH1750::BH1750Res resolution; | ||
|
||
bool write(const uint8_t command); | ||
bool read(uint16_t &value); | ||
}; | ||
} | ||
|
||
#endif |
Oops, something went wrong.