108 lines
2.8 KiB
C
108 lines
2.8 KiB
C
#include "Arduino.h"
|
|
#ifndef FT18_STW_Init
|
|
#define FT18_STW_Init
|
|
|
|
#define l 78 // test_led
|
|
#define led1 12 // PD8
|
|
#define led2 11 // PD7
|
|
#define led3 9 // PC21
|
|
#define led4 8 // PC22
|
|
#define led5 7 // PC23
|
|
#define led6 6 // PC24
|
|
#define led7 5 // PC25
|
|
#define led8 4 // PC26 und PA29
|
|
#define led9 3 // PC28
|
|
#define led10 2 // PB25
|
|
#define led11 10 // PC29 und PA28
|
|
#define led12 22 // PB26
|
|
#define led13 19 // PA10
|
|
#define led14 13 // PB27
|
|
#define led15 17 // PA12
|
|
#define led16 18 // PA11
|
|
#define button1 48 // bl
|
|
#define button2 47 // gl
|
|
#define button3 44 // gr
|
|
#define button4 46 // br
|
|
#define button5 45 // sl
|
|
#define button6 49 // sr
|
|
#define enc1PinA 37
|
|
#define enc1PinB 38
|
|
#define enc1PinS 35
|
|
#define enc2PinA 40
|
|
#define enc2PinB 41
|
|
#define enc2PinS 39
|
|
|
|
// define Drehzahlgrenzen TODOOOO
|
|
#define RPM_THRES_1 6000
|
|
#define RPM_THRES_2 12000
|
|
#define RPM_THRES_3 12800
|
|
#define RPM_THRES_4 13600
|
|
#define RPM_THRES_5 14400
|
|
#define RPM_THRES_6 15200
|
|
#define RPM_THRES_7 16000
|
|
#define RPM_THRES_8 16800
|
|
#define RPM_THRES_9 18000
|
|
#define RPM_THRES_10 18000
|
|
|
|
void set_pins(void);
|
|
void read_buttons(void);
|
|
void read_rotary(void); // read rotary switches
|
|
|
|
typedef struct {
|
|
uint8_t Stw_shift_up; // 1 Bit 0
|
|
uint8_t Stw_shift_down; // 1 Bit 1
|
|
uint8_t Stw_neutral; // 1 Bit 2
|
|
uint8_t Stw_auto_shift; // 1 Bit 3
|
|
uint8_t buttonState1; // 1 Bit 4
|
|
uint8_t buttonState4; // 1 Bit 5
|
|
// bool CAN_toggle;
|
|
// bool CAN_check;
|
|
// uint8_t i; //Index
|
|
// linker Drehschalter
|
|
uint8_t buttonStateEnc1; // button
|
|
// uint8_t br; //test
|
|
// mode : mittlere Drehschalter position
|
|
uint8_t buttonStateEnc2; // button
|
|
uint8_t displayindex; // index für Displayanzeige
|
|
uint8_t error_type; // Extrainfos über Error-LED
|
|
uint8_t trc;
|
|
uint8_t mode;
|
|
|
|
uint8_t button1_rises;
|
|
uint8_t button4_rises;
|
|
uint8_t enc1_rises;
|
|
uint8_t enc2_rises;
|
|
} stw_data_type;
|
|
|
|
typedef struct {
|
|
uint8_t e_thro; // E-Drossel
|
|
uint8_t g_auto; // Auto-Shift
|
|
uint8_t gear; // Gang
|
|
uint16_t revol; // Drehzahl
|
|
uint8_t t_oil; // Öl-Motor-Temperatur
|
|
uint8_t t_mot; // Wasser-Motor-Temperatur
|
|
uint8_t t_air; // LLK-Temperatur
|
|
uint8_t t_tfl; // Tire temp front left
|
|
uint8_t t_tfr; // Tire temp front right
|
|
uint8_t t_trl; // Tire temp rear left
|
|
uint8_t t_trr; // Tire temp rear right
|
|
uint8_t u_batt; // Batteriespannung
|
|
uint8_t rev_lim; // Drehzahllimit Bit
|
|
bool drs_active; // DRS status from BCU
|
|
bool autoshift; // Autoshift status from BCU
|
|
uint8_t p_wat;
|
|
uint8_t p_fuel;
|
|
uint8_t p_oil;
|
|
uint8_t p_brake_front;
|
|
uint8_t p_brake_rear;
|
|
uint8_t speed_fl;
|
|
uint8_t speed_fr;
|
|
uint8_t speed;
|
|
uint8_t lap_time_sec;
|
|
uint16_t lap_time_msec;
|
|
} vehicle_data_type;
|
|
|
|
extern volatile stw_data_type Stw_data;
|
|
extern volatile vehicle_data_type Vehicle_data;
|
|
|
|
#endif |