Loading...
Searching...
No Matches
gp2y10xx.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Locha Inc
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
37#ifndef GP2Y10XX_H
38#define GP2Y10XX_H
39
40#include <stdint.h>
41#include <stdbool.h>
42
43#include "periph/adc.h"
44#include "periph/gpio.h"
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
56#ifndef CONFIG_GP2Y10XX_MAX_READINGS
57#define CONFIG_GP2Y10XX_MAX_READINGS (10)
58#endif
59
63enum {
67};
68
80
92
96typedef struct {
99
111
121int gp2y10xx_read_density(const gp2y10xx_t *dev, uint16_t *density);
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* GP2Y10XX_H */
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:76
@ GP2Y10XX_ERR_ADC
ADC error.
Definition gp2y10xx.h:65
@ GP2Y10XX_OK
Everything is ok.
Definition gp2y10xx.h:64
@ GP2Y10XX_ERR_ILED
ILED pin error.
Definition gp2y10xx.h:66
@ GP2Y10XX_ILED_LEVEL_LOW
Active low.
Definition gp2y10xx.h:78
@ GP2Y10XX_ILED_LEVEL_HIGH
Active high.
Definition gp2y10xx.h:77
uint_fast8_t adc_t
Define default ADC type identifier.
Definition adc.h:72
adc_res_t
Possible ADC resolution settings.
Definition adc.h:93
GP2Y10xx device parameters.
Definition gp2y10xx.h:84
gp2y10xx_level_t iled_level
ILED pin level.
Definition gp2y10xx.h:90
adc_res_t adc_res
ADC line resolution.
Definition gp2y10xx.h:86
uint16_t vref
Reference voltage used for the VCC supply of the sensor, in mV.
Definition gp2y10xx.h:87
gpio_t iled_pin
ILED pin.
Definition gp2y10xx.h:89
adc_t aout
ADC line connected to device AOUT pin.
Definition gp2y10xx.h:85
GP2Y10xx device descriptor.
Definition gp2y10xx.h:96
gp2y10xx_params_t params
device driver configuration
Definition gp2y10xx.h:97