Microchip® Advanced Software Framework

EPD_hardware_driver.h File Reference

The SPI, PWM, Temperature definitions of COG hardware driver.

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

Functions

void EPD_display_hardware_init (void)
 Initialize the EPD hardware setting. More...
 
void epd_spi_attach (void)
 Initialize SPI. More...
 
void epd_spi_detach (void)
 Disable SPI and change to GPIO. More...
 
void epd_spi_init (void)
 Configure SPI. More...
 
uint8_t epd_spi_read (unsigned char RDATA)
 SPI synchronous read. More...
 
void epd_spi_send (unsigned char Register, unsigned char *Data, unsigned Length)
 SPI command if register data is larger than two bytes. More...
 
void epd_spi_send_byte (uint8_t Register, uint8_t Data)
 SPI command. More...
 
void epd_spi_write (unsigned char Data)
 Send data to SPI. More...
 
uint32_t get_current_time_tick (void)
 Get current Timer after starting a new one. More...
 
int16_t get_temperature (void)
 Get temperature value from ADC. More...
 
void initialize_temperature (void)
 Initialize the temperature sensor. More...
 
void PWM_run (uint16_t time)
 PWM toggling. More...
 
void PWM_start_toggle (void)
 The PWM signal starts toggling. More...
 
void PWM_stop_toggle (void)
 The PWM signal stops toggling. More...
 
void start_EPD_timer (void)
 Start Timer. More...
 
void stop_EPD_timer (void)
 Stop Timer. More...
 
void sys_delay_ms (unsigned int ms)
 Delay mini-seconds. More...
 
void SysTick_Handler (void)
 Interrupt Service Routine for system tick counter. More...
 

void EPD_display_hardware_init ( void  )
void epd_spi_attach ( void  )

Initialize SPI.

References EPD_cs_high(), EPD_flash_cs_high(), and epd_spi_init().

Referenced by EPD_power_on(), and save_partial_image().

void epd_spi_detach ( void  )
uint8_t epd_spi_read ( unsigned char  RDATA)

SPI synchronous read.

Parameters
RDATAThe data to be read

References EPD_SPI_ID, spi_is_rx_full(), and spi_write_single().

void epd_spi_send ( unsigned char  register_index,
unsigned char *  register_data,
unsigned  length 
)

SPI command if register data is larger than two bytes.

Parameters
register_indexThe Register Index as SPI command to COG
register_dataThe Register Data for sending command data to COG
lengthThe number of bytes of Register Data which depends on which Register Index is selected.

References EPD_cs_high(), EPD_cs_low(), epd_spi_write(), and Wait_10us().

Referenced by border_line(), dummy_line(), EPD_initialize_driver(), nothing_frame(), stage_handle_array(), stage_handle_flash(), and stage_handle_partial_update().

void epd_spi_send_byte ( uint8_t  register_index,
uint8_t  register_data 
)

SPI command.

Parameters
register_indexThe Register Index as SPI command to COG
register_dataThe Register Data for sending command data to COG

References EPD_cs_high(), EPD_cs_low(), epd_spi_write(), and Wait_10us().

Referenced by border_line(), dummy_line(), EPD_initialize_driver(), EPD_power_off(), nothing_frame(), stage_handle_array(), stage_handle_flash(), and stage_handle_partial_update().

void epd_spi_write ( unsigned char  Data)

Send data to SPI.

Parameters
dataThe data to be sent out

References EPD_SPI_ID, spi_is_tx_empty(), and spi_write_single().

Referenced by epd_spi_send(), and epd_spi_send_byte().

uint32_t get_current_time_tick ( void  )

Get current Timer after starting a new one.

References EPD_Counter.

Referenced by stage_handle_array(), stage_handle_flash(), and stage_handle_partial_update().

int16_t get_temperature ( void  )

Get temperature value from ADC.

Returns
the Celsius temperature

not used at present

References EPD_ADCRefVcc, EPD_ADCres, EPD_ADCSampleCount, EPD_DegCOffset, EPD_TempeScaled, F_CPU, g_adc_inst, get_ADC_value(), sysclk_disable_peripheral_clock(), and sysclk_enable_peripheral_clock().

Referenced by set_temperature_factor().

void initialize_temperature ( void  )

Initialize the temperature sensor.

not used at present

References adcife_read_conv_result(), EPD_Temperature_Sensor_ADC, and g_adc_inst.

Referenced by EPD_display_hardware_init().

void PWM_run ( uint16_t  ms)

PWM toggling.

Parameters
msThe interval of PWM toggling (mini seconds)

References delay_ms, PWM_start_toggle(), and PWM_stop_toggle().

Referenced by EPD_initialize_driver(), and EPD_power_on().

void PWM_start_toggle ( void  )

The PWM signal starts toggling.

Configure the PMC to enable the Timer/Counter (TC) module.

TC Configuration structure.

TC Compare Output Mode

TC Waveform Generation Mode

TC Clock Selection, Prescalar select

Init TC to waveform mode.

Configure waveform frequency and duty cycle.

Enable TC EPD_TC_WAVEFORM_CHANNEL.

References tc_control_reg::co_mode, CO_SET, EPD_TC_ClockSignalSel, EPD_TC_TIMER_ID, EPD_TC_WAVEFORM_CHANNEL, EPD_TC_WAVEFORM_ID, EPD_TC_WAVEFORM_PIN, EPD_TC_WAVEFORM_PIN_FLAGS, EPD_TC_WAVEFORM_PWM_DUTY_CYCLE, EPD_TC_WAVEFORM_PWM_FREQUENCY, gpio_configure_pin, PWM_Mode11, sysclk_enable_peripheral_clock(), sysclk_get_peripheral_bus_hz(), tc_clear_cc(), tc_clear_ic(), tc_initc(), tc_start(), tc_write_cc(), and tc_write_ic().

Referenced by PWM_run().

void PWM_stop_toggle ( void  )

The PWM signal stops toggling.

References EPD_TC_WAVEFORM_ID, and tc_stop().

Referenced by PWM_run().

void start_EPD_timer ( void  )
void stop_EPD_timer ( void  )
void sys_delay_ms ( unsigned int  ms)

Delay mini-seconds.

Parameters
msThe number of mini-seconds

References EPD_Counter, start_EPD_timer(), and stop_EPD_timer().

void SysTick_Handler ( void  )

Interrupt Service Routine for system tick counter.

References EPD_Counter.