The SPI, PWM, Temperature definitions of COG hardware driver.
Copyright (c) 2012-2014 Pervasive Displays Inc. All rights reserved.
#include "Pervasive_Displays_small_EPD.h"
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 | ) |
Initialize the EPD hardware setting.
References EPD_border_low(), EPD_cs_low(), EPD_discharge_low(), EPD_initialize_gpio(), EPD_pwm_low(), EPD_rst_low(), epd_spi_init(), EPD_Vcc_turn_off(), and initialize_temperature().
Referenced by EPD_init().
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 | ) |
Disable SPI and change to GPIO.
References config_gpio_dir_o, EPD_SPI_CLK_PIN, EPD_SPI_ID, EPD_SPI_MISO_PIN, EPD_SPI_MOSI_PIN, ioport_enable_pin(), set_gpio_low, and spi_disable().
Referenced by EPD_power_off(), and save_partial_image().
void epd_spi_init | ( | void | ) |
Configure SPI.
References delay_ms, EPD_SPI_baudrate, EPD_SPI_CLK_MUX, EPD_SPI_CLK_PIN, EPD_SPI_ID, EPD_SPI_MISO_MUX, EPD_SPI_MISO_PIN, EPD_SPI_MOSI_MUX, EPD_SPI_MOSI_PIN, EPD_SPI_SS_PIN, gpio_configure_pin, IOPORT_DIR_OUTPUT, ioport_disable_pin(), IOPORT_INIT_HIGH, spi_enable(), spi_master_init(), spi_master_setup_device(), SPI_MODE_0, and sysclk_enable_peripheral_clock().
Referenced by EPD_display_hardware_init(), EPD_power_on(), and epd_spi_attach().
uint8_t epd_spi_read | ( | unsigned char | RDATA | ) |
SPI synchronous read.
RDATA | The 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.
register_index | The Register Index as SPI command to COG |
register_data | The Register Data for sending command data to COG |
length | The 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.
register_index | The Register Index as SPI command to COG |
register_data | The 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.
data | The 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.
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.
ms | The 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 | ) |
Start Timer.
References initialize_EPD_timer().
Referenced by stage_handle_array(), stage_handle_flash(), stage_handle_partial_update(), and sys_delay_ms().
void stop_EPD_timer | ( | void | ) |
Stop Timer.
References EPD_TC_TIMER_ID, and tc_stop().
Referenced by stage_handle_array(), stage_handle_flash(), stage_handle_partial_update(), and sys_delay_ms().
void sys_delay_ms | ( | unsigned int | ms | ) |
Delay mini-seconds.
ms | The 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.