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().

void epd_spi_detach ( void  )

Disable SPI and change to GPIO.

References config_gpio_dir_o, ioport_enable_pin(), set_gpio_low, and spi_disable().

uint8_t epd_spi_read ( unsigned char  RDATA)

SPI synchronous read.

Parameters
RDATAThe data to be read

References 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().

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().

void epd_spi_write ( unsigned char  Data)

Send data to SPI.

Parameters
dataThe data to be sent out

References 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.

int16_t get_temperature ( void  )

Get temperature value from ADC.

Returns
the Celsius temperature

not used at present

References adc_disable(), adc_enable(), F_CPU, g_adc_inst, get_ADC_value(), NUM_SAMPLES, sysclk_disable_peripheral_clock(), and sysclk_enable_peripheral_clock().

void initialize_temperature ( void  )

Initialize the temperature sensor.

not used at present

References adc_enable(), adc_init(), adcife_read_conv_result(), 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().

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, 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 tc_stop().

Referenced by PWM_run().

void start_EPD_timer ( void  )

Start Timer.

References initialize_EPD_timer().

Referenced by sys_delay_ms().

void stop_EPD_timer ( void  )

Stop Timer.

References tc_stop().

Referenced by sys_delay_ms().

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.