static LISP lani_ctl(LISP mode, LISP now) { int m = get_c_long(mode); stage_init(w_list); XtVaSetValues(w_list->ui->stage, XtNanimatorMode, m, (char *)0); return NIL; }
/** * \brief The base function to handle the driving stages for Frame and Block type * * \note * - There are 3 stages to complete an image update on COG_V230_G2 type EPD. * - For more details on the driving stages, please refer to the COG G2 document Section 5.4 * * \param EPD_type_index The defined EPD size * \param image_ptr The pointer of image array that stores image that will send to COG * \param image_data_address The address of memory that stores image * \param stage_no The assigned stage number that will proceed * \param lineoffset Line data offset */ void stage_handle_Base(uint8_t EPD_type_index,uint8_t *image_prt,long image_data_address, uint8_t stage_no,uint8_t lineoffset) { struct EPD_V230_G2_Struct S_epd_v230; int16_t cycle,m,i; //m=number of steps //uint8_t isLastframe = 0; //If it is the last frame to send Nothing at the fist scan line uint8_t isLastBlock=0; //If the beginning line of block is in active range of EPD int16_t scanline_no=0; uint8_t *action_block_prt; long action_block_address; uint8_t byte_array[LINE_BUFFER_DATA_SIZE]; /** Stage 2: BLACK/WHITE image, Frame type */ if(stage_no==Stage2) { for(i=0;i<action__Waveform_param->stage2_cycle;i++) { same_data_frame (EPD_type_index,ALL_BLACK,action__Waveform_param->stage2_t1); same_data_frame (EPD_type_index,ALL_WHITE,action__Waveform_param->stage2_t2); } return; } /** Stage 1 & 3, Block type */ // The frame/block/step of Stage1 and Stage3 are default the same. stage_init(EPD_type_index, &S_epd_v230, action__Waveform_param->stage1_block1, action__Waveform_param->stage1_step1, action__Waveform_param->stage1_frame1); /* Repeat number of frames */ for (cycle = 0; cycle < (S_epd_v230.frame_cycle ); cycle++) { // if (cycle == (S_epd_v230.frame_cycle - 1)) isLastframe = 1; isLastBlock = 0; S_epd_v230.step_y0 = 0; S_epd_v230.step_y1 = S_epd_v230.step_size ; S_epd_v230.block_y0 = 0; S_epd_v230.block_y1 = 0; /* Move number of steps */ for (m = 0; m < S_epd_v230.number_of_steps; m++) { S_epd_v230.block_y1 += S_epd_v230.step_size; S_epd_v230.block_y0 = S_epd_v230.block_y1 - S_epd_v230.block_size; /* reset block_y0=frame_y0 if block is not in active range of EPD */ if (S_epd_v230.block_y0 < S_epd_v230.frame_y0) S_epd_v230.block_y0 = S_epd_v230.frame_y0; /* if the beginning line of block is in active range of EPD */ if (S_epd_v230.block_y1 == S_epd_v230.block_size) isLastBlock = 1; if(image_prt!=NULL) { action_block_prt=(image_prt+(int)(S_epd_v230.block_y0*lineoffset)); } else if(_On_EPD_read_flash!=NULL) //Read line data in range of block, read first { action_block_address=image_data_address+(long)(S_epd_v230.block_y0*lineoffset); _On_EPD_read_flash(action_block_address,(uint8_t *)&byte_array, COG_parameters[EPD_type_index].horizontal_size); action_block_prt=(uint8_t *)&byte_array; } /* Update line data */ for (i = S_epd_v230.block_y0; i < S_epd_v230.block_y1; i++) { if (i >= COG_parameters[EPD_type_index].vertical_size) break; //if (isLastframe && if ( isLastBlock &&(i < (S_epd_v230.step_size + S_epd_v230.block_y0))) { nothing_line(EPD_type_index); } else { read_line_data_handle(EPD_type_index,action_block_prt,stage_no); } if(_On_EPD_read_flash!=NULL) //Read line data in range of block { action_block_address +=lineoffset; _On_EPD_read_flash(action_block_address,(uint8_t *)&byte_array, COG_parameters[EPD_type_index].horizontal_size); action_block_prt=(uint8_t *)&byte_array; } else action_block_prt+=lineoffset; scanline_no= (COG_parameters[EPD_type_index].vertical_size-1)-i; /* Scan byte shift per data line */ data_line_scan[(scanline_no>>2)] = SCAN_TABLE[(scanline_no%4)]; /* the border uses the internal signal control byte. */ *data_line_border_byte=0x00; /* Sending data */ epd_spi_send (0x0A, (uint8_t *)&COG_Line.uint8, COG_parameters[EPD_type_index].data_line_size); /* Turn on Output Enable */ epd_spi_send_byte (0x02, 0x07); data_line_scan[(scanline_no>>2)]=0; } } } }