În desfăşurare

I have a small code snippet for graphing on a 3 " display, it is written in c I need to understand it better

I have some small code snippet

static void Scroll_ACCEL(char Adir) {

unsigned int _temp;

if (Adir == _ACCEL_UP) {

if (_disp_accel_scroll != _SCROLL_ACCEL_FIRST_LINE)

_disp_accel_scroll--;

else {

_disp_accel_scroll = _SCROLL_ACCEL_LAST_LINE - 1;

}

}

else {

if (_disp_accel_scroll != _SCROLL_ACCEL_LAST_LINE - 1)

_disp_accel_scroll++;

else {

_disp_accel_scroll = _SCROLL_ACCEL_FIRST_LINE;

}

}

Scroll(_disp_accel_scroll);

}

* Overview: Function writes new graph values on display after scrolling

* Input: accel values

* Output: Nothing

*******************************************************************************/

static void WriteGraph(TAccel_values *old, TAccel_values *new){

int temp1, temp2;

if ((_disp_accel_scroll < _SCROLL_ACCEL_LAST_LINE - 2) && (_disp_accel_scroll > _SCROLL_ACCEL_FIRST_LINE)){

TFT_Set_Pen(CL_RED, 2);

temp1 = (old->Xvalue * 30) / 256 + 90;

temp2 = (new->Xvalue * 30) / 256 + 90;

TFT_Line(temp1, _disp_accel_scroll + 2, temp2, _disp_accel_scroll + 1);

TFT_Set_Pen(CL_BLUE, 2);

temp1 = (old->Yvalue * 30) / 256 + 240;

temp2 = (new->Yvalue * 30) / 256 + 240;

TFT_Line(temp1, _disp_accel_scroll + 2, temp2, _disp_accel_scroll + 1);

TFT_Set_Pen(CL_GREEN, 2);

temp1 = (old->Zvalue * 30) / 256 + 390;

temp2 = (new->Zvalue * 30) / 256 + 390;

TFT_Line(temp1, _disp_accel_scroll + 2, temp2, _disp_accel_scroll + 1);

}

}

/*******************************************************************************

* Function Scroll_Add_Line(char ScrollDiection)

* ------------------------------------------------------------------------------

* Overview: Function rewrites one line after scrolling in order to delete overlapped line

* Input: Scroll direction

* Output: Nothing

*******************************************************************************/

static void Scroll_Add_Line(char ScrollDiection){

int i, temp;

if (ScrollDiection > 0){

temp = _disp_accel_scroll + 1;

if (temp > _SCROLL_ACCEL_LAST_LINE - 1)

temp = _SCROLL_ACCEL_FIRST_LINE;

TFT_CS = 0;

TFT_SSD1963_Set_Address_Ptr(0, temp, 480, temp);

for (i = 0; i < 480; i++)

if ((i == 90) | (i == 240) | (i == 390))

TFT_Write_Data_Ptr(CL_SILVER);

else

TFT_Write_Data_Ptr(CL_WHITE);

TFT_CS = 1;

}

}

/*******************************************************************************

* Function Accel_Stop()

* ------------------------------------------------------------------------------

* Overview: Function resets Scroll, should be called when exiting screen

* Input: Nothing

* Output: Nothing

*******************************************************************************/

void Accel_Stop(){

Scroll_Undone(_SCROLL_ACCEL_FIRST_LINE, _SCROLL_ACCEL_LAST_LINE);

}

/*******************************************************************************

* Function ACCEL_Start()

* ------------------------------------------------------------------------------

* Overview: Function Initialize I2C bus and accel module

* Input: Nothing

* Output: test status: 0 - skiped; 1 - pass; 2 - fail

*******************************************************************************/

void ACCEL_Start(char *test) {

// Reset error flag

*test = 0;

// Initialize I2C communication

I2C1_Init_Advanced(400000, &_GPIO_MODULE_I2C1_PB67);

Delay_ms(100);

// Initialize ADXL345 accelerometer

if (ADXL345_Init() == 0) {

*test = 1;

Delay_ms(500);

}

else {

*test = 2;

}

Scroll_Undone(_SCROLL_ACCEL_FIRST_LINE, _SCROLL_ACCEL_LAST_LINE);

}

Aptitudini: Programare C, Software încorporat, Arhitectură software

Despre client:
( 38 recenzii ) campbell, United States

ID Proiect: #10498221

Acordat lui:

maxbul

Hello. I will be available at 7:00 .. 20:00 GMT. Can explain it to you in chat, by voice or make advanced comments directly in the code With best regards Maxim

%selectedBids___i_sum_sub_4%%project_currencyDetails_sign_sub_5% USD în 1 zi
(16 Recenzii)
4.3

5 freelanceri licitează în medie 48$ pentru acest proiect

hbxfnzwpf

I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 6 years. My work is online game developing, and mainly focus on server side, using c++ under linux environ Mai multe

%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 2 zile
(75 recenzii)
6.5
%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 2 zile
(20 recenzii)
4.1
RobertoIV

I think I can help you if you're able to share something more about the code and what kind of microcontroller you are using

%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 3 zile
(2 recenzii)
1.9
%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(0 recenzii)
0.0