#ifndef __STM32F103_H__
#define __STM32F103_H__
#include "tc_system.h"
#include "com_CAN.h"

typedef struct stm32f103
{
    pthread_mutex_t mutex;
    int quit;
    
    com_can_t can;

    uint8_t SA;
    uint8_t DA;

    uint32_t count;
    uint8_t GUNA_State;
    uint8_t GUNB_State;

    uint32_t voltage[4];
    uint8_t state[4];
    uint8_t bitcode;
    uint8_t led[4];
}stm32f103_t;

int ccu_STM32_init(stm32f103_t* dev, const char* name, const int bitrate, int enable);

void ccu_STM32_exit(stm32f103_t* dev);

void* ccu_STM32_loop(void* argv);

int ccu_STM32_TransmitVoltage(stm32f103_t* dev, int enable);

int ccu_STM32_TransmitState(stm32f103_t* dev, int enable);

int ccu_STM32_ControlContactor(stm32f103_t* dev, int idx, int enable);

int ccu_STM32_ControlLED(stm32f103_t* dev, int idx, int enable);

#endif//__STM32F103_H__
