- BLE peripheral applications - dr_piezo and bladder_patch projects Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
520 lines
18 KiB
C
520 lines
18 KiB
C
/*******************************************************************************
|
|
* @file measurements.h
|
|
* @author CandyPops Co.
|
|
* @version V1.0.0
|
|
* @date 2022-09-05
|
|
* @brief
|
|
******************************************************************************/
|
|
|
|
#ifndef _MEASUREMENTS_H__
|
|
#define _MEASUREMENTS_H__
|
|
|
|
#include "sdk_common.h"
|
|
|
|
#include <stdbool.h>
|
|
#include "nrf.h"
|
|
#include "nrf_drv_gpiote.h"
|
|
|
|
|
|
/* For NIR LED */
|
|
|
|
#define LIGHT_ON1 NRF_GPIO_PIN_MAP(0,28)
|
|
#define LIGHT_ON2 NRF_GPIO_PIN_MAP(0,29)
|
|
#define LIGHT_ON3 NRF_GPIO_PIN_MAP(0,31)
|
|
#define LIGHT_ON4 NRF_GPIO_PIN_MAP(0,19)
|
|
|
|
#define VCSEL_SW1 NRF_GPIO_PIN_MAP(1,1)
|
|
#define VCSEL_SW2 NRF_GPIO_PIN_MAP(1,2)
|
|
#define VCSEL_SW3 NRF_GPIO_PIN_MAP(1,3)
|
|
|
|
#define LED_CONFIG() nrf_gpio_cfg_output(LIGHT_ON1);\
|
|
nrf_gpio_cfg_output(LIGHT_ON2);\
|
|
nrf_gpio_cfg_output(LIGHT_ON3);\
|
|
nrf_gpio_cfg_output(LIGHT_ON4);\
|
|
nrf_gpio_cfg_output(VCSEL_SW1);\
|
|
nrf_gpio_cfg_output(VCSEL_SW2);\
|
|
nrf_gpio_cfg_output(VCSEL_SW3)
|
|
|
|
#define LED1() nrf_gpio_pin_clear(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED2() nrf_gpio_pin_clear(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED3() nrf_gpio_pin_clear(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED4() nrf_gpio_pin_clear(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED5() nrf_gpio_pin_clear(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
#define LED6() nrf_gpio_pin_clear(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
|
|
|
|
#define LED7() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_clear(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED8() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_clear(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED9() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_clear(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED10() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_clear(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED11() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_clear(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
#define LED12() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_clear(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
|
|
#define LED13() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_clear(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED14() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_clear(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED15() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_clear(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED16() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_clear(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED17() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_clear(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
#define LED18() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_clear(LIGHT_ON3);\
|
|
nrf_gpio_pin_set(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
|
|
#define LED19() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_clear(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED20() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_clear(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED21() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_clear(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED22() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_clear(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_clear(VCSEL_SW3)
|
|
|
|
#define LED23() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_clear(LIGHT_ON4);\
|
|
nrf_gpio_pin_clear(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
#define LED24() nrf_gpio_pin_set(LIGHT_ON1);\
|
|
nrf_gpio_pin_set(LIGHT_ON2);\
|
|
nrf_gpio_pin_set(LIGHT_ON3);\
|
|
nrf_gpio_pin_clear(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_clear(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
|
|
|
|
#define LED_ALLOFF() nrf_gpio_pin_clear(LIGHT_ON1);\
|
|
nrf_gpio_pin_clear(LIGHT_ON2);\
|
|
nrf_gpio_pin_clear(LIGHT_ON3);\
|
|
nrf_gpio_pin_clear(LIGHT_ON4);\
|
|
nrf_gpio_pin_set(VCSEL_SW1);\
|
|
nrf_gpio_pin_set(VCSEL_SW2);\
|
|
nrf_gpio_pin_set(VCSEL_SW3)
|
|
|
|
|
|
/* For Photo Diode */
|
|
|
|
#define MUX_EN_RDATA1 NRF_GPIO_PIN_MAP(1,6)
|
|
#define MUX_EN_RDATA2 NRF_GPIO_PIN_MAP(1,5)
|
|
#define MUX_EN_RDATA3 NRF_GPIO_PIN_MAP(1,4)
|
|
|
|
#define RDATA_SW1 NRF_GPIO_PIN_MAP(0,23)
|
|
#define RDATA_SW2 NRF_GPIO_PIN_MAP(0,22)
|
|
#define RDATA_SW3 NRF_GPIO_PIN_MAP(0,21)
|
|
|
|
#define PD_SEL1 NRF_GPIO_PIN_MAP(1,12)
|
|
#define PD_SEL2 NRF_GPIO_PIN_MAP(1,11)
|
|
#define PD_SEL3 NRF_GPIO_PIN_MAP(1,10)
|
|
|
|
#define PD_CONFIG() nrf_gpio_cfg_output(MUX_EN_RDATA1);\
|
|
nrf_gpio_cfg_output(MUX_EN_RDATA2);\
|
|
nrf_gpio_cfg_output(MUX_EN_RDATA3);\
|
|
nrf_gpio_cfg_output(RDATA_SW1);\
|
|
nrf_gpio_cfg_output(RDATA_SW2);\
|
|
nrf_gpio_cfg_output(RDATA_SW3);\
|
|
nrf_gpio_cfg_output(PD_SEL1);\
|
|
nrf_gpio_cfg_output(PD_SEL2);\
|
|
nrf_gpio_cfg_output(PD_SEL3)
|
|
|
|
#define PD1() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD2() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD3() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD4() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD5() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_set(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD6() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_set(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD7() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_set(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD8() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_set(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD9() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD10() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD11() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD12() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD13() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_set(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD14() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_set(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD15() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_set(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD16() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_set(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_clear(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD17() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_set(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD18() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_set(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD19() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_set(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
#define PD20() nrf_gpio_pin_set(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_set(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_set(RDATA_SW1);\
|
|
nrf_gpio_pin_set(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_clear(PD_SEL1);\
|
|
nrf_gpio_pin_set(PD_SEL2);\
|
|
nrf_gpio_pin_clear(PD_SEL3)
|
|
|
|
|
|
#define PD_ALLOFF() nrf_gpio_pin_clear(MUX_EN_RDATA1);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA2);\
|
|
nrf_gpio_pin_clear(MUX_EN_RDATA3);\
|
|
nrf_gpio_pin_clear(RDATA_SW1);\
|
|
nrf_gpio_pin_clear(RDATA_SW2);\
|
|
nrf_gpio_pin_clear(RDATA_SW3);\
|
|
nrf_gpio_pin_set(PD_SEL1);\
|
|
nrf_gpio_pin_set(PD_SEL2);\
|
|
nrf_gpio_pin_set(PD_SEL3)
|
|
|
|
|
|
/* For IC_NZP */
|
|
#define VCSEL_EN_PIN NRF_GPIO_PIN_MAP(1,7)
|
|
#define VCSEL_CONFIG() nrf_gpio_cfg_output(VCSEL_EN_PIN)
|
|
#define VCSEL_SW(x) if(x == true) nrf_gpio_pin_set(VCSEL_EN_PIN);\
|
|
else if(x == false) nrf_gpio_pin_clear(VCSEL_EN_PIN)
|
|
|
|
|
|
/* For AGC SW FSA5157L6X */
|
|
#define GAIN_SW_PIN NRF_GPIO_PIN_MAP(0,20)
|
|
#define GAIN_SW_CONFIG() nrf_gpio_cfg_output(GAIN_SW_PIN)
|
|
#define AGC_GAIN_SW(x) if(x == true) nrf_gpio_pin_set(GAIN_SW_PIN);\
|
|
else if(x == false) nrf_gpio_pin_clear(GAIN_SW_PIN)
|
|
|
|
#if FEATURE_FOR_SCOPE
|
|
#define ADC_CLK_18 18
|
|
#define PD_CLK_26 26
|
|
#define LED_CLK_15 15
|
|
#endif
|
|
|
|
|
|
void led_pd_gain_array_printout(void);
|
|
ret_code_t led_on(uint8_t led_index);
|
|
ret_code_t led_off(uint8_t led_index);
|
|
ret_code_t led_pd_matching_value_set(uint8_t led_index, uint8_t pd_index);
|
|
ret_code_t pd_on(uint8_t pd_index);
|
|
ret_code_t pd_off(uint8_t pd_index);
|
|
int16_t led_power_read(uint8_t led_index);
|
|
ret_code_t led_power_save_mem(uint8_t led_index, int16_t led_power);
|
|
ret_code_t led_power_set(uint8_t led_index);
|
|
ret_code_t pd_gain_set(uint8_t activated_led, uint8_t pd_index);
|
|
ret_code_t led_select(uint8_t led_index);
|
|
ret_code_t pd_select(uint8_t pd_index);
|
|
void mea_send_loop(void * p_context); /* For x ms */
|
|
void mea_send_timer_start(void);
|
|
void mea_send_timer_stop(void);
|
|
void mea_send_timer_init(void);
|
|
|
|
#endif //_MEASUREMENTS_H__
|
|
|