rusefi-1/firmware/controllers/system/efiGpio.h

44 lines
1014 B
C
Raw Normal View History

2014-09-26 06:02:50 -07:00
/**
* @file efiGpio.h
*
* @date Sep 26, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#ifndef EFIGPIO_H_
#define EFIGPIO_H_
#include "main.h"
2014-09-27 12:03:45 -07:00
#include "io_pins.h"
2014-09-26 06:02:50 -07:00
/**
* @brief Single output pin reference and state
*/
typedef struct {
#if EFI_PROD_CODE
GPIO_TypeDef *port;
int pin;
#endif /* EFI_PROD_CODE */
/**
* we track current pin status so that we do not touch the actual hardware if we want to write new pin bit
* which is same as current pin value. This maybe helps in case of status leds, but maybe it's a total over-engineering
*/
int currentLogicValue;
} OutputPin;
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
int getLogicPinValue(OutputPin * outputPin);
2014-09-27 12:03:45 -07:00
int getOutputPinValue(io_pin_e pin);
int getElectricalValue(int logicalValue, pin_output_mode_e mode);
2014-09-27 15:03:08 -07:00
void setOutputPinValue(io_pin_e pin, int logicValue);
void setPinValue(OutputPin * outputPin, int electricalValue, int logicValue);
2014-09-26 06:02:50 -07:00
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* EFIGPIO_H_ */