From 3973d7b41d406f87a5b6a6d2a3b3e60e035c5f8d Mon Sep 17 00:00:00 2001 From: Erick Ahmed Date: Thu, 15 May 2025 22:40:52 +0200 Subject: [PATCH] Initialize pumps' digital pins --- firmware/atmega/include/pump.h | 8 ++++++++ firmware/atmega/source/pump.c | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 firmware/atmega/include/pump.h create mode 100644 firmware/atmega/source/pump.c diff --git a/firmware/atmega/include/pump.h b/firmware/atmega/include/pump.h new file mode 100644 index 0000000..74e2dee --- /dev/null +++ b/firmware/atmega/include/pump.h @@ -0,0 +1,8 @@ +#include +#include +#include +#include +#include "config.h" + +void pumpsInit(void); +void pumpsTrigger(uint8_t digital_pins, int16_t milliseconds); diff --git a/firmware/atmega/source/pump.c b/firmware/atmega/source/pump.c new file mode 100644 index 0000000..36829d3 --- /dev/null +++ b/firmware/atmega/source/pump.c @@ -0,0 +1,26 @@ +#include +#include +#include + +void pumpsInit(void) { + // Set as input + DDRD &= ~((1 << PUMP_D7) | + (1 << PUMP_D6) | + (1 << PUMP_D5) | + (1 << PUMP_D4) | + (1 << PUMP_D3) | + 0 | 0 | 0 )); + // Disable pullup + PORTD &= ~((1 << PUMP_D7) | + (1 << PUMP_D6) | + (1 << PUMP_D5) | + (1 << PUMP_D4) | + (1 << PUMP_D3) | + 0 | 0 | 0 )); +} + +void triggerPump(int8_t pump_pin, int16_t milliseconds) { + // turn on pump + // watchdog for n milliseconds + // turn of pump +}