/********************* (C) COPYRIGHT RAISONANCE S.A.S. *********************************/
/********************* (C) COPYRIGHT STMicroelectronics ********************************/
/********************* (C) Matthias ****************************************************/
/* optimized for PRIMER2, extended and amended by Matthias email webmaster@tg-info.de
/* Thanks to "ntrf.zns"
Project "Primer2 without Circle OS"
What goes
- LEds
- TouchScreen
- Joystick
- CAN
- Vbat
- Temp sensor
- Battery Status
- Shutdown
- 3 axis acceleration sensor
- Backlight ON/Off
- Display
- More fronts generate with "Primer_Fonts_V1.1.xls"
- Background image Background image is "Pictures/bmp_background_image.h" generate with "Create_background_image.xls"
- Symbols images with Transparent generate with "Create_BMP_header.xls"
What must be done before / I'll do yet
- Backlight Dimming
- LED irda
what's missing, but I would not make
- TouchScreen Calibration
/* ------------------------------------------------------------------------------------*/
/* Functions and Variable Description */
/* ------------------------------------------------------------------------------------*/
/* -------- AccelSensor.c -------------------------------------------------------------*/
extern void AccelSensor_Init_Sensor(void); // needs to be started once
extern void AccelSensor_Read_Sensor(void); // After the call the following variables are set
extern s16 AccelSensor_X_Roh_s16; // Accel Sensor X unfiltered
extern s16 AccelSensor_Y_Roh_s16; // Accel Sensor Y unfiltered
extern s16 AccelSensor_Z_Roh_s16; // Accel Sensor Z unfiltered
extern s16 AccelSensor_X_Fil_s16; // Accel Sensor X filtered
extern s16 AccelSensor_Y_Fil_s16; // Accel Sensor Y filtered
extern s16 AccelSensor_Z_Fil_s16; // Accel Sensor Z filtered
/* ------------------------------------------------------------------------------------*/
/* -------- BackLight.c ---------------------------------------------------------------*/
extern void BackLight_On(void); // turn on the LCD backlight
extern void BackLight_Off(void); // turn off the LCD backlight
/* ------------------------------------------------------------------------------------*/
/* -------- BatteryStatus.c -----------------------------------------------------------*/
extern void BatteryStatus_Read_Status(void); // After the call the following variables are set
extern u8 BatteryStatus_Status_u08; // Battery Status 0=Battery_absent , 1=Battery_Charge_done 2=Battery_Charge_in_progress 3=Battery_Stand_By_mode
/* ------------------------------------------------------------------------------------*/
/* -------- CAN.c ---------------------------------------------------------------------*/
extern void CAN_Receive_Messages_Interrupt(void); // Interrupt when message is received can
/* ------------------------------------------------------------------------------------*/
/* -------- CAN_Debug.c ---------------------------------------------------------------*/
extern void CAN_Debug_Send_All_Primer_Data(void); // Sends several can messages with the sensors values
/* ------------------------------------------------------------------------------------*/
/* -------- Configuration.c -----------------------------------------------------------*/
extern void Configuration_RCC(void); // The name says it all
extern void Configuration_GPIO(void); // The name says it all
extern void Configuration_NVIC(void); // The name says it all
extern void Configuration_SysTick(void); // The name says it all
extern void Configuration_ADC(void); // The name says it all
extern void Configuration_SPI(void); // The name says it all
extern void Configuration_CAN(void); // The name says it all
/* ------------------------------------------------------------------------------------*/
/* -------- _Font/Font.c --------------------------------------------------------------*/
extern void Font_Set_Font_u8( u8 Font ); // to change the font
#define Font_7x8 1 // available fonts
#define Font_7x11 2 // available fonts
#define Font_10x16 3 // available fonts
#define Font_16x16 4 // available fonts
#define Font_Symbols 5 // available fonts
#define Font_BigNumber 6 // available fonts
#define Font_Primer 0 // available fonts
extern u8 Font_Width_u08; // Font width of the selected font
extern u8 Font_Height_u08; // Font height of the selected font
extern u8 Font_Starts_u08; // first sign of the selected font
extern u8 Font_Ends_u08; // last character of the selected font
extern u8 Font_Scale_u08; // Scale of the selected font
extern bool Font_Transparent_Bol; // if true, the background image is not overwritten. Background image is "Pictures/bmp_background_image.h generate" with "Create_background_image.xls"
extern u16 Font_Text_Color_u16; // Text color of the selected font
extern u16 Font_BGnd_Color_u16; // Background color of the selected font
extern u8* Font_Character_Table_P08; // pointer on the current font
/* ------------------------------------------------------------------------------------*/
/* -------- Joystick.c ---------------------------------------------------*/
extern void Joystick_Read_Joy(void); // After the call the following variables are set
extern u8 Joystick_Up____Counter_u08; // press in the variable increased by one, so that the press time can be evaluated (max 250)
extern u8 Joystick_Down__Counter_u08; // press in the variable increased by one, so that the press time can be evaluated (max 250)
extern u8 Joystick_Right_Counter_u08; // press in the variable increased by one, so that the press time can be evaluated (max 250)
extern u8 Joystick_Left__Counter_u08; // press in the variable increased by one, so that the press time can be evaluated (max 250)
extern u8 Joystick_Push__Counter_u08; // press in the variable increased by one, so that the press time can be evaluated (max 250)
/* ------------------------------------------------------------------------------------*/
/* -------- Lcd.c ---------------------------------------------------------------------*/
extern void LCD_Init(void); // needs to be started once
extern void LCD_Draw_Surface ( u8 x , u8 y , u8 width, u8 height, u16 color ); // drawing surface
extern void LCD_Draw_Rectangle ( u8 x , u8 y , u8 width, u8 height, u16 color ); // drawing rectangle
extern void LCD_Draw_Line ( u8 x1, u8 y1, u8 x2 , u8 y2 , u16 color ); // Draw line
extern void LCD_Delite_Line ( u8 x1, u8 y1, u8 x2 , u8 y2 ); // restore delete line painted against the background image
extern void LCD_Draw_BW_Image ( u8 x , u8 y , u8 width, u8 height, const u8* imageptr ); // draw black and white picture
extern void LCD_Draw_Color_Image( u8 x , u8 y , u8 width, u8 height, const u16* imageptr ); // Draw color image
extern void LCD_Write_Text ( u8 x , u8 y , const u8* Text, u8 Text_Len ); // Write text, textsetup see Font.c
/* ------------------------------------------------------------------------------------*/
/* -------- Led.c ---------------------------------------------------------------------*/
extern void Led_Set_Value_u8(u8 Value); // Bit 0 is green, Bit 1 is red
extern void Led_Green_On(void); // The name says it all
extern void Led_Green_OFF(void); // The name says it all
extern void Led_Red_On(void); // The name says it all
extern void Led_Red_OFF(void); // The name says it all
extern void Led_Green_and_Red_On(void); // The name says it all
extern void Led_Green_and_Red_Off(void); // The name says it all
/* ------------------------------------------------------------------------------------*/
/* -------- Main.c --------------------------------------------------------------------*/
extern bool Main_System_Init_Finished_Bol; // Once all configuration is done it is set to true
/* ------------------------------------------------------------------------------------*/
/* -------- Shutdown.c ----------------------------------------------------------------*/
extern void Shutdown_Me(void); // After the call, the primer off
/* ------------------------------------------------------------------------------------*/
/* -------- Task.c --------------------------------------------------------------------*/
extern void Task_delay_ms(volatile uint32_t nTime); // ms delay function
/* ------------------------------------------------------------------------------------*/
/* -------- TempSensor.c --------------------------------------------------------------*/
extern void TempSensor_Read_Sensor(void); // After the call the following variables are set
extern s16 TempSensor_Value_Fil_s16; // Temperature filter 100 corresponds to 10 degrees
extern s16 TempSensor_Value_Roh_s16; // Temperature unfiltered
extern u16 TempSensor_Value_Spg_u16; // Voltage sensor unfiltered
/* ------------------------------------------------------------------------------------*/
/* -------- TouchScreen.c -------------------------------------------------------------*/
extern void TouchScreen_Read_Touch(void); // After the call the following variables are set
extern u8 TouchScreen_X_Pos_u08; // The name says it all
extern u8 TouchScreen_Y_Pos_u08; // The name says it all
extern bool TouchScreen_Press_Bol; // True if press
/* ------------------------------------------------------------------------------------*/
/* -------- Vbat.c --------------------------------------------------------------------*/
extern void Vbat_Read_Vbat(void); // After the call the following variables are set
extern u16 Vbat_mV_Fil_u16; // Vbatt filtered
extern u16 Vbat_mV_Roh_u16; // Vbatt unfiltered