dev: add interface for opt4048 lux/colour sensor
This commit is contained in:
parent
9c389117c4
commit
93788beab4
3 changed files with 115 additions and 0 deletions
23
include/opt4048.h
Normal file
23
include/opt4048.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
// SPDX-FileCopyrightText: 2026 A.M. Rowsell <amr@frzn.dev>
|
||||
|
||||
#ifndef OPT4048_H
|
||||
#define OPT4048_H
|
||||
|
||||
#include "hardware/i2c.h"
|
||||
|
||||
#define OPT_ADDR 0x44
|
||||
|
||||
/* Structure to hold the calculated color and lux data */
|
||||
typedef struct {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float lux;
|
||||
} OPT4048_Data;
|
||||
|
||||
OPT4048_Data calculate_color_data(float ch0, float ch1, float ch2);
|
||||
int initOPT(i2c_inst_t *i2c);
|
||||
int getOPTData(i2c_inst_t *i2c, float *ch0, float *ch1, float *ch2);
|
||||
|
||||
#endif // OPT4048_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue