Loading...
Searching...
No Matches
gp2y10xx.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Locha Inc
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
35
36#include <stdint.h>
37#include <stdbool.h>
38
39#include "periph/adc.h"
40#include "periph/gpio.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
52#ifndef CONFIG_GP2Y10XX_MAX_READINGS
53#define CONFIG_GP2Y10XX_MAX_READINGS (10)
54#endif
55
59enum {
63};
64
76
88
92typedef struct {
95
107
117int gp2y10xx_read_density(const gp2y10xx_t *dev, uint16_t *density);
118
119#ifdef __cplusplus
120}
121#endif
122
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.
int gp2y10xx_read_density(const gp2y10xx_t *dev, uint16_t *density)
Read a raw ADC value.
int gp2y10xx_init(gp2y10xx_t *dev, const gp2y10xx_params_t *params)
Initialize an GP2Y10xx device.
gp2y10xx_level_t
ILED pin level.
Definition gp2y10xx.h:72
@ GP2Y10XX_ERR_ADC
ADC error.
Definition gp2y10xx.h:61
@ GP2Y10XX_OK
Everything is ok.
Definition gp2y10xx.h:60
@ GP2Y10XX_ERR_ILED
ILED pin error.
Definition gp2y10xx.h:62
@ GP2Y10XX_ILED_LEVEL_LOW
Active low.
Definition gp2y10xx.h:74
@ GP2Y10XX_ILED_LEVEL_HIGH
Active high.
Definition gp2y10xx.h:73
uint_fast8_t adc_t
Define default ADC type identifier.
Definition adc.h:68
adc_res_t
Possible ADC resolution settings.
Definition adc.h:89
GP2Y10xx device parameters.
Definition gp2y10xx.h:80
gp2y10xx_level_t iled_level
ILED pin level.
Definition gp2y10xx.h:86
adc_res_t adc_res
ADC line resolution.
Definition gp2y10xx.h:82
uint16_t vref
Reference voltage used for the VCC supply of the sensor, in mV.
Definition gp2y10xx.h:83
gpio_t iled_pin
ILED pin.
Definition gp2y10xx.h:85
adc_t aout
ADC line connected to device AOUT pin.
Definition gp2y10xx.h:81
GP2Y10xx device descriptor.
Definition gp2y10xx.h:92
gp2y10xx_params_t params
device driver configuration
Definition gp2y10xx.h:93