Em Andamento

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);

}

Habilidades: Programação C, Software Integrado, Arquitetura de software

Ver mais: int i, graphing in c, graph in c, c graphing, better product display, customer display source code, image display source code, need 1000 articles written, small code projects, better quality oscommerce small images, need 100 articles written, need wikipedia article written, need sales page written, sam heuston, setup shoutcast sam broadcaster, setup shoutcast sam broadcast, sam mitchell web, sam mitchell web programmer, shoutcast radio sam broadcaster, sam inc jalemaida, setup sam broadcaster php web, need blog posts written, shoutcast sam, yahoo current email address ofmr sam usa 2008

Acerca do Empregador:
( 38 comentários ) campbell, United States

ID do Projeto: #10498221

Premiar a:

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

$25 USD em 1 dia
(16 Avaliações)
4.3

5 freelancers estão ofertando em média $48 para este trabalho

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 Mais

$80 USD in 2 dias
(75 Comentários)
6.5
$77 USD in 2 dias
(20 Comentários)
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

$35 USD in 3 dias
(2 Comentários)
1.9
$25 USD em 1 dia
(0 Comentários)
0.0