Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Initialization driver

The init driver is used to initialize IO (demo or terminal mode), power reduction features, USART1, ADC, Timer1 (demo or terminal mode) and touch sensing (QTB0)

Functions

void adc_init (void)
 Function to setup ADC. More...
 
void io_init_demo_mode (void)
 Function to setup IO for demo mode. More...
 
void io_init_terminal_mode (void)
 Function to setup IO for terminal mode. More...
 
void power_reduction_enable (void)
 Function to reduce power consumption. More...
 
void qt_set_parameters (void)
 Function to set values for touch sensing. More...
 
void stop_timer1_lightdemo (void)
 Function to stop timer1 used in the light sensor demo. More...
 
void timer1_init (void)
 Function to setup timer1 as a time base for the touch lib. More...
 
void timer1_lightdemo_init (void)
 Function to setup timer1 for light sensor demo. More...
 
void touch_init (void)
 Function to setup touch button. More...
 
void usart1_init (void)
 Function to setup USART1. More...
 

Variables

TOUCH_DATA_T SNS_array [2][2]
 
TOUCH_DATA_T SNSK_array [2][2]
 

void adc_init ( void  )

Function to setup ADC.

ADC configuration:

  • Internal 2.56V bandgap voltage with 100nF cap at AREF pin as reference
  • 172.8kHz ADC frequency
void io_init_demo_mode ( void  )

Function to setup IO for demo mode.

Configure all I/O as input pull-up enabled to make sure all I/Os have a defined level. Light sensor and NTC sensor (PA6 and PA7): input pull-up disable. Enable pinchange interrupt for SW0:2 used to toggle through operating modes

void io_init_terminal_mode ( void  )

Function to setup IO for terminal mode.

Configure all I/O as input pull-up enabled to make sure all I/Os have a defined level except LEDs (PB3:0) which is configured as outputs. Light sensor and NTC sensor (PA6 and PA7): input pull-up disable.

void power_reduction_enable ( void  )

Function to reduce power consumption.

This function will turn off clocks to all IO modules except for Timer2 which is used in power-save mode. The function will also shutdown analog modules like the AC and ADC.

void stop_timer1_lightdemo ( void  )

Function to stop timer1 used in the light sensor demo.

All timer1 registers are set to default state

void timer1_init ( void  )

Function to setup timer1 as a time base for the touch lib.

In this mode Timer1 is used to generate PWM signal on the LEDs.

Timer1 configuration:

  • CTC mode (clear on compare match A)
  • clkIO/8 prescaling

References qt_measurement_period_msec, and TICKS_PER_MS.

Referenced by touch_init().

void timer1_lightdemo_init ( void  )

Function to setup timer1 for light sensor demo.

In this mode Timer1 is used to generate PWM signal on the LEDs.

Timer1 configuration:

  • Fast PWM
  • Clear OC1B on compare match, set OC1B at bottom (non-inverting mode)
  • clkIO/8 prescaling
  • ICR1 set as TOP
  • Output compare match B and timer1 overflow interrupts enabled
void touch_init ( void  )

Function to setup touch button.

This function will configure touch sensing for the QTB0 touch button. LED1 is used as touch indication. Touch detected: LED1 on, touch not detected: LED1 off.

References CHANNEL_0, HYST_6_25, NO_AKS_GROUP, qt_enable_key(), qt_filter_callback, qt_init_sensing, qt_set_parameters(), SNS_array, SNSK_array, and timer1_init().

void usart1_init ( void  )

Function to setup USART1.

USART1 is used to communicate with the boardcontroller (AT32UC3256B1).

USART1 configuration:

  • 57600 baud
  • No parity
  • 1 stop bit
  • 8-bit character size

TOUCH_DATA_T SNS_array[2][2]

Referenced by touch_init().

TOUCH_DATA_T SNSK_array[2][2]

Referenced by touch_init().