name=Occupancy PYD-1698
category=HAL

# Any string is allowable here.  Generally though it is Production Ready, Test Tool, Extension Needed
qualityString=Production Ready
# This is one of the following:  productionReady, testTool, extensionNeeded
quality=production

architecture=efr32,em341,em342,em346,em351,em355,em3555,em357,em3581,em3582,em3585,em3586,em3587,em3588,em3591,em3592,em3595,em3596,em3597,em3598,simulation

description=This plugin will provide an interface for the PYD-1698 occupancy sensor.  The PYD-1698 communicates using a proprietary serial interface, so direct register access to GPIO registers and 4-10 cycle processor waits will be used to bit bang the interface.  In order to use this plugin, the following macros must be defined, preferably in the project's board.h, based on the hardware design of the application: OCCUPANCY_PYD1698_SERIN_PORT, OCCUPANCY_PYD1698_SERIN_PIN, OCCUPANCY_PYD1698_DLINK_PORT, OCCUPANCY_PYD1698_DLINK_PIN, OCCUPANCY_PYD1698_INSTALLATION_JP_PORT, OCCUPANCY_PYD1698_INSTALLATION_JP_PIN.

providedApis=occupancy, occupancy-pyd1698
api.occupancy.header=$PLUGIN/plugin-common/occupancy-pyd1698/occupancy.h
api.occupancy-pyd1698.header=$PLUGIN/plugin-common/occupancy-pyd1698/occupancy-pyd1698.h

$PLUGIN/plugin-common/occupancy-pyd1698/occupancy-pyd1698-em3xx.c   (em341,em342,em346,em351,em355,em3555,em357,em3581,em3582,em3585,em3586,em3587,em3588,em3591,em3592,em3595,em3596,em3597,em3598)
$PLUGIN/plugin-common/occupancy-pyd1698-stub/occupancy-pyd1698-stub.c               (simulation)
$PLUGIN/plugin-common/occupancy-pyd1698/occupancy-pyd1698-efr32.c   (efr32)

setup(hwConfig) {
  dependentHwConfModules=PYD1698
}

# Not included by default
includedByDefault=false

events=Notify, OccupancyTimeout, FirmwareBlindTimeout, Init

# List of callbacks implemented by this plugin
implementedCallbacks=emberAfPluginOccupancyPyd1698InitCallback

callbacks=$PLUGIN/plugin-common/occupancy-callback.info

options=threshold, blindTime, pulseCounter, windowTime, filterSource, operationMode, occupancyTimeout, occupancyCalibrationTimeout, firmwareBlindTime

threshold.name=Detection Threshold
threshold.description=The value defines the positive and negative threshold for detection. The ADC values after the BPF are compared to the threshold for counting the pulses.
threshold.type=NUMBER:0,255
threshold.default=8

blindTime.name=Hardware Blind Time
blindTime.description=The amount of time (in half seconds) during which motion detection is disabled by the PYD-1698 hardware after receiving an occupancy sensed callback
blindTime.type=NUMBER:1,16
blindTime.default=16

windowTime.name=Window Time
windowTime.description=The time window during which a series of pulses will trigger an occupancy sensed callback.  This value is in multiples of 4 seconds, total time = window time * 4s + 4s.
windowTime.type=NUMBER:0,3
windowTime.default=1

pulseCounter.name=Pulse Counter
pulseCounter.description=The number of pulses during the specified window time which will cause an occupancy sensed callback to occur.
pulseCounter.type=NUMBER:1,4
pulseCounter.default=1

filterSource.name=Filter Source
filterSource.description=The type of filtering that will be applied to the analog input to the occupancy sensor.  0 = Bandpass filter, 1 = Lowpass filter.
filterSource.type=NUMBER:0,1
filterSource.default=0

operationMode.name=Operation Mode
operationMode.description=This defines the mode of operation in which the occupancy sensed callbacks will be generated.  0 = Forced read out mode, 1 = interrupt read out mode, 2 = wake up operation mode
operationMode.type=NUMBER:0,2
operationMode.default=2

occupancyTimeout.name=Occupancy Timeout
occupancyTimeout.description=The amount of time (in minutes) after not seeing an occupancy interrupt at which point the sensor will determine that the room is not occupied.  This should be some number greater than the blind time option.
occupancyTimeout.type=NUMBER:0,65535
occupancyTimeout.default=10

occupancyCalibrationTimeout.name=Calibration Occupancy Timeout
occupancyCalibrationTimeout.description=The amount of time (in seconds) during test mode (when the calibration jumper is placed in lower position) after not seeing an occupancy interrupt at which point the sensor will determine that the room is not occupied and will blink the UI LED.
occupancyCalibrationTimeout.type=NUMBER:0,16383
occupancyCalibrationTimeout.default=8

firmwareBlindTime.name=Firmware Blind Time
firmwareBlindTime.description=The amount of time (in minutes) during which the firmware will ignore interrupts from the occupancy sensor.  This can be used to generate a large blind window than the 16 seconds available through hardware, which allows the MCU to sleep more and thus use less battery.  Assign a value of 0 to disable the firmware blind time.
firmwareBlindTime.type=NUMBER:0,65535
firmwareBlindTime.default=5
