ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
Loading...
Searching...
No Matches
solenoid.c
Go to the documentation of this file.
1
13#include "solenoid.h"
14
15void SolenoidInit(void) {
16 /*
17 __HAL_RCC_GPIOA_CLK_ENABLE(); // Enable GPIOA clock
18
19 // Use Pin PA10 to toggle solenoid
20 GPIO_InitTypeDef GPIO_InitStruct = {0};
21 GPIO_InitStruct.Pin = GPIO_PIN_10;
22 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; // Push-pull output
23 GPIO_InitStruct.Pull = GPIO_NOPULL;
24 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
25
26 // Set up interrupt
27 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
28
29 // Init state of Solenoid
30 SolenoidClose();
31 Solenoid = SOLENOID_OFF;
32 */
33}
34
35void SolenoidOpen(void) {
36 /*
37 printf("SOLENOID_OPEN: Setting PA10 to HIGH (Relay ON)\n");
38 HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET); // HIGH = Relay ON
39 Solenoid = SOLENOID_ON;
40 */
41}
42
43void SolenoidClose(void) {
44 /*
45 printf("SOLENOID_CLOSE: Setting PA10 to LOW (Relay OFF)\n");
46 HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_RESET); // LOW = Relay OFF
47 Solenoid = SOLENOID_OFF;
48 */
49}
void SolenoidInit(void)
Wrapper function for the Solenoid initilization.
Definition solenoid.c:15
void SolenoidOpen(void)
Returns both the raw voltage value and a calibrated measurement from a water Flow sensor.
Definition solenoid.c:35
void SolenoidClose(void)
Read water Flow sensor and serialize measurement.
Definition solenoid.c:43
This file contains all the function prototypes for the solenoid.c file.