前言:
今日,本來要使用電表(ut61E)發現,它沒電了. 因它並沒有auto-sleep.
而其實在購買時,就是看見它的可改造性(誤).
因此,找了一下並實驗其auto-sleep function.
最主要的還是它本身所使用的ES51922a已有這一function
而因為為了"通訊(RS232 format)"而關閉它.
故只需要將它對應的pin 腳,改掉(或是用外部開關,即可)
正確的作法(參照ref link),是以它的通訊線上依Photointerrupter(GP1S50)
來做,但因我手上沒有其它的元件及工具,所以我目前暫時
用一個外部滑動開關用..
其它,則要找時間去補上....
ref:
web:
UT61E Auto Power Off Modification
http://www.designelectronics.com.au/DesignElectronics_UT61E-APO.htm
UT61E拆机图+ 也D 完美版 自动关机功能
http://forum.eepw.com.cn/thread/240616/1
file:
https://drive.google.com/open?id=0B2uYQcUgyMUJTXROX01ucV9GdFE
化苦為花
研究電子;也研究自己. 電子實驗;也實驗人生.
2016年5月28日 星期六
2016年4月10日 星期日
usb mouse setting propross
[4;41mResetting in 1 second..
[4;41mUsbBusReset..
[4;41mUsbBusSuspend..
[4;41mUsbBusSuspend..
[4;41mUsbBusReset..
[4;41mUsbBusSuspend..
[4;41mUsbBusSuspend..
[4;41mUsbBusReset..
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
0
1
0
0
40
0
end read
dev to host request
GET_DESCRIPTOR
DEVICE_DESCRIPTOR
D12 to write 16 bytes to end 1..
data string,hex
121101000108888100112
[4;41mD12ClearInEp0..
D12 to write 2 bytes to end 1..
data string,hex
31
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbBusReset..
[4;41mUsbEp0Out..
start read endp0,len 8
0
5
1
0
0
0
0
0
end read
SET_ADDRESS
D12 to write 0 bytes to end 1..
data string,hex
[4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
0
1
0
0
12
0
end read
dev to host request
GET_DESCRIPTOR
DEVICE_DESCRIPTOR
D12 to write 16 bytes to end 1..
data string,hex
121101000108888100112
[4;41mD12ClearInEp0..
D12 to write 2 bytes to end 1..
data string,hex
31
[4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
0
2
0
0
FF
0
end read
dev to host request
GET_DESCRIPTOR
CONFIGURATION_DESCRIPTOR
wlength more SendLength
D12 to write 16 bytes to end 1..
data string,hex
9229011080329400131
[4;41mD12ClearInEp0..
D12 to write 16 bytes to end 1..
data string,hex
20921101211223407581310
[4;41mD12ClearInEp0..
D12 to write 9 bytes to end 1..
data string,hex
0A0000000
[4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
3
3
9
4
FF
0
end read
dev to host request
GET_DESCRIPTOR
STRING_DESCRIPTOR
product number
D12 to write 16 bytes to end 1..
data string,hex
1633203003003802D0300370
[4;41mD12ClearInEp0..
D12 to write 6 bytes to end 1..
data string,hex
2D0310390
[4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
0
3
0
0
FF
0
end read
dev to host request
GET_DESCRIPTOR
STRING_DESCRIPTOR
lan id
D12 to write 4 bytes to end 1..
data string,hex
4394 [4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
2
3
9
4
FF
0
end read
dev to host request
GET_DESCRIPTOR
STRING_DESCRIPTOR
product string
D12 to write 16 bytes to end 1..
data string,hex
363A308578575965604FA973550 [4;41mD12ClearInEp0..
D12 to write 16 bytes to end 1..
data string,hex
530420B304B4E28753762EA819A5B [4;41mD12ClearInEp0..
D12 to write 16 bytes to end 1..
data string,hex
494E8476550530420200480490 [4;41mD12ClearInEp0..
D12 to write 6 bytes to end 1..
data string,hex
440BE8B759 [4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
0
1
0
0
12
0
end read
dev to host request
GET_DESCRIPTOR
DEVICE_DESCRIPTOR
D12 to write 16 bytes to end 1..
data string,hex
121101000108888100112 [4;41mD12ClearInEp0..
D12 to write 2 bytes to end 1..
data string,hex
31 [4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
0
2
0
0
9
0
end read
dev to host request
GET_DESCRIPTOR
CONFIGURATION_DESCRIPTOR
D12 to write 9 bytes to end 1..
data string,hex
922901108032 [4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbEp0Out..
start read endp0,len 8
80
6
0
2
0
0
29
0
end read
dev to host request
GET_DESCRIPTOR
CONFIGURATION_DESCRIPTORD12 to write 16 bytes to end 1..
data string,hex
9229011080329400131 [4;41mD12ClearInEp0..
D12 to write 16 bytes to end 1..
data string,hex
20921101211223407581310 [4;41mD12ClearInEp0..
D12 to write 9 bytes to end 1..
data string,hex
0A0000000 [4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
[4;41mUsbEp0Out..
start read endp0,len 8
0
9
1
0
0
0
0
0
end read
SET_CONFIGURATION
D12 to write 0 bytes to end 1..
data string,hex
[4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
start read endp0,len 8
21
A
0
0
0
0
0
0
end read
usb class out request
set idle
D12 to write 0 bytes to end 1..
data string,hex
[4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
start read endp0,len 8
81
6
0
22
0
0
74
0
end read
dev to host request
GET_DESCRIPTOR
REPORT_DESCRIPTOR
D12 to write 16 bytes to end 1..
data string,hex
5192A1191A1059191293
[4;41mD12ClearInEp0..
D12 to write 16 bytes to end 1..
data string,hex
150251953751812951755813 [4;41mD12ClearInEp0..
D12 to write 16 bytes to end 1..
data string,hex
519309319381581257F758953 [4;41mD12ClearInEp0..
D12 to write 4 bytes to end 1..
data string,hex
816C0C0 [4;41mD12ClearInEp0..
[4;41mUsbEp0Out..
for out request
start read endp0,len 0
end read
usb main descriptor example
設備描述 ***
const uint8_t DeviceDescriptor[12] =
{
//bLength ,
0x12,
//beDescriptorType,說明這裡是用來描述""設備"描述
0x01,
//bcd USB,設定usb版本 1.1
0x10,
0x01,
//bDeviceClass ,不在設備描述中定義出設備類,而在interface Descriptor
//定義設備,故設為0
0x00,
//bDeviceSubClass,同上
0x00,
//bMaxPacketSize *,針對該usb interface EndPoint 0 的大小,
//在PDIUSBD12為16 B ****
0x10,
//idVender,廠商ID。
//實際廠品中不能隨便用,必須向usb協會申請
0x88,
0x88,
//idProduct,產品ID *****
0x01,
0x00,
//bcdDevice, 產品的版本號 *****
0x00,
0x01,
//iManufacturer,廠商的字串索引值。
//當值為0,表示沒有廠商字符串;非0時在主機獲取DeviceDescriptor時,會依此索引值
//放在 wValue中,來選擇不同的字串
0x01,
//iProduct ,產品字串索引值。必須不同 iManufacturer
//即在安裝設備時,系統所跳出的訊息
0x02,
//iSerialNumber,設備序號索引值,指定一個唯一的序號,然後聯合VID及PID來區分不同的設備
0x03,
//bNumConfiguration,該設備所具有的配置數
0x01
};
配置描述集合(配置/接面/端口及HID)
const uint8_t ConfigurationDescriptor[9+9+9+7] =
{
//configure Descriptor
//bLength
0x09,
//bDescriptorType, set 0x02 for Configure
0x02,
//wTotalLenght.配置描述集合的總長度。包含了 configure/interface/endpoint and HID
sizeof(ConfigurationDescriptor)&0xff,
sizeof(ConfigurationDescriptor)>>8 &0xff,
//bNumberInterface,
0x01,
//bConfigure
0x01,
//bmAttribute, **
//D4~D0,always set 0; D5, suport wake from remote; D6 ,device power; D7 ,always set 1
0x80,
//bMaxPower,unit 2mA
0x32,//50mA form bus
//interface descriptor
//bLength ,
0x09,
//bDescriptorType,interface descriptor type 0x04
0x04,
//bIntefaceNumber, start from 0 ,more than zero for use ... device
0x00,
//bAlternateSetting,備用
0x00,
//bNumEndpoint, 非0 point數目。
0x01,
//bIntefaceClass ,該interface所使用的類。HID mouse is 0x03
0x03,
//bInterfaceSubClass, interface 的子類,HID 1.1 for usb mouse set 0x01
0x01,
//bInterfaceProtocol, keyboard 0x01;mouse 0x02
0x02
//iConfigure, interface的字串索引值,no set 0
0x00,
//HID descriptor
//bLength ,
0x09,
//bDescriptorType,HID descriptor type 0x21
0x21,
//bcdHID ,HID version 1.1
0x10,
0x01,
//bCountyCode,國家代碼 USA
0x21,
//bNumberDescriptors,下級描述符數目
0x01,
//bDescriptorType, reporttype 0x22
0x22,
//bDescriptorLength
sizeof(ReportDescriptor) & 0xff,
(sizeof(ReportDescriptor) >>8)& 0xff,
//endpoint descriptor
//bLength ,
0x07,
//bDescriptorType,endport descriptor type 0x05
0x05,
//bEndpointAddress, in mouse only one input-endpoint 1
//D7,表示方向,input set
0x81,
//bmAttributes,D1~D0
//endpoint 傳輸類型,interrupt 3
0x03,
//wMaxPacketSize.
0x10,
0x00,
//bInterval,
0x0A
};
const uint8_t ReportDescriptor[]=//**
{
//每行的第一行為其該條目的前綴,格式為
//D7~D4: bTag, D3~D2:bType, D1~D0, bSize
//全局條目(bType = 1)條目,選擇用途頁為普通桌面(generic Desktop page)
//其bSize =1,並接上 0x01
0x05,0x01, //USAGE_PAGE(generic Desktop page)
//局部(bType =2)條目,說明接下來的應用集合用途用於mouse
0x09,0x02, //USAGE(mouse)
//主條目(bType =0),開集合,而後面的數據0x01表示該集合是一個應用集合
//它的性質在前面由usage_page 及 usage定義為 generic Desktop page mouse
0xa1,0x01, //Collection(Application)
//局部條目,用途為指針集合
0x09,0x01, //USAGE(pointer)
//主條目,開集合,數據0x00 表示為該?物理集合
//用途由前面的局部條目定義為指針集合
0xa1,0x00, //Collection(physical)
//全區條目,用途頁為按鍵(button page(0x09)
0x05,0x09, //USAGE_PAGE(button)
//局部條目,用途最小值為 1,即左鍵
0x19,0x01, //USAGE)MINIMUM(button 1)
//局部條目,用途最大值為 3,即中鍵
0x29,0x03, //USAGE)MAx(button 3)
//全局條目,返回的數據的邏輯值,最小為0;最大為1
0x15,0x00, //LOGICAL)MINIMUM(0)
//全局條目
0x25,0x01, //LOGICAL_MAXIMUM(1)
//為全局條目,設定數據域最大數目3
0x95,x03, //REPORT_COUNT(3)
//全局條目, 每個數據域的長度為1個位
0x75,0x01, //REPORT_SIZE(1)
//主條目,說明有3個長度1位的數據域(數量及長度由上面的全局條目設定)
//用來作為輸入,屬性為:data,var,abs. data 表示這些數據可以變動;var,表示
//這些是獨立,abs 表示為絕對值
//所以結果是,第一個數據域 0表示 按鍵1(右),第二個數據域 1 右鍵,第三數域 2表示
//中鍵
0x81,0x02, //INPUT(data,var,abs)
//全局條目,說明數據域數量 為1
0x95,0x01, //REPORT_COUNT(1)
//全局條目,每個數據域長度為 5位
0x75,0x05, //REPORT_SIZE(5)
//主條目,輸入,由前二個全局條目,得長度(5)及數量(1)
//屬性為常數(即返回的值均為0)
//在這只是為了湊齊1byte(前面只用了3位(左~中)而填充的數據而已沒有實際用途
0x81,0x03, //INPUT(data,var,abs)
//全局條目,用途頁為普通桌面(generic Desktop page,0x01)
0x05,0x01, //USAGE_PAGE(generic Desktop)
//局域條目,用途為X軸
0x09,0x30, //USAGE(x)
//局域條目,用途為y軸
0x09,0x31, //USAGE(y)
//局域條目,用途為w軸
0x09,0x38, //USAGE(wheel)
//全局條目,說明返回的邏輯最小/大值
//往右為,X+,下時,Y+,wheel up,w+
015,0x81, //LOGICAL_MINIMUM(-127)
025,0x7f, //LOGICAL_MAXIMUM(127)
//全局,數據域長度8位
0x75,0x08, //REPORT_COUNT(8)
//全局,數據數量3
0x95,0x03, //REPORT_COUNT(3)
//主條目,由前全局(三個8 數據域)作為輸入. 屬性為:data,var,rel
//第一個為X,Y,W. rel:相對值
0x81,0x06, //input(data,var,rel
//關集合,並設bSize=0
0xc0,
0xc0
};
在 "設備描述符中,有廠商,產品及序號"
const uint8_t LanguageID[4] =
{
0x04,// bLength
0x03,//string type
//for usa
0x09,
0x04
};
//ManufactureStringDescriptor
http://www.ifreesite.com/unicode-ascii-ansi.htm
您好USB設計
\u60a8\u597dUSB\u8a2d\u8a08
const uint8_t ManfactureStringDescriptor[] =
{
0x10 ,//lenght
0x03,//for string type
0xa8,0x60,
0x7d,0x59,
0x55,0x00,
0x53,0x00,
0x42,0x00,
0x2d,0x8a,
0x08,0x8a
}
//ProductStringDescriptor,即安裝時跳出訊息
http://www.ifreesite.com/unicode-ascii-ansi.htm
自己做滑鼠
\u81ea\u5df1\u505a\u6ed1\u9f20
const uint8_t ProductStrinDescriptor[] =
{
11,
.....
};
//產品序號
//1234
const uint8_t SerialNumberStringDescriptor[] =
{
10, //blenght
0x03, //string type
0x31,0x00,
0x32,0x00,
0x33,0x00,
0x34,0x00
};
2014年5月13日 星期二
Ubertooth and Papilio One
Coming Soon
Fig 1.Ubertooth
an open source 2.4 GHz wireless development platform suitable for Bluetooth experimentation
Fig 2. Papillio One
Have you been thinking about jumping into FPGA development but are not sure how to get started? Well, take a look at the Papilio - an Open Source FPGA board with everything you need to get started at a low price. With a friendly and supportive community, free VHDL eBook, Open Source Arduino compatible Soft Processors, and plenty of code examples you will have all the resources needed to get you started on the FPGA path. It's never been easier to jump into the wide-open world of FPGA development!
What Can it do ?
and
How Can I do ?
http://ubertooth.sourceforge.net/
http://penturalabs.wordpress.com/2013/09/01/ubertooth-open-source-bluetooth-sniffing/
http://papilio.cc/index.php?n=Papilio.Hardware
http://www.gadgetfactory.net/
2014年4月13日 星期日
LCD driver(二)
共有三篇,分別是LCD driver(一,二及三)的內容
分別是它的楖念'設計及實作。
LCD driver(一)
LCD driver(二)
LCD driver(三)
分為3個組成
A. 一為SSD1306,即直接控制register及提供相關的資訊的地方
B. 針對特定應用所撰寫的,像是要顯示時間, (你必須去指定字型,坐標及資訊. 並最後在特定時間點去更新RAM to CGRAM)
C. 將graph assert (font , pic(logic) and animations 以便於管理(這裡我放在一起)
這裡我將說明其中,最底層及graphic assert的建造部份,
並最後再update 到 CGRAM中, 但在目前的系統中,為了節省RAM空間去除這一部份
所以都是寫入到CGRAM,即update都沒有動作並去除不必要的函式.
LCD應有的相關API:
1.lcd 初始化: drv_LcdInit, 初始化LCD controller並設置相關i/o.
2,lcd屬性:從組態檔中可以得到LCD的基本屬性 。
drv_LcdWidth - 傳回lcd 的寬度
drv_LcdHeight- 傳回lcd的高度
drv_LcdPixelBits-獲得lcd的顯示模式,每個pixel所需bit數。
3.lcd背光:背光功能。
drv_LcdBackLightOn : open backlight
drv_LcdGetBackLightStatus : return the lcd status
4.LCD明暗度:可以輸出指定的電壓值。
drv_LcdSetContrast : 設定LCD明暗度等級。
drv_LcdGetContrast:取得目前LCD明暗的等級。
5.LCD frame buffer : LCD Controller要在LCD上顯示什麼內容是由video ram的內容來決定,而LCD controller的工作就是根據video ram的內容定時刷新;所以LCD 驅動程式只要改變video ram的內容,在下次lcd刷新就可以看到lcd的畫面改變了。ps:這裡frame buffer (video ram)
通常我們會準備二塊frame buffer,一塊是前景(froeground),另一塊是背景(background);在做圖形計算時,會先保持前景/背景同步,先將結果畫在背景上,等所有圖形畫完後,再一次把背景覆蓋在前景中。
drv_SetLcdDrawType - 設定graphics library會畫在前景或背景中,為一個全域變數。
drv_GetLcdDrawType -取回目前的狀態。
drv_LcdSetForegroundVRamBase- 設定前景frame buffer的起始位址。因在有些是有規定特定的位址,或是video ram的位址必須為某個值的倍數。(其函式旳參數,可由macro 定義之)
drv_LcdGetForegroundVRamBase- 取後前景的屬性(起始位置)。
drv_LcdBackgroundVRamBase - 設定背景frame buffer的起始位址。通常為一個陣列。(其函式旳參數,可由macro 定義之)
drv_LcdGetbackgroundVRamBase- 取後背景的屬性(起始位置)。
drv_LcdUpdate -使用前/背景同步,螢幕應會立即顯示背景的frame buffer內容。
drv_LcdUpateArea - 好的graphics library會記錄上次 前/背景同步之後背景被修改的範圍,這樣下次更新時就不用整個rame buffer複製,只需要同步被修改的部份即可。
6. LCD Graphics Library:指的是在畫 點'線'矩形' show 字等圖的函式。
drv_DrawPixel : 畫點。
drv_DrawVLine : 畫直線。呼叫多次的pixel.
drv_HrawHLine : 畫橫線。(先計算出起始與結束點是第幾個byte的第幾bit,然後給值)
drv_DrawLine : 畫斜線,由起始點和結束點算出斜率,然後利用斜率去計算各點相對應的frame buffer byte and bit.
drv_DrawRect- 畫矩形,分實心和空心。前者畫多修橫線(Y軸累加);後者則畫二直二橫。
drv_GetImage - 取後某個矩形區域對之frame buffer的記憶体內容,並將其儲存成特定格式。(長寛,內容,色彩)
drv_PutImage - 將drv_GetImage內容,貼到螢幕的另一位置上。
drv_ClearScreen - 清螢幕,
drv_DrawChar -基本顯示英文字母,而其debug時則是用drv_PutImage來做。
drv_DrawString -呼叫多次的drv_DrawChar
即以查表法來進行, 如上圖
若在字庫中,只有hello等, 則在descriptors中 會去建立 e ~o 的相關資料
提供其所佔的字宽及其在charbitmaps的位址.
所以,在印出字元時 會先去查其特定字庫的第一個字元 並以相減後(因它是以asscii碼排列)去得到其char info(width,(hight) and offset)
而圖形,不像字型可以由它的去得到它的相關位址及大小,所以我們必須去自行去填入
以下是我的相關設定及API :
SSD1306.h
watch.h
font_graphic.h
bitmapDb.h
ref:
http://www.pavius.net/2009/07/the-dot-factory-an-lcd-font-and-image-generator/
https://github.com/pavius/The-Dot-Factory
backup:
https://drive.google.com/file/d/0B2uYQcUgyMUJbGJ2YnVWbjhlMDQ/edit?usp=sharing
https://drive.google.com/file/d/0B2uYQcUgyMUJZ3NhdkNXT0ljS28/edit?usp=sharing
分別是它的楖念'設計及實作。
LCD driver(一)
LCD driver(二)
LCD driver(三)
分為3個組成
A. 一為SSD1306,即直接控制register及提供相關的資訊的地方
B. 針對特定應用所撰寫的,像是要顯示時間, (你必須去指定字型,坐標及資訊. 並最後在特定時間點去更新RAM to CGRAM)
C. 將graph assert (font , pic(logic) and animations 以便於管理(這裡我放在一起)
這裡我將說明其中,最底層及graphic assert的建造部份,
A.SSD1306
SSD1306 : 原本應為分為前後景(RAM and CGRAM), 其動作應為一開始都是寫入到RAM上,並最後再update 到 CGRAM中, 但在目前的系統中,為了節省RAM空間去除這一部份
所以都是寫入到CGRAM,即update都沒有動作並去除不必要的函式.
LCD應有的相關API:
1.lcd 初始化: drv_LcdInit, 初始化LCD controller並設置相關i/o.
2,lcd屬性:從組態檔中可以得到LCD的基本屬性 。
drv_LcdWidth - 傳回lcd 的寬度
drv_LcdHeight- 傳回lcd的高度
drv_LcdPixelBits-獲得lcd的顯示模式,每個pixel所需bit數。
3.lcd背光:背光功能。
drv_LcdBackLightOn : open backlight
drv_LcdGetBackLightStatus : return the lcd status
4.LCD明暗度:可以輸出指定的電壓值。
drv_LcdSetContrast : 設定LCD明暗度等級。
drv_LcdGetContrast:取得目前LCD明暗的等級。
5.LCD frame buffer : LCD Controller要在LCD上顯示什麼內容是由video ram的內容來決定,而LCD controller的工作就是根據video ram的內容定時刷新;所以LCD 驅動程式只要改變video ram的內容,在下次lcd刷新就可以看到lcd的畫面改變了。ps:這裡frame buffer (video ram)
通常我們會準備二塊frame buffer,一塊是前景(froeground),另一塊是背景(background);在做圖形計算時,會先保持前景/背景同步,先將結果畫在背景上,等所有圖形畫完後,再一次把背景覆蓋在前景中。
drv_SetLcdDrawType - 設定graphics library會畫在前景或背景中,為一個全域變數。
drv_GetLcdDrawType -取回目前的狀態。
drv_LcdSetForegroundVRamBase- 設定前景frame buffer的起始位址。因在有些是有規定特定的位址,或是video ram的位址必須為某個值的倍數。(其函式旳參數,可由macro 定義之)
drv_LcdGetForegroundVRamBase- 取後前景的屬性(起始位置)。
drv_LcdBackgroundVRamBase - 設定背景frame buffer的起始位址。通常為一個陣列。(其函式旳參數,可由macro 定義之)
drv_LcdGetbackgroundVRamBase- 取後背景的屬性(起始位置)。
drv_LcdUpdate -使用前/背景同步,螢幕應會立即顯示背景的frame buffer內容。
drv_LcdUpateArea - 好的graphics library會記錄上次 前/背景同步之後背景被修改的範圍,這樣下次更新時就不用整個rame buffer複製,只需要同步被修改的部份即可。
6. LCD Graphics Library:指的是在畫 點'線'矩形' show 字等圖的函式。
drv_DrawPixel : 畫點。
drv_DrawVLine : 畫直線。呼叫多次的pixel.
drv_HrawHLine : 畫橫線。(先計算出起始與結束點是第幾個byte的第幾bit,然後給值)
drv_DrawLine : 畫斜線,由起始點和結束點算出斜率,然後利用斜率去計算各點相對應的frame buffer byte and bit.
drv_DrawRect- 畫矩形,分實心和空心。前者畫多修橫線(Y軸累加);後者則畫二直二橫。
drv_GetImage - 取後某個矩形區域對之frame buffer的記憶体內容,並將其儲存成特定格式。(長寛,內容,色彩)
drv_PutImage - 將drv_GetImage內容,貼到螢幕的另一位置上。
drv_ClearScreen - 清螢幕,
drv_DrawChar -基本顯示英文字母,而其debug時則是用drv_PutImage來做。
drv_DrawString -呼叫多次的drv_DrawChar
B.graphic assert builder
這個是針對fone即以查表法來進行, 如上圖
若在字庫中,只有hello等, 則在descriptors中 會去建立 e ~o 的相關資料
提供其所佔的字宽及其在charbitmaps的位址.
所以,在印出字元時 會先去查其特定字庫的第一個字元 並以相減後(因它是以asscii碼排列)去得到其char info(width,(hight) and offset)
而圖形,不像字型可以由它的去得到它的相關位址及大小,所以我們必須去自行去填入
以下是我的相關設定及API :
SSD1306.h
1: #ifndef SSD1306_H
2: #define SSD1306_H
3:
4: #include "gpio_def_iwatch_alford1224.h"
5: #include "hal_spi.h"
6: // Remove comment to use double buffer, requires 1k of RAM
7: #define USE_DOUBLE_BUFFER
8: //#include <stdint.h>
9: #define LCD_RES PIN_SPI_RES // RESET
10: #define LCD_RS PIN_SPI_CMDDATA // Data / Instruction
11: #define LCD_RW PIN_NOT_AVAILABLE // Read / Write
12: #define LCD_E PIN_SPI_CS // Enable
13: #define LCD_CTRL NRF_GPIO_PORT_SELECT_PORT3
14: #define LCD_DATA_OUT SPI0
15: #define LCD_DATA_IN SPI0
16: #define LCD_DDR SPI0
17:
18: #define LCD_SET_COL_HI 0x10
19: #define LCD_SET_COL_LO 0x00
20: #define LCD_SET_LINE 0x40
21: #define LCD_SET_CONTRAST 0x81
22: #define LCD_SET_SEG_REMAP0 0xA0
23: #define LCD_SET_SEG_REMAP1 0xA1
24: #define LCD_EON_OFF 0xA4
25: #define LCD_EON_ON 0xA5
26: #define LCD_DISP_NOR 0xA6
27: #define LCD_DISP_REV 0xA7
28: #define LCD_MULTIPLEX 0xA8
29: #define LCD_CHARGE_PUMP 0x8D
30: #define LCD_PUMP_OFF 0x10
31: #define LCD_PUMP_ON 0x14
32: #define LCD_DISP_OFF 0xAE
33: #define LCD_DISP_ON 0xAF
34: #define LCD_SET_PAGE 0xB0
35: #define LCD_SET_SCAN_FLIP 0xC0
36: #define LCD_SET_SCAN_NOR 0xC8
37: #define LCD_SET_OFFSET 0xD3
38: #define LCD_SET_RATIO_OSC 0xD5
39: #define LCD_SET_CHARGE 0xD9
40: #define LCD_SET_PADS 0xDA
41: #define LCD_SET_VCOM 0xDB
42: #define LCD_NOP 0xE3
43: #define LCD_SCROLL_RIGHT 0x26
44: #define LCD_SCROLL_LEFT 0x27
45: #define LCD_SCROLL_VR 0x29
46: #define LCD_SCROLL_VL 0x2A
47: #define LCD_SCROLL_OFF 0x2E
48: #define LCD_SCROLL_ON 0x2F
49: #define LCD_SCROLL_ON 0x2F
50: #define LCD_VERT_SCROLL_A 0xA3
51: #define LCD_MEM_ADDRESSING 0x20
52: #define LCD_SET_COL_ADDR 0x21
53: #define LCD_SET_PAGE_ADDR 0x22
54:
55: #define LCD_WIDTH 128
56: #define LCD_HIGHT 64
57: #define PIXELBITS 1
58: #define FOREGROUNDVRAMBASE 0x00
59: #define BACKGROUNDVRAMBASE 0x00
60:
61: extern uint16_t pointer;
62: extern uint8_t Underline;
63: extern uint8_t Negative;
64: extern uint8_t Sub;
65:
66: #define lcd_goto(x,y) { u8CursorX=(x); u8CursorY=(y); }
67: /* EXTERN Function Prototype(s) */
68: void GLCD_LcdInit (void);
69: void lcd_clear_graphics (void);
70: void GLCD_DisplayPicture (const uint8_t *pointer);
71: //void GLCD_Locate (uint8_t, uint8_t);
72: void GLCD_Print (const char *);
73: //uint8_t lcd_putsp(const char *);
74: //void lcd_puts (const char *);
75: //void lcd_clrs(char *);
76: //void GLCD_Clearchar(char);
77: void clr_display(void);
78: void show_display(void);
79: void set_pixel(uint8_t x, uint8_t y);
80: void lcd_line(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2);
81:
82: void write_buffer_display(uint8_t data);
83: void writeLow_buffer_display(int i, uint8_t data);
84: void writeHight_buffer_display(int i, uint8_t data);
85:
86: void write_lcd_display(uint8_t data);
87: void writeLow_lcd_display(int i, uint8_t data);
88: void writeHight_lcd_display(int i, uint8_t data);
89:
90: void zero_display(void);
91: void printF(uint8_t x, uint8_t y, int32_t Data);
92: uint8_t tiny_printp(uint8_t x, uint8_t y, const char *ptr);
93: uint8_t LcdDataRead(void);
94: void full_display(void);
95: void buffer_gotoxy(uint8_t x, uint8_t y);
96: void lcd_toxy(uint8_t x, uint8_t y);
97: void lcd_clear_graphics(void);
98: void lcd_load_Block_graphics(int x, int y, int index);
99: void lcd_clear_Block_graphics(int x, int y, int index);
100: void switch_frame(uint8_t index);
101: void SetInvert(uint8_t isOn);
102: void SetFont(uint8_t font_type);
103: void lcd_write_Block_graphics(int x, int y, int index);
104: void SetWriteTarget(uint8_t isOverWrite);
105: void Sleep(unsigned char a);
106:
107: int8_t drv_LcdWidth(void);
108: int8_t drv_LcdHeight(void);
109: int8_t drv_LcdPixelBits(void);
110: //void drv_LcdBackLightOn(void);
111: //uint8_t drv_LcdBackLightStatus(void);
112: //drv_LcdSetContrast(..);
113: //drv_LcdGetContrast(void);
114: //drv_SetLcdDrawType
115: //drv_GetLcdDrawType
116: void drv_LcdSetForegroundVRamBase(uint32_t);
117: uint32_t drv_LcdGetForegroundVRamBase(void);
118: void drv_LcdSetBackgroundVRamBase(uint32_t);
119: uint32_t drv_LcdGetBackgroundVRamBase(void);
120: //drv_LcdUpdate(void);
121: //drv_LcdUpdateArea(..);
122: //drv_DrawPixel
123: //drv_DrawVLine(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2)
124: //drv_DrawHLine(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2)
125: //drv_DrawLine(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2)
126: //drv_DrawRect(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2)
127: //drv_GetImage(..);
128: //drv_PutImage
129: //void drv_ClearScreen(void)
130: void drv_DrawChar(char);
131: void drv_ClearChar(char);
132: void drv_DrawString(const char *);
133: void drv_ClearString(const char *);
134:
135: extern void (*lcd_gotoxy) (uint8_t, uint8_t);
136: /* Global variables */
137: extern unsigned char u8CursorX, u8CursorY;
138: extern unsigned char dispPage, dispx;
139: extern uint32_t* s_spi_module;
140: #endif
141:
watch.h
1: #ifndef __WATCH_DISPLAY
2: #ifndef __WATCH_DISPLAY
3: #define __WATCH_DISPLAY
4: #include "ble_cts_date_time.h"
5: #include "Fonts_Graphic.h"
6: #include "SSD1306.h"
7:
8: //rename the font name (for message, date,calendar,time..)
9: // typedef FONT_INFO microsoftSansSerif_8ptFontInfo Font_Message;
10: // typedef FONT_INFO consolas_16ptFontInfo Font_NotiNum;
11: // typedef FONT_INFO date_16ptFontInfo Font_other;
12: // typedef FONT_INFO consolas_32ptFontInfo Font_Time;
13: //define the data struct for ble watch
14: //
15:
16: //define the macro
17: //define the font rename.
18: #define FONT_MESSAGE 0//microsoftSansSerif_8ptFontInfo
19: #define FONT_NOTINUM 1//consolas_16ptFontInfo
20: #define FONT_OTHER 2//date_16ptFontInfo
21: #define FONT_TIME 3//consolas_32ptFontInfo
22:
23: //define the origin point
24: #define ORIGIN_POINTX 0
25: #define ORIGIN_POINTY 0
26: #define ORIGIN (ORIGIN_POINTX,ORIGIN_POINTY)
27:
28: #define MSINGLE_POINTX 65
29: #define MSINGLE_POINTY 0
30: #define MAIN_SINGLE (MSINGLE_POINTX,MSINGLE_POINTY)
31:
32: #define MBATTERY_POINTX 105
33: #define MBATTERY_POINTY 0
34: #define MAIN_BATTERY (MBATTERY_POINTX,MBATTERY_POINTY)
35:
36: #define MHOUR_POINTX 0
37: #define MHOUR_POINTY 3
38: #define MAIN_HOUR (MBATTERY_POINTX,MBATTERY_POINTY)
39:
40: #define MMINUTE_POINTX 53
41: #define MMINUTE_POINTY 3
42: #define MAIN_MINUTE (MMINUTE_POINTX,MMINUTE_POINTY)
43:
44: #define MAMPM_POINTX 100
45: #define MAMPM_POINTY 4
46: #define MAIN_MAMPM (MAMPM_POINTX,MAMPM_POINTY)
47:
48: #define MDATE_POINTX 0
49: #define MDATE_POINTY 6
50: #define MAIN_DATE (MDATE_POINTX,MDATE_POINTY)
51:
52: #define SINGLE_POINTX 2
53: #define SINGLE_POINTY 0
54: #define ET_SINGLE (SSINGLE_POINTX,SSINGLE_POINTY)
55:
56: #define BATTERY_POINTX 103
57: #define BATTERY_POINTY 0
58: #define ET_BATTERY (MBATTERY_POINTX,MBATTERY_POINTY)
59:
60: #define HOUR_POINTX 35
61: #define HOUR_POINTY 0
62: #define ET_HOUR (SHOUR_POINTX_POINTX,SHOUR_POINTX_POINTY)
63:
64: #define MINUTE_POINTX 70
65: #define MINUTE_POINTY 0
66: #define ET_MINUTE (SMINUTE_POINTX,SMINUTE_POINTY)
67:
68: #define SSETITEM_POINTX 55
69: #define SSETITEM_POINTY 3
70: #define SET_ITEM (SMINUTE_POINTX,SMINUTE_POINTY)
71:
72: #define SSELECT_POINTX 0
73: #define SSELECT_POINTY 3
74: #define SELECT_ITEM (SSELECT_POINTX,SSELECT_POINTY)
75:
76: #define PAIR_POINTX 15
77: #define PAIR_POINTY 2
78: #define PAIR_FRAM (PAIR_POINTX,PAIR_POINTY)
79:
80:
81: #define DIRECT_POINTX 90
82: #define DIRECT_POINTY 7
83: #define DIRECT_ITEM (SSELECT_POINTX,SSELECT_POINTY)
84:
85:
86: #define ALARM_HOUR_POINTX 41
87: #define ALARM_HOUR_POINTY 6
88: #define ALARM_HOUR (ALARM_HOUR_POINTX,ALARM_HOUR_POINTY)
89:
90: #define ALARM_MINUTE_POINTX 70
91: #define ALARM_MINUTE_POINTY 6
92: #define ALARM_MINUTE (ALARM_MINUTE_POINTX,ALARM_MINUTE_POINTY)
93:
94: #define NOTI_MAIL_POINTX 9
95: #define NOTI_MAIL_POINTY 6
96: #define NOTI_MAIL (NOTI_MAIL_POINTX,NOTI_MAIL_POINTY)
97:
98: #define NOTI_CALL_POINTX 54
99: #define NOTI_CALL_POINTY 6
100: #define NOTI_CALL (NOTI_CALL_POINTX,NOTI_CALL_POINTY)
101:
102: #define NOTI_SMS_POINTX 95
103: #define NOTI_SMS_POINTY 6
104: #define NOTI_SMS (NOTI_SMS_POINTX,NOTI_SMS_POINTY)
105:
106: #define ALARM_POINTX 55
107: #define ALARM_POINTY 3
108: #define ALARM_ICON (SMINUTE_POINTX,SMINUTE_POINTY)
109:
110: #define ANCS_ITEM1_X 0
111: #define ANCS_ITEM1_Y 3
112: #define ANCS_ITEM2_X 0
113: #define ANCS_ITEM2_Y 5
114: #define ANCS_ITEM3_X 0
115: #define ANCS_ITEM3_Y 5
116:
117: #define ADDBOOK_TITLE_X 50
118: #define ADDBOOK_TITLE_Y 0
119:
120: #define ADDBOOK_CONTENT_X 0
121: #define ADDBOOK_CONTENT_Y 3
122:
123: #define PERIOD_VALUE 12
124: #define WRITE_BUFFER 0
125: #define WRITE_LCD 1
126:
127: extern const FONT_INFO *pFontInfo;// = &consolas_16ptFontInfo;
128: //function for watch
129: uint32_t DispalyInt(void );
130: void Switch_Page(uint8_t index, const ble_cts_date_time_t a_sTime,unsigned char toSubMode);
131: void SetDisplayInvert(uint8_t isTurnOn);
132: //draw the single
133: //need assign the x/y point and the rf single.
134: void DrawSingle(uint8_t x, uint8_t y, int value);
135: void UpdateRSSIStatus(unsigned char WorkMode, unsigned char SubMode,int value);
136: //draw the battery
137: //need assign the x/y point and the barry value.
138: void UpdateBatteryStatus(unsigned char WorkMode, unsigned char SubMode,int value);
139: void DrawBattery(uint8_t x, uint8_t y, int value);
140:
141: void SetFont(uint8_t font_type);
142: //draw information display
143: void SetCurrent_period(const ble_cts_date_time_t a_sTime);
144: void SetCurrent_time(const ble_cts_date_time_t a_sTime);
145: void SetCalendar(const ble_cts_date_time_t a_sTime);
146: void SetSmall_time(const ble_cts_date_time_t a_sTime);
147: void DrawSettinnItem(uint8_t index);
148: void ClearSettinnItem(uint8_t index);
149: void DrawDirectBar(uint8_t index);
150: void SetNotiNum(int8_t index);
151: int8_t GetNotiNum(void);
152: void DisplayAncsData(uint8_t select,int8_t);
153: void ShowAlarm_time(const ble_cts_date_time_t a_sTime);
154: void ShowAlarmIcon(void);
155: void ClearAlarmIcon(void);
156:
157:
158: //work mode
159: uint8_t isEntryIdle(void);
160: void m_oled_goto_idle(void);
161: void m_oled_go(void);
162: #endif
163: #define __WATCH_DISPLAY
164: #include "ble_cts_date_time.h"
165: #include "Fonts_Graphic.h"
166: #include "SSD1306.h"
167:
168: //rename the font name (for message, date,calendar,time..)
169: // typedef FONT_INFO microsoftSansSerif_8ptFontInfo Font_Message;
170: // typedef FONT_INFO consolas_16ptFontInfo Font_NotiNum;
171: // typedef FONT_INFO date_16ptFontInfo Font_other;
172: // typedef FONT_INFO consolas_32ptFontInfo Font_Time;
173: //define the data struct for ble watch
174: //
175:
176: //define the macro
177: //define the font rename.
178: #define FONT_MESSAGE 0//microsoftSansSerif_8ptFontInfo
179: #define FONT_NOTINUM 1//consolas_16ptFontInfo
180: #define FONT_OTHER 2//date_16ptFontInfo
181: #define FONT_TIME 3//consolas_32ptFontInfo
182:
183: //define the origin point
184: #define ORIGIN_POINTX 0
185: #define ORIGIN_POINTY 0
186: #define ORIGIN (ORIGIN_POINTX,ORIGIN_POINTY)
187:
188: #define MSINGLE_POINTX 65
189: #define MSINGLE_POINTY 0
190: #define MAIN_SINGLE (MSINGLE_POINTX,MSINGLE_POINTY)
191:
192: #define MBATTERY_POINTX 105
193: #define MBATTERY_POINTY 0
194: #define MAIN_BATTERY (MBATTERY_POINTX,MBATTERY_POINTY)
195:
196: // #define MHOUR_POINTX 1
197: // #define MHOUR_POINTY 3
198: // #define MAIN_HOUR (MBATTERY_POINTX,MBATTERY_POINTY)
199:
200: // #define MMINUTE_POINTX 55
201: // #define MMINUTE_POINTY 3
202: // #define MAIN_MINUTE (MMINUTE_POINTX,MMINUTE_POINTY)
203:
204: #define MAMPM_POINTX 100
205: #define MAMPM_POINTY 4
206: #define MAIN_MAMPM (MAMPM_POINTX,MAMPM_POINTY)
207:
208: #define MDATE_POINTX 0
209: #define MDATE_POINTY 6
210: #define MAIN_DATE (MDATE_POINTX,MDATE_POINTY)
211:
212: #define SINGLE_POINTX 2
213: #define SINGLE_POINTY 0
214: #define ET_SINGLE (SSINGLE_POINTX,SSINGLE_POINTY)
215:
216: #define BATTERY_POINTX 103
217: #define BATTERY_POINTY 0
218: #define ET_BATTERY (MBATTERY_POINTX,MBATTERY_POINTY)
219:
220: #define ANCS_NOTI_POINTX 90
221: #define ANCS_NOTI_POINTY 0
222: #define ANCS_NOTI (MBATTERY_POINTX,MBATTERY_POINTY)
223:
224: // #define HOUR_POINTX 38
225: // #define HOUR_POINTY 0
226: // #define ET_HOUR (SHOUR_POINTX_POINTX,SHOUR_POINTX_POINTY)
227:
228: #define MINUTE_POINTX 70
229: #define MINUTE_POINTY 0
230: #define ET_MINUTE (SMINUTE_POINTX,SMINUTE_POINTY)
231:
232: #define SSETITEM_POINTX 55
233: #define SSETITEM_POINTY 3
234: #define SET_ITEM (SMINUTE_POINTX,SMINUTE_POINTY)
235:
236: #define SSELECT_POINTX 0
237: #define SSELECT_POINTY 3
238: #define SELECT_ITEM (SSELECT_POINTX,SSELECT_POINTY)
239:
240: #define PAIR_POINTX 15
241: #define PAIR_POINTY 2
242: #define PAIR_FRAM (PAIR_POINTX,PAIR_POINTY)
243:
244:
245: #define DIRECT_POINTX 90
246: #define DIRECT_POINTY 7
247: #define DIRECT_ITEM (SSELECT_POINTX,SSELECT_POINTY)
248:
249:
250: #define ALARM_HOUR_POINTX 41
251: #define ALARM_HOUR_POINTY 6
252: #define ALARM_HOUR (ALARM_HOUR_POINTX,ALARM_HOUR_POINTY)
253:
254: #define ALARM_MINUTE_POINTX 70
255: #define ALARM_MINUTE_POINTY 6
256: #define ALARM_MINUTE (ALARM_MINUTE_POINTX,ALARM_MINUTE_POINTY)
257:
258: #define NOTI_MAIL_POINTX 9
259: #define NOTI_MAIL_POINTY 6
260: #define NOTI_MAIL (NOTI_MAIL_POINTX,NOTI_MAIL_POINTY)
261:
262: #define NOTI_CALL_POINTX 54
263: #define NOTI_CALL_POINTY 6
264: #define NOTI_CALL (NOTI_CALL_POINTX,NOTI_CALL_POINTY)
265:
266: #define NOTI_SMS_POINTX 95
267: #define NOTI_SMS_POINTY 6
268: #define NOTI_SMS (NOTI_SMS_POINTX,NOTI_SMS_POINTY)
269:
270: #define ALARM_POINTX 55
271: #define ALARM_POINTY 3
272: #define ALARM_ICON (SMINUTE_POINTX,SMINUTE_POINTY)
273:
274: #define SPORT_POINTX 5
275: #define SPORT_POINTY 4
276: #define SPORT_FRAM (SPORT_POINTX,SPORT_POINTX)
277:
278:
279: #define ANCS_ITEM1_X 0
280: #define ANCS_ITEM1_Y 3
281: #define ANCS_ITEM2_X 0
282: #define ANCS_ITEM2_Y 5
283: #define ANCS_ITEM3_X 0
284: #define ANCS_ITEM3_Y 5
285:
286: #define GPS_DIS_POINTX 40
287: #define GPS_DIS_POINTY 3
288:
289: #define FILENAME_POINTX 38
290: #define FILENAME_POINTY 6
291:
292: #define ACC_COUNT_POINTX 38
293: #define ACC_COUNT_POINTY 6
294:
295: #define MUSIC_CONTROL_POINTX 100
296: #define MUSIC_CONTROL_POINTY 4
297:
298: #define PERIOD_VALUE 12
299: #define WRITE_BUFFER 0
300: #define WRITE_LCD 1
301:
302: #define TURN_ON 1
303: #define TURN_OFF 0
304:
305: extern const FONT_INFO *pFontInfo;// = &consolas_16ptFontInfo;
306: //function for watch
307: uint32_t DispalyInt(void );
308: void Switch_Page(uint8_t index, const ble_cts_date_time_t a_sTime,unsigned char toSubMode);
309: void SetDisplayInvert(uint8_t isTurnOn);
310: //draw the single
311: //need assign the x/y point and the rf single.
312: void DrawSingle(uint8_t x, uint8_t y, int value);
313: void UpdateRSSIStatus(unsigned char WorkMode, unsigned char SubMode,int value);
314: //draw the battery
315: //need assign the x/y point and the barry value.
316: void UpdateBatteryStatus(unsigned char WorkMode, unsigned char SubMode,int value);
317: void DrawBattery(uint8_t x, uint8_t y, int value);
318:
319: void SetFont(uint8_t font_type);
320: //draw information display
321: void SetCurrent_period(const ble_cts_date_time_t a_sTime);
322: void SetCurrent_time(const ble_cts_date_time_t a_sTime);
323: void SetCalendar(const ble_cts_date_time_t a_sTime);
324: void SetSmall_time(const ble_cts_date_time_t a_sTime);
325: void DrawSettinnItem(uint8_t index);
326: void ClearSettinnItem(uint8_t index);
327: void DrawDirectBar(uint8_t index);
328: void SetNotiNum(int8_t index);
329: int8_t GetNotiNum(void);
330: void DisplayAncsData(uint8_t select,int8_t);
331: void ShowAlarm_time(const ble_cts_date_time_t a_sTime);
332: void ShowAlarmIcon(void);
333: void ClearAlarmIcon(void);
334: void ClearNotiIcon(void);
335: void DrawNotiIcon(void);
336: void ClearNotiIcon(void);
337: void ClearSingle(uint8_t x, uint8_t y);
338: void DisplayAddressBook(uint8_t *);
339: uint8_t* GetAddressBookData(uint8_t select, int8_t index);
340: void ShowGPS_Distance(const uint16_t dis);
341: void ShowFileName(const uint8_t* filename);
342: void ShowAcc_Count(const uint16_t dis);
343: //work mode
344: uint8_t isEntryIdle(void);
345: void m_oled_goto_idle(void);
346: void m_oled_go(void);
347: void DrawMusicControl(uint8_t isTurnOn);
348: void DrawSportControl(uint8_t isTurnOn);
349:
350: #endif
font_graphic.h
1: #ifndef __FONTS_GRAPHIC
2: #define __FONTS_GRAPHIC
3: #include <stdint.h>
4: #include <string.h>
5:
6: //for the version 0.4 ble watch
7:
8: #define SIGNAL_80 0 // 80%
9: #define SIGNAL_60 1 // 60%
10: #define SIGNAL_40 2 // 40%
11: #define SIGNAL_20 3 // 20%
12: #define SIGNAL_00 4 // 00%
13:
14: #define BATTERY_80 5 //battery 80
15: #define BATTERY_60 6 //battery 60
16: #define BATTERY_40 7 //battery 40
17: #define BATTERY_20 8 //battery 40
18:
19: #define BULB_ON 9
20: #define BULB_OFF 10
21:
22: #define LEFT 11
23: #define RIGHT 12
24:
25: #define ALL_BLACK 13 //10
26: #define HALF_BLACK 14 //50
27: #define LOW_BLACK 15 //100
28:
29: #define BUZZER_OFF 16
30: #define BUZZER_ON 17
31:
32: #define VIBRATEICON 18
33:
34: #define PAIR 19
35: #define UNPAIR 20
36:
37: #define PULL_LEFT 21
38: #define PULL_MID 22
39: #define PULL_RIG 23
40: #define SELECT_LIGHT 24
41: #define SELECT_BUZZER 25
42: #define TOPAIR 26
43: #define TOFINDME 27
44: #define SPORTMODE 28
45: #define MUSIC_PLAY_ICON 29
46: #define MUSIC_PAUSE_ICON 30
47: #define SPORT_START_ICON 31
48: #define SPORT_STOP_ICON 32
49: //-------------
50: #define MAIN_FRAME 0
51: #define SETTING_FRAME 1
52: #define SELECT_FRAME 2
53: #define ALARM_FRAME 3
54: #define NOTI_FRAME 4
55: #define NNOTI_FRAME 5
56: #define PAIR_FRAME 6
57: #define ADDRESS_FRAME 7
58: #define FINEME_FRAME 8
59: #define SPORT_FRAME 9
60: //define the font rename.
61: #define FONT_MESSAGE 0//microsoftSansSerif_8ptFontInfo
62: #define FONT_NOTINUM 1//consolas_16ptFontInfo
63: #define FONT_OTHER 2//date_16ptFontInfo
64: #define FONT_TIME 3//consolas_32ptFontInfo
65:
66: // This structure describes a single character's display information
67: typedef struct
68: {
69: const uint8_t widthBits; // width, in bits (or pixels), of the character
70: const uint8_t hightByte; // hight, in bits (or pixels), of the character
71: const uint16_t offset; // offset of the character's bitmap, in bytes, into the the FONT_INFO's data array
72: } FONT_CHAR_INFO;
73:
74: // Describes a single font
75: typedef struct
76: {
77: const uint8_t heightPages; // height, in pages (8 pixels), of the font's characters
78: const uint8_t startChar; // the first character in the font (e.g. in charInfo and data)
79: const uint8_t endChar; // the last character in the font
80: const uint8_t spacePixels; // number of pixels that a space character takes up
81: const FONT_CHAR_INFO* charInfo; // pointer to array of char information
82: const uint8_t* data; // pointer to generated array of character visual representation
83: } FONT_INFO;
84:
85: // This structure describes a single character's display information
86: typedef struct
87: {
88: const uint8_t widthBits; // width, in bits (or pixels), of the character
89: const uint8_t hightByte; // hight, in bits (or pixels), of the character
90: const uint16_t offset; // offset of the character's bitmap, in bytes, into the the FONT_INFO's data array
91: } GRAHPIC_PIC_INFO;
92:
93: // Describes a grahpic
94: typedef struct
95: {
96: const uint8_t m_version;
97: const uint8_t s_version; // the first character in the font (e.g. in charInfo and data)
98: const GRAHPIC_PIC_INFO* grahInfo; // pointer to array of char information
99: const uint8_t* data; // pointer to generated array of character visual representation
100: } FIXGRAHPIC_INFO;
101:
102:
103: // This structure describes a single character's display information
104: typedef struct
105: {
106: const uint8_t widthBits; // width, in bits (or pixels), of the character
107: const uint8_t hightByte; // hight, in bits (or pixels), of the character
108: const uint16_t offset; // offset of the character's bitmap, in bytes, into the the FONT_INFO's data array
109: } FRAME_INFO;
110: // Describes a frame stack
111: typedef struct
112: {
113: const uint8_t m_version;
114: const uint8_t s_version; // the first character in the font (e.g. in charInfo and data)
115: const FRAME_INFO* grahInfo; // pointer to array of char information
116: const uint8_t* data; // pointer to generated array of character visual representation
117: } FRAMEGRAHPIC_INFO;
118:
119: //for the font assert,for the ssd1306
120: extern const FONT_INFO fiveBySevenFontInfo;
121: extern const FONT_INFO microsoftSansSerif_8ptFontInfo;
122: extern const FONT_INFO consolas_16ptFontInfo;
123: extern const FONT_INFO date_16ptFontInfo ;
124: extern const FONT_INFO consolas_32ptFontInfo;
125:
126: // for graphic assert
127: extern const FIXGRAHPIC_INFO watch_graphic ;
128: extern const FRAMEGRAHPIC_INFO frame_graphic;
129:
130: #endif
bitmapDb.h
1: /**************************************************************************
2: *
3: * FILE NAME: bitmapDb.h
4: * FILE DESCRIPTION: Database of all bitmaps in the system
5: *
6: * FILE CREATION DATE: 24-07-2009
7: *
8: *==========================================================================
9: *
10: * Modification history:
11: * --------------------
12: * 01a,24jul09 erd written
13: *
14: ***************************************************************************/
15:
16: #ifndef __BITMAP_DB_H_
17: #define __BITMAP_DB_H_
18:
19: // ==========================================================================
20: // structure definition
21: // ==========================================================================
22:
23: // This structure describes a single character's display information
24: typedef struct
25: {
26: const uint_8 widthBits; // width, in bits (or pixels), of the character
27: const uint_16 offset; // offset of the character's bitmap, in bytes, into the the FONT_INFO's data array
28:
29: } FONT_CHAR_INFO;
30:
31: // Describes a single font
32: typedef struct
33: {
34: const uint_8 heightPages; // height, in pages (8 pixels), of the font's characters
35: const uint_8 startChar; // the first character in the font (e.g. in charInfo and data)
36: const uint_8 endChar; // the last character in the font
37: const uint_8 spacePixels; // number of pixels that a space character takes up
38: const FONT_CHAR_INFO* charInfo; // pointer to array of char information
39: const uint_8* data; // pointer to generated array of character visual representation
40:
41: } FONT_INFO;
42:
43: #endif /* __BITMAP_DB_H_ */
ref:
http://www.pavius.net/2009/07/the-dot-factory-an-lcd-font-and-image-generator/
https://github.com/pavius/The-Dot-Factory
backup:
https://drive.google.com/file/d/0B2uYQcUgyMUJbGJ2YnVWbjhlMDQ/edit?usp=sharing
https://drive.google.com/file/d/0B2uYQcUgyMUJZ3NhdkNXT0ljS28/edit?usp=sharing
訂閱:
文章 (Atom)