BASIC4MCU | 질문게시판 | 코드 해석이 안되서그런데 해석좀 해주세요 ㅜ(주석)
페이지 정보
작성자 인간현수막 작성일2018-12-09 21:36 조회16,731회 댓글6건
https://www.basic4mcu.com/bbs/board.php?bo_table=gac&wr_id=6632
작성일
작성일
작성일
작성일
작성일
본문
#include <LiquidCrystal.h>
#include <SPI.h>
#define SS_PIN 10
#define DP_HEIGHT 16
#define DP_WIDTH 10LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void Dp_DrawLine(int x, int y, int length, bool hori, bool isSet);struct ZeichenFlaeche {
byte grid[8] = {
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000
};
};ZeichenFlaeche zeichen[2][2];void Dp_Init()
{
lcd.createChar(0, zeichen[0][0].grid);
lcd.createChar(1, zeichen[0][1].grid);
lcd.createChar(2, zeichen[1][0].grid);
lcd.createChar(3, zeichen[1][1].grid);
Dp_DrawLine(0,0,10,true,true); // Linie Oben H
Dp_DrawLine(0,15,10,true,true); // Linie Unten H
Dp_DrawLine(0,0,16,false,true); // Linie Links V
Dp_DrawLine(9,0,16,false,true); // Linie Rechts V
}void Dp_Draw()
{
lcd.createChar(0, zeichen[0][0].grid);
lcd.createChar(1, zeichen[0][1].grid);
lcd.createChar(2, zeichen[1][0].grid);
lcd.createChar(3, zeichen[1][1].grid);
lcd.setCursor(0, 0);
lcd.write(byte(0));
lcd.setCursor(0, 1);
lcd.write(byte(1));
lcd.setCursor(1, 0);
lcd.write(byte(2));
lcd.setCursor(1, 1);
lcd.write(byte(3));
}void Dp_SetPixel(int x, int y, bool isOn)
{
if(isOn)
bitSet (zeichen[x/5][y/8].grid[y%8],4-x%5);
else
bitClear(zeichen[x/5][y/8].grid[y%8],4-x%5);
}bool Dp_GetPixel(int x, int y)
{
return bitRead(zeichen[x/5][y/8].grid[y%8],4-x%5)==1?true:false;
}void Dp_DrawLine(int x, int y, int length, bool hori, bool isSet)
{
for(int offset = 0; offset < length; offset++)
{
if(hori)
Dp_SetPixel(x + offset, y, isSet);
else
Dp_SetPixel(x, y + offset, isSet);
}
}
댓글 6
조회수 16,731master님의 댓글
master 작성일
동작시키면서 분석해야지 쉬울겁니다.
인간현수막님의 댓글
인간현수막
아직 초보라서 ㅠ 해석좀 해주시면 안될까욥?
master님의 댓글
master
초보라도 동작은 시켜볼 수 있지 않나요?
동작시켜보지 않으면 이해하기 더 어려울텐데요
인간현수막님의 댓글
인간현수막
동작은 이미 시켜봤어용!
코드 몇개씩 빼가면서 해봤는데 자꾸 오류나서 어쩔수없이 도움을 요청하는겁니다 ㅠ
master님의 댓글
master
라이브러리가 없어서 오류가 발생하는 겁니다.
소스를 분석하려면 라이브러리가 있어야합니다.
어디서 구한 소스인지 사이트 링크 적어보세요
인간현수막님의 댓글
인간현수막
http://m.blog.daum.net/rockjjy99/2613?np_nil_b=-2 여기서 구한겁니다!