Skip to content

Commit

Permalink
Add option for third flood detector to be connected to the sensor module
Browse files Browse the repository at this point in the history
  • Loading branch information
SmejkalJakub committed Oct 31, 2023
1 parent 87c8b42 commit 9ded554
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion twr/inc/twr_flood_detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
typedef enum
{
TWR_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_A,
TWR_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_B
TWR_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_B,
TWR_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_C

} twr_flood_detector_type_t;

Expand Down
21 changes: 21 additions & 0 deletions twr/src/twr_flood_detector.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ static void _twr_flood_task_measure(void *param)
twr_gpio_set_mode(TWR_GPIO_P5, TWR_GPIO_MODE_INPUT);
break;
}
case TWR_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_C:
{
if (!twr_module_sensor_init())
{
goto start;
}
twr_module_sensor_set_vdd(true);
twr_gpio_init(TWR_GPIO_P7);
twr_gpio_set_mode(TWR_GPIO_P7, TWR_GPIO_MODE_INPUT);
break;
}
default:
{
goto start;
Expand Down Expand Up @@ -147,6 +158,11 @@ static void _twr_flood_task_measure(void *param)
twr_scheduler_plan_current_from_now(5);
break;
}
case TWR_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_C:
{
twr_scheduler_plan_current_from_now(5);
break;
}
default:
{
goto start;
Expand Down Expand Up @@ -182,6 +198,11 @@ static void _twr_flood_task_measure(void *param)
}
break;
}
case TWR_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_C:
{
self->_alarm = twr_gpio_get_input(TWR_GPIO_P7) == 1;
break;
}
default:
{
goto start;
Expand Down

0 comments on commit 9ded554

Please sign in to comment.