FSM thermostat
port_led.c
Go to the documentation of this file.
1 
7 /* Standard C includes */
8 #include <stdio.h>
9 #include <math.h>
10 
11 /* HW dependent includes */
12 #include "stm32f4xx.h"
13 #include "port_led.h"
14 #include "port_system.h"
15 
16 /* Global variables -----------------------------------------------------------*/
20 
22 {
23  return (p_led->p_port->IDR & BIT_POS_TO_MASK(p_led->pin)) != 0;
24 }
25 
27 {
28  p_led->p_port->ODR |= BIT_POS_TO_MASK(p_led->pin);
29 }
30 
32 {
33  p_led->p_port->ODR &= ~BIT_POS_TO_MASK(p_led->pin);
34 }
35 
37 {
38  p_led->p_port->ODR ^= BIT_POS_TO_MASK(p_led->pin);
39 }
40 
42 {
44 }
GPIO_MODE_OUT
#define GPIO_MODE_OUT
Definition: port_system.h:43
LED_HEAT_GPIO
#define LED_HEAT_GPIO
Definition: port_led.h:19
port_led_on
void port_led_on(port_led_hw_t *p_led)
Turn on the LED.
Definition: port_led.c:26
port_led_off
void port_led_off(port_led_hw_t *p_led)
Turn off the LED.
Definition: port_led.c:31
GPIO_PUPDR_NOPULL
#define GPIO_PUPDR_NOPULL
Definition: port_system.h:47
port_led_toggle
void port_led_toggle(port_led_hw_t *p_led)
Toggles the LED state.
Definition: port_led.c:36
LED_COMFORT_GPIO
#define LED_COMFORT_GPIO
Definition: port_led.h:21
port_led_hw_t
Structure to define the HW dependencies of a LED.
Definition: port_led.h:30
led_heater_active
port_led_hw_t led_heater_active
Definition: port_led.c:17
port_led_get_status
bool port_led_get_status(port_led_hw_t *p_led)
Returns the current state of the LED.
Definition: port_led.c:21
port_led.h
Header file for the LED port layer.
led_comfort_temperature
port_led_hw_t led_comfort_temperature
Definition: port_led.c:18
port_led_hw_t::pin
uint8_t pin
Definition: port_led.h:33
port_led_hw_t::p_port
GPIO_TypeDef * p_port
Definition: port_led.h:32
port_system.h
Header for port_system.c file.
LED_COMFORT_PIN
#define LED_COMFORT_PIN
Definition: port_led.h:22
port_system_gpio_config
void port_system_gpio_config(GPIO_TypeDef *p_port, uint8_t pin, uint8_t mode, uint8_t pupd)
Configure the mode and pull of a GPIO.
Definition: port_system.c:158
LED_HEAT_PIN
#define LED_HEAT_PIN
Definition: port_led.h:20
LED_ON_PIN
#define LED_ON_PIN
Definition: port_led.h:24
BIT_POS_TO_MASK
#define BIT_POS_TO_MASK(x)
Definition: port_system.h:22
port_led_init
void port_led_init(port_led_hw_t *p_led)
Initializes the LED.
Definition: port_led.c:41
led_on
port_led_hw_t led_on
Definition: port_led.c:19
LED_ON_GPIO
#define LED_ON_GPIO
Definition: port_led.h:23