EPD Extension Kit for MSP430 LaunchPad

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
Mem_Flash.c File Reference

The functions of working with flash memory. More...

`#include "Mem_Flash.h"`

## Functions
void | Flash_cs_high (void)
| Set Flash_CS pin to high and EPD_CS to low.
void | Flash_cs_low (void)
| Set EPD_CS to high and Flash_CS to low.
void | Flash_init (void)
uint8_t | is_flash_existed (void)
| Check the flash memory of EPD extension board is existed or not in order to determine the board is connected. More...
void | CMD_SE (long flash_address)
| Erase the data of the chosen sector (4KB) to be "1". More...
void | CMD_CE (void)
| Erase all of the flash memory.
void | read_flash (long flash_address, uint8_t *target_buffer, uint8_t byte_length)
| Read Flash data into buffer. More...
void | write_flash (long flash_address, uint8_t *source_address, uint8_t byte_length)
| Write Flash data from buffer. More...
void | erase_image (long address, uint8_t EPD_size)
| To erase the image data. More...
long | get_slideshow_image_address (uint8_t EPD_size, uint8_t image_index, uint8_t is_clear)
| Get the slideshow image address and clear the image or not. More...
long | get_custom_image_address (uint8_t EPD_size, uint8_t image_index, uint8_t is_clear)
| Get the custom image address and clear the image or not. More...
long | get_flash_mark_image_info (uint8_t EPD_size)
| Get mark image information from flash. More...
void | get_flash_image_info (image_information_t *image_info)
| Get image information from flash. More...
void | write_mark (long address)
| Write image header to flash. More...
void | write_ascii (long canvas_address, long mark_address, uint16_t coordinate_X, uint16_t coordinate_Y, char *Text)
| Write ASCII data to canvas image of flash. More...
void | write_slideshow_parameters (slideshow_information_t *slideshow_info)
| Update slideshow parameters. More...
void | read_slideshow_parameters (slideshow_information_t *slideshow_info)
| Read slideshow parameters from defined Flash segment. More...

## Detailed Description

The functions of working with flash memory.

Copyright (c) 2012-2013 Pervasive Displays Inc. All rights reserved.

Authors: Pervasive Displays Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## Function Documentation

void CMD_SE | ( | long | flash_address | ) |

Erase the data of the chosen sector (4KB) to be "1".

Parameters

  flash_address | 32 bit flash memory address

void erase_image | ( | long | address,
|  | uint8_t | EPD_size
| ) |  |

To erase the image data.

Parameters

  address | The start address to be erased
  EPD_size | The EPD size

long get_custom_image_address | ( | uint8_t | EPD_size,
|  | uint8_t | image_index,
|  | uint8_t | is_clear
| ) |  |

Get the custom image address and clear the image or not.

Parameters

  EPD_size | The EPD size
  image_index | The current image index to show
  is_clear | Whether to clear custom images

number of maximum custom images = 8

To erase custom image

void get_flash_image_info | ( | image_information_t * | image_info | ) |

Get image information from flash.

Parameters

  image_info | The data structure of image information

long get_flash_mark_image_info | ( | uint8_t | EPD_size | ) |

Get mark image information from flash.

Parameters

  EPD_size | The EPD size

long get_slideshow_image_address | ( | uint8_t | EPD_size,
|  | uint8_t | image_index,
|  | uint8_t | is_clear
| ) |  |

Get the slideshow image address and clear the image or not.

Parameters

  EPD_size | The EPD size
  image_index | The current image index to show
  is_clear | Whether to clear slideshow images

number of maximum slideshow images = 4

To erase slideshow image

Read image mark offset byte to IsExit

uint8_t is_flash_existed | ( | void |  | ) |

Check the flash memory of EPD extension board is existed or not in order to determine the board is connected.

Returns
  The Flash is existed

Chip select go low to start a flash command

Send command to check the Electronic ID of Flash

Chip select go high to end a flash command

void read_flash | ( | long | flash_address,
|  | uint8_t * | target_buffer,
|  | uint8_t | byte_length
| ) |  |

Read Flash data into buffer.

Parameters

  flash_address | The start address of Flash
  target_buffer | The target address of buffer will be read
  byte_length | The data length will be read

void read_slideshow_parameters | ( | slideshow_information_t * | slideshow_info | ) |

Read slideshow parameters from defined Flash segment.

Parameters

  slideshow_info | The structure of slideshow information

Read parameters from address

< Do while the data byte is empty

< Forward two data length is the last saved position of parameter address

void write_ascii | ( | long | canvas_address,
|  | long | mark_address,
|  | uint16_t | coordinate_X,
|  | uint16_t | coordinate_Y,
|  | char * | Text
| ) |  |

Write ASCII data to canvas image of flash.

Note
  - Introduce Mark Image (partial update function)
    1. Mark image is now used for ASCII and partial update function.
    2. [Previous Image] - [New Image/Canvas Image] - [Mark Image]
    3. Previous Image will save the image data that user downloads on EPD first.
    4. When user types ASCII string by coordinate on EPD Kit Tool, the Mark Image will mark the area that ASCII data will show on EPD.
    5. New Image likes a canvas. System will compare the mark area with Previous Image, only the mark area needs to be scanned and updated, the other area will send Nothing byte.
    6. The final output image is stored in New Image combines with Previous Image and ASCII data.

Parameters

  canvas_address | The canvas image address
  mark_address | The mark image address
  coordinate_X | The location of horizontal of inputted string
  coordinate_Y | The location of vertical of inputted string
  Text | The pointer of inputted string

Get mark and canvas image address

Get ASCII character data and save to Text_array

write Text_array to Canvas memory

write mark memory

void write_flash | ( | long | flash_address,
|  | uint8_t * | source_address,
|  | uint8_t | byte_length
| ) |  |

Write Flash data from buffer.

Parameters

  flash_address | 32 bit flash memory address
  source_address | The source address of buffer will be written
  byte_length | The data length will be read

void write_mark | ( | long | address | ) |

Write image header to flash.

Parameters

  address | The image address

void write_slideshow_parameters | ( | slideshow_information_t * | slideshow_info | ) |

Update slideshow parameters.

Parameters

  slideshow_info | The pointer address of slideshow information