rtouch_example.c File Reference


Detailed Description

Example for resistive touch display measurement.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file rtouch_example.c.

#include <avr32/io.h>
#include <stdint.h>
#include <stdbool.h>
#include "compiler.h"
#include "print_funcs.h"
#include "board.h"
#include "power_clocks_lib.h"
#include "gpio.h"
#include "intc.h"
#include "cycle_counter.h"
#include "flashc.h"
#include "rtouch.h"
#include "rtouch_calibrate.h"
#include "et024006dhu.h"
#include "conf_et024006dhu.h"

Go to the source code of this file.

Defines

#define FCPU_HZ   FOSC0
#define FPBA_HZ   FOSC0

Functions

void event_handler (rtouch_event_t const *event)
void init_board (void)
int main (void)


Define Documentation

#define FCPU_HZ   FOSC0

Definition at line 114 of file rtouch_example.c.

Referenced by init_board().

#define FPBA_HZ   FOSC0

Definition at line 115 of file rtouch_example.c.

Referenced by init_board().


Function Documentation

void event_handler ( rtouch_event_t const *  event  ) 

Definition at line 172 of file rtouch_example.c.

References rtouch_event_struct::panelX, rtouch_event_struct::panelY, RTOUCH_MOVE, RTOUCH_PRESS, and rtouch_event_struct::type.

Referenced by main().

00173 {
00174 
00175     switch(event->type) {
00176     case RTOUCH_MOVE:
00177         // draw a pixel 
00178         et024006_DrawPixel(event->panelX, event->panelY, BLACK);
00179         break;
00180     case RTOUCH_PRESS:
00181         // draw pixel
00182         et024006_DrawPixel(event->panelX, event->panelY, BLACK);
00183         break;
00184     default:
00185         break;
00186     }
00187 }

void init_board ( void   ) 

Definition at line 145 of file rtouch_example.c.

References FCPU_HZ, and FPBA_HZ.

Referenced by main().

00146 {
00147 
00148 #ifdef MAX_SPEED
00149     init_sys_clocks();
00150 #else
00151   pcl_switch_to_osc(PCL_OSC0, FOSC0, OSC0_STARTUP);
00152 #endif
00153     INTC_init_interrupts();
00154 
00155     init_dbg_rs232(FPBA_HZ);
00156     // Activate LED0 & LED1 & LED2 & LED3 pins in GPIO output
00157     // mode and switch them off.
00158     gpio_set_gpio_pin(LED0_GPIO);
00159     gpio_set_gpio_pin(LED1_GPIO);
00160     gpio_set_gpio_pin(LED2_GPIO);
00161     gpio_set_gpio_pin(LED3_GPIO);
00162     
00163     et024006_Init(FCPU_HZ, FCPU_HZ);
00164     gpio_set_gpio_pin(ET024006DHU_BL_PIN);
00165     et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, WHITE);
00166 }

int main ( void   ) 

Definition at line 194 of file rtouch_example.c.

References event_handler(), init_board(), rtouch_calibrate(), rtouch_enable(), rtouch_init(), and rtouch_set_event_handler().

00195 {
00196 
00197     init_board();
00198     print_dbg("Resistive touch demo\r\n");
00199 
00200     rtouch_init();
00201     rtouch_enable();
00202     rtouch_set_event_handler(event_handler);
00203     
00204     gpio_clr_gpio_pin(LED0_GPIO);
00205     
00206     /* Do the calibration */
00207     while(rtouch_calibrate())
00208         ;
00209 
00210     /* Signal end of calibration */
00211     gpio_set_gpio_pin(LED0_GPIO);
00212 
00213     while(true)
00214     {
00215     }
00216 }


Generated on Fri Feb 19 02:24:05 2010 for AVR32 - Resistive Driver by  doxygen 1.5.5