1 #ifndef __CARME_IO2_H__
2 #define __CARME_IO2_H__
77 #include <stm32f4xx.h>
81 #define CARME_ERROR_IO2_NO_DATA (CARME_ERROR_IO2_BASE + 0)
82 #define CARME_ERROR_IO2_PWM_WRONG_CHANNEL (CARME_ERROR_IO2_BASE + 1)
84 #define CARME_IO2_GPIO_OUT_PIN0 0x1
85 #define CARME_IO2_GPIO_OUT_PIN1 0x2
86 #define CARME_IO2_GPIO_OUT_PIN2 0x4
89 #define CARME_IO2_LTC2622_CMD_W 0x00
90 #define CARME_IO2_LTC2622_CMD_Un 0x01
91 #define CARME_IO2_LTC2622_CMD_WUa 0x02
92 #define CARME_IO2_LTC2622_CMD_WUn 0x03
93 #define CARME_IO2_LTC2622_CMD_Off 0x04
94 #define CARME_IO2_LTC2622_CMD_None 0xFF
97 #define CARME_IO2_LTC2622_ADDR_A 0x00
98 #define CARME_IO2_LTC2622_ADDR_B 0x01
99 #define CARME_IO2_LTC2622_ADDR_ALL 0x0F
_CARME_IO2_DAC_CHANNEL
DAC port names.
_CARME_IO2_PWM_CHANNEL
PWM port names.
uint8_t ERROR_CODES
Error variable.
void CARME_IO2_GPIO_OUT_Settings(uint8_t pin, CARME_IO2_GPIO_OUT_MODE mode)
Configure the CARME IO2 GPIO Out 0..2 as GPIO or PWM.
#define CARME_IO2_LTC2622_ADDR_B
void CARME_IO2_SPI_CS_Out(uint8_t cs)
Generate the chip select pin.
enum _CARME_IO2_SPI_CHANNEL CARME_IO2_SPI_CHANNEL
ADC port names.
void CARME_IO2_GPIO_IN_Get(uint8_t *pStatus)
Get the GPIO In 0..3 value.
void CARME_IO2_Init(void)
CARME IO2 initialization.
void CARME_IO2_GPIO_OUT_Set(uint8_t Status)
Set the GPIO Out 0..3 value.
void CARME_IO2_ADC_Get(CARME_IO2_ADC_CHANNEL channel, uint16_t *pValue)
Get the value of an ADC channel.
TIM Time Base Init structure definition.
void CARME_IO2_OPTO_OUT_Set(uint8_t Status)
Set the OPTO Out 0..1 value.
enum _CARME_IO2_PWM_PHASE CARME_IO2_PWM_PHASE
DC motor direction.
_CARME_IO2_SPI_CHANNEL
ADC port names.
_CARME_IO2_ADC_CHANNEL
ADC port names.
enum _CARME_IO2_GPIO_OUT_MODE CARME_IO2_GPIO_OUT_MODE
GPIO Out mode definitions.
void CARME_IO2_SPI_Send(uint16_t data)
Send a half word over the SPI port.
#define CARME_IO2_LTC2622_ADDR_A
void CARME_IO2_SPI_Select(CARME_IO2_SPI_CHANNEL select)
Select the peripheral SPI chip.
void CARME_IO2_DAC_Set(CARME_IO2_DAC_CHANNEL channel, uint16_t Value)
Set the value of an DAC channel.
ERROR_CODES CARME_IO2_PWM_Set(CARME_IO2_PWM_CHANNEL channel, uint16_t value)
Set the PWM time base settings.
#define CARME_IO2_LTC2622_ADDR_ALL
enum _CARME_IO2_PWM_CHANNEL CARME_IO2_PWM_CHANNEL
PWM port names.
void CARME_IO2_PWM_Settings(TIM_TimeBaseInitTypeDef *pTIM_TimeBaseStruct)
Set the PWM time base settings.
enum _CARME_IO2_ADC_CHANNEL CARME_IO2_ADC_CHANNEL
ADC port names.
void CARME_IO2_PWM_Phase(CARME_IO2_PWM_PHASE dir)
Set the DC motor direction.
_CARME_IO2_GPIO_OUT_MODE
GPIO Out mode definitions.
void CARME_IO2_OPTO_IN_Get(uint8_t *pStatus)
Get the OPTO In 0..1 value.
void CARME_IO2_SPI_Receive(uint16_t *pValue)
Receive a half word from the SPI input buffer.
_CARME_IO2_PWM_PHASE
DC motor direction.
enum _CARME_IO2_DAC_CHANNEL CARME_IO2_DAC_CHANNEL
DAC port names.