libnds
Loading...
Searching...
No Matches
Macros | Functions
tsc.h File Reference

DS Touchscreen/Sound Controller control for ARM7. More...

#include <nds/arm7/touch.h>
#include <nds/arm7/serial.h>

Macros

#define TSC_CONVERT_12BIT   0x00
 Convert to 12-bit samples.
 
#define TSC_CONVERT_8BIT   0x08
 Convert to 8-bit samples.
 
#define TSC_MODE_DFR   0x00
 Differential Reference mode.
 
#define TSC_MODE_SER   0x04
 Single-Ended Reference mode.
 
#define TSC_POWER_AUTO   0x00
 Auto Power Down mode.
 
#define TSC_POWER_ON   0x01
 Full Power mode.
 

Functions

void tscMeasure (u32 command, u16 *buffer, u32 count)
 Read multiple 12-bit measurements from the NDS-mode TSC.
 
u16 tscRead (u32 command)
 Read a single 12-bit measurement from the NDS-mode TSC.
 
s32 tscReadTemperature (void)
 Read temperature from the NDS-mode TSC.
 
static bool tscTouchPenDown (void)
 Check if the NDS-mode TSC is registering pen input.
 
bool tscTouchReadData (touchRawArray *data)
 Read raw touch data from the NDS-mode TSC.
 

Detailed Description

DS Touchscreen/Sound Controller control for ARM7.

Function Documentation

◆ tscMeasure()

void tscMeasure ( u32  command,
u16 buffer,
u32  count 
)

Read multiple 12-bit measurements from the NDS-mode TSC.

Parameters
commandMeasurement command.
bufferOutput buffer.
countNumber of measurements to read.

◆ tscRead()

u16 tscRead ( u32  command)

Read a single 12-bit measurement from the NDS-mode TSC.

Parameters
commandMeasurement command.
Returns
Measured value, from 0 to 4095.

◆ tscReadTemperature()

s32 tscReadTemperature ( void  )

Read temperature from the NDS-mode TSC.

Note that it is not very accurate.

Returns
Approximate temperature, in 20.12 fixed point, as Celsius degrees.

◆ tscTouchPenDown()

static bool tscTouchPenDown ( void  )
inlinestatic

Check if the NDS-mode TSC is registering pen input.

Returns
Returns true if the TSC registers that the pen is down.

◆ tscTouchReadData()

bool tscTouchReadData ( touchRawArray *  data)

Read raw touch data from the NDS-mode TSC.

Parameters
dataStruct to hold the read data.
Returns
On success, true. On failure, false.