mirror of
https://github.com/adafruit/Adafruit_TSL2561.git
synced 2026-08-03 20:24:05 +02:00
Fix clang-format CI: add .clang-format, update workflow, format code
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 2
|
||||
ColumnLimit: 80
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BreakBeforeBraces: Attach
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Left
|
||||
SpacesBeforeTrailingComments: 1
|
||||
@@ -3,7 +3,27 @@ name: Arduino Library CI
|
||||
on: [pull_request, push, repository_dispatch]
|
||||
|
||||
jobs:
|
||||
clang-format:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
path: ci
|
||||
|
||||
- name: pre-install
|
||||
run: bash ci/actions_install.sh
|
||||
|
||||
- name: clang
|
||||
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
|
||||
|
||||
build:
|
||||
needs: clang-format
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
@@ -88,7 +88,7 @@ boolean Adafruit_TSL2561_Unified::begin() {
|
||||
@returns True if sensor is found and initialized, false otherwise.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
boolean Adafruit_TSL2561_Unified::begin(TwoWire *theWire) {
|
||||
boolean Adafruit_TSL2561_Unified::begin(TwoWire* theWire) {
|
||||
_i2c = theWire;
|
||||
_i2c->begin();
|
||||
return init();
|
||||
@@ -191,8 +191,8 @@ void Adafruit_TSL2561_Unified::setGain(tsl2561Gain_t gain) {
|
||||
IR-only light diode.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_TSL2561_Unified::getLuminosity(uint16_t *broadband,
|
||||
uint16_t *ir) {
|
||||
void Adafruit_TSL2561_Unified::getLuminosity(uint16_t* broadband,
|
||||
uint16_t* ir) {
|
||||
bool valid = false;
|
||||
|
||||
if (!_tsl2561Initialised)
|
||||
@@ -290,7 +290,7 @@ void Adafruit_TSL2561_Unified::disable(void) {
|
||||
Private function to read luminosity on both channels
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_TSL2561_Unified::getData(uint16_t *broadband, uint16_t *ir) {
|
||||
void Adafruit_TSL2561_Unified::getData(uint16_t* broadband, uint16_t* ir) {
|
||||
/* Enable the device by setting the control bit to 0x03 */
|
||||
enable();
|
||||
|
||||
@@ -473,7 +473,7 @@ uint32_t Adafruit_TSL2561_Unified::calculateLux(uint16_t broadband,
|
||||
false if sensor is saturated
|
||||
*/
|
||||
/**************************************************************************/
|
||||
bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t *event) {
|
||||
bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t* event) {
|
||||
uint16_t broadband, ir;
|
||||
|
||||
/* Clear the event */
|
||||
@@ -501,7 +501,7 @@ bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t *event) {
|
||||
details about the TSL2561 and its capabilities
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_TSL2561_Unified::getSensor(sensor_t *sensor) {
|
||||
void Adafruit_TSL2561_Unified::getSensor(sensor_t* sensor) {
|
||||
/* Clear the sensor_t object */
|
||||
memset(sensor, 0, sizeof(sensor_t));
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define TSL2561_ADDR_HIGH (0x49) ///< Default address (pin pulled high)
|
||||
|
||||
// Lux calculations differ slightly for CS package
|
||||
//#define TSL2561_PACKAGE_CS ///< Chip scale package
|
||||
// #define TSL2561_PACKAGE_CS ///< Chip scale package
|
||||
#define TSL2561_PACKAGE_T_FN_CL ///< Dual Flat No-Lead package
|
||||
|
||||
#define TSL2561_COMMAND_BIT (0x80) ///< Must be 1
|
||||
@@ -165,25 +165,25 @@ typedef enum {
|
||||
*/
|
||||
/**************************************************************************/
|
||||
class Adafruit_TSL2561_Unified : public Adafruit_Sensor {
|
||||
public:
|
||||
public:
|
||||
Adafruit_TSL2561_Unified(uint8_t addr, int32_t sensorID = -1);
|
||||
boolean begin(void);
|
||||
boolean begin(TwoWire *theWire);
|
||||
boolean begin(TwoWire* theWire);
|
||||
boolean init();
|
||||
|
||||
/* TSL2561 Functions */
|
||||
void enableAutoRange(bool enable);
|
||||
void setIntegrationTime(tsl2561IntegrationTime_t time);
|
||||
void setGain(tsl2561Gain_t gain);
|
||||
void getLuminosity(uint16_t *broadband, uint16_t *ir);
|
||||
void getLuminosity(uint16_t* broadband, uint16_t* ir);
|
||||
uint32_t calculateLux(uint16_t broadband, uint16_t ir);
|
||||
|
||||
/* Unified Sensor API Functions */
|
||||
bool getEvent(sensors_event_t *);
|
||||
void getSensor(sensor_t *);
|
||||
bool getEvent(sensors_event_t*);
|
||||
void getSensor(sensor_t*);
|
||||
|
||||
private:
|
||||
TwoWire *_i2c;
|
||||
private:
|
||||
TwoWire* _i2c;
|
||||
|
||||
int8_t _addr;
|
||||
boolean _tsl2561Initialised;
|
||||
@@ -197,7 +197,7 @@ private:
|
||||
void write8(uint8_t reg, uint8_t value);
|
||||
uint8_t read8(uint8_t reg);
|
||||
uint16_t read16(uint8_t reg);
|
||||
void getData(uint16_t *broadband, uint16_t *ir);
|
||||
void getData(uint16_t* broadband, uint16_t* ir);
|
||||
};
|
||||
|
||||
#endif // ADAFRUIT_TSL2561_H
|
||||
|
||||
Reference in New Issue
Block a user