示例#1
0
/**********************************************************
 * Sends a frame multiple times to the COG driver. A frame
 * is sent multiple times to improve contrast and 
 * reduce ghosting. The number of times the frame
 * is resent is dependent on the type of display
 * and current temperature. 
 * 
 * @param frameBuffer
 *   Pointer to the COG/EPD frame buffer
 **********************************************************/
void updateStage(uint8_t *frameBuffer)
{
  /* Calculate the stage time in ms */
  uint32_t endTime = getTempAdjustedStageTime(epdConfig.stageTime);
  
  /* Resend the frame for the entire stage time */
  rtcStart();
  do 
  {
    sendFrame(frameBuffer);
  }
  while ( rtcGetMs() < endTime );
  rtcStop();
}
示例#2
0
/**
 * @brief Interrupt Service Routine Port 1
 */
void isrPort1()
{
	// Process RTCSET Pin
	if(pinDigitalIsPendingInterrupt(RTCSET))
	{
		if(pinDigitalRead(RTCSET) == 0)
		{
			delayMs(10);

			if(pinDigitalRead(RTCSET) == 0)
			{
				digitToModify++;

				// LCD Blink On
				lcdCursorBlinkOn();

				// Write On Configure RTC Indicator
				lcdWriteSetPosition(1,17,'*');

				// Stop RTC
				rtcStop();

				switch(digitToModify)
				{
					case 1:
						lcdSetCursor(2,1);
						break;
					case 2:
						lcdSetCursor(2,4);
						break;
					case 3:
						lcdSetCursor(2,7);
						break;
					case 4:
						lcdSetCursor(2,11);
						break;
					case 5:
						lcdSetCursor(2,14);
						break;
					case 6:
						lcdSetCursor(2,17);
						break;
					default:
						digitToModify = 0;

						// LCD Blink Off
						lcdCursorBlinkOff();

						// Write Off Configure RTC Indicator
						lcdWriteSetPosition(1,17,' ');

						// Start RTC
						rtcStart();

						break;
				}
			}
		}
		// Clear RTCSET Interrupt
		pinDigitalClearPendingInterrupt(RTCSET);
	}

	// Process RTCINC Pin
	if(pinDigitalIsPendingInterrupt(RTCINC))
	{
		if(pinDigitalRead(RTCINC) == 0)
		{
			delayMs(10);

			if(pinDigitalRead(RTCINC) == 0)
			{
				switch(digitToModify)
				{
				case 1:
					rtcSetHour(rtcGetHour() + 1);
					lcdDataDecFormat(rtcGetHour(),2);
					lcdSetCursor(2,1);
					break;
				case 2:
					rtcSetMinute(rtcGetMinute() + 1);
					lcdDataDecFormat(rtcGetMinute(),2);
					lcdSetCursor(2,4);
					break;
				case 3:
					rtcSetSecond(rtcGetSecond() + 1);
					lcdDataDecFormat(rtcGetSecond(),2);
					lcdSetCursor(2,7);
					break;
				case 4:
					rtcSetDay(rtcGetDay() + 1);
					lcdDataDecFormat(rtcGetDay(),2);
					lcdSetCursor(2,11);
					break;
				case 5:
					rtcSetMonth(rtcGetMonth() + 1);
					lcdDataDecFormat(rtcGetMonth(),2);
					lcdSetCursor(2,14);
					break;
				case 6:
					rtcSetYear(rtcGetYear() + 1);
					lcdDataDecFormat(rtcGetYear(),4);
					lcdSetCursor(2,17);
					break;
				default:
					directionPap = 0;
					break;
				}
			}
		}
		// Clear RTCINC Interrupt
		pinDigitalClearPendingInterrupt(RTCINC);
	}

	// Process RTCDEC Pin
	if(pinDigitalIsPendingInterrupt(RTCDEC))
	{
		if(pinDigitalRead(RTCDEC) == 0)
		{
			delayMs(10);

			if(pinDigitalRead(RTCDEC) == 0)
			{
				switch(digitToModify)
				{
				case 1:
					rtcSetHour(rtcGetHour() - 1);
					lcdDataDecFormat(rtcGetHour(),2);
					lcdSetCursor(2,1);
					break;
				case 2:
					rtcSetMinute(rtcGetMinute() - 1);
					lcdDataDecFormat(rtcGetMinute(),2);
					lcdSetCursor(2,4);
					break;
				case 3:
					rtcSetSecond(rtcGetSecond() - 1);
					lcdDataDecFormat(rtcGetSecond(),2);
					lcdSetCursor(2,7);
					break;
				case 4:
					rtcSetDay(rtcGetDay() - 1);
					lcdDataDecFormat(rtcGetDay(),2);
					lcdSetCursor(2,11);
					break;
				case 5:
					rtcSetMonth(rtcGetMonth() - 1);
					lcdDataDecFormat(rtcGetMonth(),2);
					lcdSetCursor(2,14);
					break;
				case 6:
					rtcSetYear(rtcGetYear() - 1);
					lcdDataDecFormat(rtcGetYear(),4);
					lcdSetCursor(2,17);
					break;
				default:
					directionPap = 1;
					break;
				}
			}
		}
		// Clear RTCDEC Interrupt
		pinDigitalClearPendingInterrupt(RTCDEC);
	}
}