Exemplo n.º 1
0
/**
 * \brief LCD interrupt callback function
 *
 * This function is called when an interrupt has occurred on LCD.
 */
void lcd_interrupt_callback(void)
{
	uint32_t buf_temp;

	// Change text string on LCD when a button is pressed
	if (ui_pusb_button_0()) {
		ui_display_text(lcd_msg_gain_cal, sizeof(lcd_msg_gain_cal));
		c42048a_clear_pixel(ICON_DEGREE_C);
		c42048a_clear_pixel(ICON_MILLI_VOLT);
		test_release_button_gain_cal = true;
	}

	//to limit EEPROM write operations, CAL stored when button released
	if((ui_pusb_button_0() == false)
			&& (test_release_button_gain_cal == true)) {
		buf_temp = (((uint32_t)ext_voltage - ext_offset_cal_val)
				*8000/4095);
		buf_temp = buf_temp * ADC_GAIN_EXT;
		buf_temp = buf_temp / ext_gain_cal_val;

		//store gain value in Flash memory
		if(((buf_temp > EXT_GAIN_MIN_VAL)
				&& (buf_temp < EXT_GAIN_MAX_VAL))){
			ext_gain_cal_val = buf_temp;
			nvm_eeprom_write_byte(ext_gain_cal_addr + 1
				, (uint8_t)(buf_temp>>8));
			nvm_eeprom_write_byte(ext_gain_cal_addr,
				(uint8_t)(buf_temp));
		}
Exemplo n.º 2
0
void ui_dfu_session(void)
{
	c42048a_set_text(lcd_dfu);
	c42048a_blink_pixel(ICON_WARNING);
	c42048a_clear_pixel(ICON_AVR);
	led_power_off();
}