Microchip® Advanced Software Framework

main.c File Reference

This file contains the SAMD QTouch library sample user application.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>

Macros

#define GET_MUTLCAP_ROTOR_SLIDER_POSITION(ROTOR_SLIDER_NUMBER)
 
#define GET_MUTLCAP_SENSOR_STATE(SENSOR_NUMBER)
 
#define LED_1_PIN   PIN_PB01
 Discrete LED output pin definitions. More...
 
#define LED_2_PIN   PIN_PB02
 
#define LED_3_PIN   PIN_PB03
 
#define LED_4_PIN   PIN_PA05
 
#define LED_5_PIN   PIN_PA06
 
#define LED_6_PIN   PIN_PA04
 
#define LED_7_PIN   PIN_PA07
 
#define LED_B_PIN   PIN_PA17
 
#define LED_G_PIN   PIN_PB15
 
#define LED_R_PIN   PIN_PB14
 RGB LED output pin definitions. More...
 
#define TIME_PERIOD_1MSEC   33u
 RTC Interrupt timing definition. More...
 

Functions

void configure_port_pins (void)
 Prototypes. More...
 
void configure_rtc_callbacks (void)
 Configure the RTC timer callback. More...
 
void configure_rtc_count (void)
 Configure the RTC timer count after which interrupts comes. More...
 
int main (void)
 Main function. More...
 
void rtc_overflow_callback (void)
 RTC timer overflow callback. More...
 
void timer_init (void)
 Initialize timer. More...
 

Variables

volatile uint8_t PWM_Count
 
const uint8_t PWM_RGB_values [64][3]
 
uint8_t rotor_position
 
uint8_t rotor_state
 Variables. More...
 
struct rtc_module rtc_instance
 
volatile uint16_t touch_time_counter = 0u
 

#define GET_MUTLCAP_ROTOR_SLIDER_POSITION (   ROTOR_SLIDER_NUMBER)
Value:
ROTOR_SLIDER_NUMBER]
touch_measure_data_t * p_mutlcap_measure_data
Mutual Cap sensors measured data pointer.
Definition: touch.c:93
uint8_t * p_rotor_slider_values
Definition: touch_api_SAMD.h:764

Referenced by main(), and rtc_overflow_callback().

#define GET_MUTLCAP_SENSOR_STATE (   SENSOR_NUMBER)
Value:
p_sensor_states[(SENSOR_NUMBER / \
8)] & (1 << (SENSOR_NUMBER % 8))
touch_measure_data_t * p_mutlcap_measure_data
Mutual Cap sensors measured data pointer.
Definition: touch.c:93

Referenced by main().

#define LED_1_PIN   PIN_PB01

Discrete LED output pin definitions.

Referenced by configure_port_pins(), and main().

#define LED_2_PIN   PIN_PB02

Referenced by configure_port_pins(), and main().

#define LED_3_PIN   PIN_PB03

Referenced by configure_port_pins(), and main().

#define LED_4_PIN   PIN_PA05

Referenced by configure_port_pins(), and main().

#define LED_5_PIN   PIN_PA06

Referenced by configure_port_pins(), and main().

#define LED_6_PIN   PIN_PA04

Referenced by configure_port_pins(), and main().

#define LED_7_PIN   PIN_PA07

Referenced by configure_port_pins(), and main().

#define LED_B_PIN   PIN_PA17
#define LED_G_PIN   PIN_PB15
#define LED_R_PIN   PIN_PB14

RGB LED output pin definitions.

Referenced by configure_port_pins(), main(), and rtc_overflow_callback().

#define TIME_PERIOD_1MSEC   33u

RTC Interrupt timing definition.

Referenced by timer_init().

void configure_port_pins ( void  )

Prototypes.

Port pin configuration / assignments.

Configure Port pins

References port_config::direction, LED_0_PIN, LED_1_PIN, LED_2_PIN, LED_3_PIN, LED_4_PIN, LED_5_PIN, LED_6_PIN, LED_7_PIN, LED_B_PIN, LED_G_PIN, LED_R_PIN, port_get_config_defaults(), PORT_PIN_DIR_OUTPUT, and port_pin_set_config().

Referenced by main().

void configure_rtc_callbacks ( void  )
int main ( void  )

Main function.

Initialize and configure system and generic clocks. Use conf_clocks.h to configure system and generic clocks.

Enable global interrupts.

Initialize delay service.

Initialize timer.

Initialize QTouch library and configure touch sensors.

Configure port pins

Turn off all extension board LEDs

Goto STANDBY sleep mode, unless woken by timer or PTC interrupt.

Start touch sensor measurement, if touch_time.time_to_measure_touch flag is set by timer.

Get touch sensor states

Clear all slider controlled LEDs

If slider is activated

Parse slider position

References configure_port_pins(), delay_init(), GET_MUTLCAP_ROTOR_SLIDER_POSITION, GET_MUTLCAP_SENSOR_STATE, LED_0_PIN, LED_1_PIN, LED_2_PIN, LED_3_PIN, LED_4_PIN, LED_5_PIN, LED_6_PIN, LED_7_PIN, LED_B_PIN, LED_G_PIN, LED_R_PIN, tag_touch_measure_data_t::measurement_done_touch, p_mutlcap_measure_data, port_pin_set_output_level(), PWM_Count, rotor_state, system_init(), system_interrupt_enable_global(), system_set_sleepmode(), system_sleep(), SYSTEM_SLEEPMODE_STANDBY, timer_init(), touch_sensors_init(), and touch_sensors_measure().

void timer_init ( void  )

volatile uint8_t PWM_Count

Referenced by main(), and rtc_overflow_callback().

const uint8_t PWM_RGB_values[64][3]

Referenced by rtc_overflow_callback().

uint8_t rotor_position

Referenced by rtc_overflow_callback().

uint8_t rotor_state

Variables.

Referenced by main(), and rtc_overflow_callback().

struct rtc_module rtc_instance
volatile uint16_t touch_time_counter = 0u

Referenced by rtc_overflow_callback().