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
9#pragma once
10
38
39#include <stdint.h>
40#include <stdbool.h>
41
42#include "periph/adc.h"
43#include "periph/gpio.h"
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
55#ifndef CONFIG_GP2Y10XX_MAX_READINGS
56#define CONFIG_GP2Y10XX_MAX_READINGS (10)
57#endif
58
62enum {
66};
67
79
91
95typedef struct {
98
110
120int gp2y10xx_read_density(const gp2y10xx_t *dev, uint16_t *density);
121
122#ifdef __cplusplus
123}
124#endif
125
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:75
@ GP2Y10XX_ERR_ADC
ADC error.
Definition gp2y10xx.h:64
@ GP2Y10XX_OK
Everything is ok.
Definition gp2y10xx.h:63
@ GP2Y10XX_ERR_ILED
ILED pin error.
Definition gp2y10xx.h:65
@ GP2Y10XX_ILED_LEVEL_LOW
Active low.
Definition gp2y10xx.h:77
@ GP2Y10XX_ILED_LEVEL_HIGH
Active high.
Definition gp2y10xx.h:76
uint_fast8_t adc_t
Define default ADC type identifier.
Definition adc.h:71
adc_res_t
Possible ADC resolution settings.
Definition adc.h:92
GP2Y10xx device parameters.
Definition gp2y10xx.h:83
gp2y10xx_level_t iled_level
ILED pin level.
Definition gp2y10xx.h:89
adc_res_t adc_res
ADC line resolution.
Definition gp2y10xx.h:85
uint16_t vref
Reference voltage used for the VCC supply of the sensor, in mV.
Definition gp2y10xx.h:86
gpio_t iled_pin
ILED pin.
Definition gp2y10xx.h:88
adc_t aout
ADC line connected to device AOUT pin.
Definition gp2y10xx.h:84
GP2Y10xx device descriptor.
Definition gp2y10xx.h:95
gp2y10xx_params_t params
device driver configuration
Definition gp2y10xx.h:96