Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Resistive Touch - ADS7843 Controller

Low-level driver for the ADS7843 touch controller.

This driver provides access to the main features of the ADS7843 controller.

Functions

void ads7843_disable_interrupt (void)
 Disable interrupts on touch event. More...
 
void ads7843_enable_interrupt (void)
 Enable interrupts on touch event. More...
 
void ads7843_get_raw_point (uint32_t *p_x, uint32_t *p_y)
 Get the touch raw coordinates. More...
 
uint32_t ads7843_init (void)
 Initialize the SPI communication with the ADS7843 controller. More...
 
uint32_t ads7843_is_pressed (void)
 Return the touch screen status, pressed or not. More...
 
void ads7843_set_handler (void(*p_handler)(uint32_t, uint32_t))
 Set the touch interrupt handler. More...
 

void ads7843_disable_interrupt ( void  )

Disable interrupts on touch event.

Disable the interrupt

References pio_disable_pin_interrupt().

void ads7843_enable_interrupt ( void  )

Enable interrupts on touch event.

Enable the interrupt

References pio_enable_pin_interrupt().

void ads7843_get_raw_point ( uint32_t *  p_x,
uint32_t *  p_y 
)

Get the touch raw coordinates.

Parameters
p_xPointer to an integer representing the X value.
p_yPointer to an integer representing the Y value.

Disable interrupt to quickly evaluate the coordinates

Get X position

Get Y position

Switch to full power mode

Re-enable interrupt

References ads7843_send_cmd(), CMD_ENABLE_PENIRQ, CMD_X_POSITION, CMD_Y_POSITION, pio_disable_pin_interrupt(), and pio_enable_pin_interrupt().

uint32_t ads7843_init ( void  )

Initialize the SPI communication with the ADS7843 controller.

Board specific chip select configuration

References ads7843_send_cmd(), ADS7843_SPI_BAUDRATE, CMD_ENABLE_PENIRQ, spi_device::id, spi_enable(), spi_master_init(), spi_master_setup_device(), SPI_MODE_0, and spi_select_device().

uint32_t ads7843_is_pressed ( void  )

Return the touch screen status, pressed or not.

Returns
1 if the touchscreen is pressed, 0 otherwise.

References ioport_get_pin_level(), and IOPORT_PIN_LEVEL_LOW.

void ads7843_set_handler ( void(*)(uint32_t, uint32_t)  p_handler)

Set the touch interrupt handler.

Note
This handler will be called whenever a touch event is detected by the ADS7843 controller.
Parameters
p_handlerInterrupt handler function pointer.

Initialize interrupts

Enable the interrupt

References pio_enable_pin_interrupt().