19 #include "led_sense.h" 21 #include "nrf_assert.h" 22 #include "simple_adc.h" 25 static uint32_t led_pin, sense_pin, off_val;
31 ASSERT(led_sense_analog_pin < SAADC_CH_PSELP_PSELP_VDD);
33 led_pin = led_out_pin;
34 off_val = led_off_val;
35 sense_pin = led_sense_analog_pin;
43 GPIO_PIN_CNF_DIR_Input,
44 GPIO_PIN_CNF_INPUT_Disconnect,
45 GPIO_PIN_CNF_PULL_Disabled,
46 GPIO_PIN_CNF_DRIVE_S0S1,
47 GPIO_PIN_CNF_SENSE_Disabled);
51 hal_gpio_cfg_output(led_pin, off_val);
uint32_t simple_adc_get_value(simple_adc_gain_t gain, simple_adc_input_t pin)
This function initializes the SAADC peripheral, gets an ADC value and then deinitializes The function...
void led_sense_init(uint32_t led_out_pin, uint32_t led_sense_analog_pin, uint32_t led_off_val)
Initialize the LED light sensing module.
#define ASSERT(expression)
Macro for runtime assertion of an expression. If the expression is false the assert_nrf_callback func...
void led_sense_cfg_input(bool is_input_on)
Configure the LED as either an light sensing input device or as an light emitting actuation device.
uint32_t led_sense_get(void)
Get the light value by measuring the voltage a LED's anode.