SWE-350 TOTP Generator Milestone 5
The DE-10 board has six 7-segment displays, this can be used to display and generate a time based one-time pin (TOTP).
Loading...
Searching...
No Matches
LCD_Lib.c
Go to the documentation of this file.
1// ============================================================================
2// Copyright (c) 2013 by Terasic Technologies Inc.
3// ============================================================================
4//
5// Permission:
6//
7// Terasic grants permission to use and modify this code for use
8// in synthesis for all Terasic Development Boards and Altera Development
9// Kits made by Terasic. Other use of this code, including the selling
10// ,duplication, or modification of any portion is strictly prohibited.
11//
12// Disclaimer:
13//
14// This VHDL/Verilog or C/C++ source code is intended as a design reference
15// which illustrates how these types of functions can be implemented.
16// It is the user's responsibility to verify their design for
17// consistency and functionality through the use of formal
18// verification methods. Terasic provides no warranty regarding the use
19// or functionality of this code.
20//
21// ============================================================================
22//
23// Terasic Technologies Inc
24// 9F., No.176, Sec.2, Gongdao 5th Rd, East Dist, Hsinchu City, 30070. Taiwan
25//
26//
27// web: http://www.terasic.com/
28// email: support@terasic.com
29//
30// ============================================================================
31
32
33
34#include "LCD_Lib.h"
35#include "LCD_Driver.h"
36
37
38void LCD_Init(void){
39
40 // Display_Reset();
41
42
43 // (3) ADC select: Normal display (ADC command D0 = ā€œLā€)
44 // Display_SetADC(true); // normal
45
46
47 // Common output state selection (~normal)
48 LCDDrv_SetOuputStatusSelect(false); // invert to match mechanisum
49
50 // (6) LCD Bias (true:default)
51 // Display_SetBias(true);//
52
53 // (4 ?) Power control register (D2, D1, D0) = (follower, regulator, booster) = (1, 1, 1)
55
56 // Setting the build-in resistance radio
57 // Display_SetResistorRatio(4);
58
59 // Electronic volume control (adjust brightnesss: 0x01~0x3F, 0x20:disable)
60 // Display_SetElectricVolume(0x20);
61 //Display_SetOsc(true);
62
63 // delay
64 //usleep(5u);
65
66 // (9) set display start line: at first line
68
69
70 // (11) Page address register set at page 0
72 // (10) Column address counter set at address 0
74
75 // Display on
76 LCDDrv_Display(true);
77}
78
79
80void LCD_SetStartAddr(uint8_t x, uint8_t y){
83}
84
85
86
87void LCD_Clear(void){
88 int Page, i;
89 for(Page=0;Page<8;Page++){
92 for(i=0;i<132;i++){
93 LCDDrv_WriteData(0x00);
94 }
95 }
96}
97
98
99
100
101void LCD_FrameCopy(uint8_t *Data){
102 int Page;
103
104 uint8_t *pPageData = Data;
105 for(Page=0;Page<8;Page++){
106 LCD_SetStartAddr(0, Page*8);
107 LCDDrv_WriteMultiData(pPageData, 128);
108 pPageData += 128;
109 }
110}
void LCDDrv_SetPageAddr(uint8_t PageAddr)
Definition LCD_Driver.c:50
void LCDDrv_Display(bool bOn)
Definition LCD_Driver.c:39
void LCDDrv_SetStartLine(uint8_t StartLine)
Definition LCD_Driver.c:45
void LCDDrv_WriteData(uint8_t Data)
Definition LCD_Driver.c:64
void LCDDrv_SetPowerControl(uint8_t PowerMask)
Definition LCD_Driver.c:113
void LCDDrv_WriteMultiData(uint8_t *Data, uint16_t num)
Definition LCD_Driver.c:68
void LCDDrv_SetColAddr(uint8_t ColAddr)
Definition LCD_Driver.c:55
void LCDDrv_SetOuputStatusSelect(bool bNormal)
Definition LCD_Driver.c:128
void LCD_SetStartAddr(uint8_t x, uint8_t y)
Definition LCD_Lib.c:80
void LCD_Init(void)
Definition LCD_Lib.c:38
void LCD_Clear(void)
Definition LCD_Lib.c:87
void LCD_FrameCopy(uint8_t *Data)
Definition LCD_Lib.c:101