60 DIDR0 |= (1 << ADC1D);
63 ENTER_DDR &= ~(1<<ENTER_PIN);
64 ENTER_PUR |= (1<<ENTER_PIN);
67 KEY_DDR &= ~(1<<KEY_PIN);
68 KEY_PUR &= ~(1<<KEY_PIN);
71 adc_init(ADC_CHAN_ADC1, ADC_TRIG_FREE_RUN, ADC_REF_AVCC, ADC_PS_128);
121 button = KEY_STATE_DONE;
135 key_state_t key_state;
139 if (key_state == KEY_STATE_NO_KEY){
140 if (button == KEY_STATE_DONE){
141 button = KEY_STATE_NO_KEY;
147 if (button == KEY_STATE_DONE){
186 if (!(ENTER_PORT & (1<<ENTER_PIN))){
189 if (reading < 0x00A0){
192 if (reading < 0x0180){
195 if (reading < 0x0280){
198 if (reading < 0x0380){
This file provides joystick operations.
key_state_t key_task(void)
This will check the joystick state to return the current button status.
Handles the control of the USART for communication with the ATmega1284p for sending commands...
int16_t adc_result_get(adc_adj_t adjust)
This will read the ADC result during the ADC conversion and return the raw ADC conversion result...
int adc_conversion_start(void)
This will start an ADC conversion.
This is the main file for the Raven LCD application.
key_state_t key_state_get(void)
This function will start the ADC conversion and read the current converstion value to determine the b...
uint8_t is_button(void)
This will poll run key_task() to determine if a button has been pressed.
void adc_init(void)
Initializes the ADC controller.
uint8_t get_button(void)
This function will wait for a user to press a button.
void key_init(void)
This will intialize the joystick and the ADC for button readings.
void adc_deinit(void)
This will disable the adc.
void key_deinit(void)
This will disable the ADC used for button readings.