This example demonstrates the usage of the nPZero driver to setup the ADC and there threshould's. Booth ADC's (Internal and External) are set in the example code, the ADC_IN pin for this example is connected to VDD.
Code snippet ...
#include "example_adc.h"
#include "../../Drivers/nPZero_Driver/Inc/np0_device_control.h"
#include <stdio.h>
.over_threshold = 0x0B,
.under_threshold = 0x06,
};
.over_threshold = 0x2D,
.under_threshold = 0x26,
};
.power_switch_normal_mode_per1 = 0,
.power_switch_normal_mode_per2 = 0,
.power_switch_normal_mode_per3 = 0,
.power_switch_normal_mode_per4 = 0,
.power_switch_gate_boost_host = 0,
.power_switch_gate_boost_peripherals = 0,
.io_strength = IO_STR_NORMAL,
.i2c_pull_mode = I2C_PULL_DISABLE,
.spi_auto = SPI_PINS_ALWAYS_ON,
.wake_up_per1 = 0,
.wake_up_per2 = 0,
.wake_up_per3 = 0,
.wake_up_per4 = 0,
.global_timeout = 0x0BB8,
.adc_ext_sampling_enable =
ENABLED,
.adc_channels = {0, &adc_ext_channel_2},
.peripheral = {0, 0, 0, 0},
};
.power_switch_normal_mode_per1 = 0,
.power_switch_normal_mode_per2 = 0,
.power_switch_normal_mode_per3 = 0,
.power_switch_normal_mode_per4 = 0,
.power_switch_gate_boost_host = 0,
.power_switch_gate_boost_peripherals = 0,
.io_strength = IO_STR_NORMAL,
.i2c_pull_mode = I2C_PULL_DISABLE,
.spi_auto = SPI_PINS_ALWAYS_ON,
.wake_up_per1 = 0,
.wake_up_per2 = 0,
.wake_up_per3 = 0,
.wake_up_per4 = 0,
.global_timeout = 0x0BB8,
.adc_ext_sampling_enable = 0,
.adc_channels = {&adc_int_channel_1, 0},
.peripheral = {0, 0, 0, 0},
};
{
printf("Executing external ADC example\r\n");;
*np0_config = np0_config_ext_adc;
}
{
printf("Executing internal ADC example\r\n");;
*np0_config = np0_config_int_adc;
}
*
@ ADC_CLK_256
Definition: np0.h:138
@ INT_PIN_PULL_DISABLED
Definition: np0.h:180
@ SYS_CLOCK_10HZ
Definition: np0.h:119
@ SCLK_DIV_DISABLE
Definition: np0.h:126
@ HOST_POWER_MODE_LOGIC_OUTPUT
Definition: np0.h:40
@ ENABLED
Definition: np0.h:157
@ WAKEUP_ANY
Definition: np0.h:201
@ XO_CLK_OFF
Definition: np0.h:145
void np0_device_configure(np0_device_config_s *device_config)
Setup np0 device configuration.
uint8_t wakeup_enable
Definition: np0.h:523
np0_host_power_mode_e host_power_mode
Definition: np0.h:603