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().
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().
void epd_spi_init | ( | void | ) |
Configure SPI.
References delay_ms, 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(), and epd_spi_attach().
uint8_t epd_spi_read | ( | unsigned char | RDATA | ) |
SPI synchronous read.
RDATA | The 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.
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().
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().
void epd_spi_write | ( | unsigned char | Data | ) |
Send data to SPI.
data | The 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.
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.
ms | The 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 | ) |
void start_EPD_timer | ( | void | ) |
void stop_EPD_timer | ( | void | ) |
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.