IAR可以將C轉換成8051,
接著再用BTool等工具將8051程式碼燒錄到晶片上
但TI提供的Souce code很複雜
裡面有OSAL這個半OS的核心在運行
可以參考
http://thinkingiot.blogspot.tw/2015/02/ti-ble-stack-osal-cc254x.html
如果開發板不屬於TI, 可以porting 自己的 driver 到 HAL 內, 所以可以在 SW 繼續使用 HAL 定義的 API
IO控制
https://my.oschina.net/u/184090/blog/333164
類似成品 - 成大BLE 藍牙貼片體溫計
http://blog.mainpi.com/archives/190
BLE Peripheral用法
http://gogoprivateryan.blogspot.tw/2014/09/cc2540-bluetooth-low-energy-3.html
藍芽學習ADC
http://www.cnblogs.com/chenzhao207/p/4539197.html
ADC 2541
http://www.cnblogs.com/chenzhao207/p/4539197.html
藍牙溫度傳送
http://www.voidcn.com/blog/feilusia/article/p-4982949.html
2016年11月29日 星期二
CC2541 2.4-GHz Bluetooth™ low energy and Proprietary System-on-Chip
現在改用TI的CC2541, 裡面有藍芽、MCU
http://www.deyisupport.com.edgekey.net/question_answer/wireless_connectivity/bluetooth/f/103/t/89363.aspx
http://www.deyisupport.com.edgekey.net/question_answer/wireless_connectivity/bluetooth/f/103/p/50367/154200.aspx
CC2540/CC2541的基本操作
http://www.programgo.com/article/63055415794/
http://www.deyisupport.com.edgekey.net/question_answer/wireless_connectivity/bluetooth/f/103/t/89363.aspx
http://www.deyisupport.com.edgekey.net/question_answer/wireless_connectivity/bluetooth/f/103/p/50367/154200.aspx
CC2540/CC2541的基本操作
http://www.programgo.com/article/63055415794/
CC2541 BLE Peripheral工程的建立
http://ziye334.lofter.com/post/2435a3_295a74cTI CC2541的狗日的Key
http://www.cnblogs.com/Montauk/p/5892047.html
2016年10月13日 星期四
在Android上繪出折線圖、條狀圖、圓餅圖
要在Android上畫圖,這次選擇了AChartEngine,
jar下載 -> http://code.google.com/p/achartengine/downloads/detail?name=achartengine-1.0.0.jar&can=2&q=
配置自己要的位置做一個linearlayout, 就可以把圖放進去想要的地方
View chart = ChartFactory.getLineChartView(this, dataset, renderer); layout.addView(chart,new LayoutParams(LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
http://cheng-min-i-taiwan.blogspot.tw/2012/09/android.html
http://cheng-min-i-taiwan.blogspot.tw/2013/09/android.html
Android Studio 無顯示layout預覽圖原因
先前裝1.3.1版Android Studio,
在對應到SDK21之後常會有無法顯示預覽圖的情況
更新版本到2.2.1就改善了,而且現在不只有實際的Layout
還有一個虛擬的配置圖,可以看到重疊的部分等等的
在對應到SDK21之後常會有無法顯示預覽圖的情況
更新版本到2.2.1就改善了,而且現在不只有實際的Layout
還有一個虛擬的配置圖,可以看到重疊的部分等等的
2016年10月6日 星期四
PIC16LF1782 終於搞定ADC
換了一顆PIC之後順遂多啦!
原來FVR功能就只是拿來當參考電壓,之前搞得太複雜了
網路狀態會影響MPLAB X 3.40開啟的失敗
uint16_t ADCResult,TM;
uint8_t adhundreds, adtens, adones, adoneth, adtenth;
double VTao;
typedef unsigned char uint8_t;
void USART_putstring(char* StringPtr){
while(*StringPtr != 0x00){
EUSART_Write(*StringPtr);
StringPtr++;}
}
void get_temperature()
{
char charADC[8];
ADCResult = 0x0000;
ADCResult = ADC_GetConversion(channel_AN4);
ADCResult &= 0x0FFF;
// sprintf(charADC,"%u",ADCResult);
// USART_putstring("ADCResult AN4 = ");
// USART_putstring(charADC);
// USART_putstring("\r\n");
VTao = ADCResult*0.5;
// sprintf(charADC,"%d",VTao);
// USART_putstring("VTao = ");
// USART_putstring(charADC);
// USART_putstring("\r\n");
TM=211048.6 - ( 192.1 * VTao);
adtens = TM/10000;
adtens = adtens%10;
adones = TM/1000;
adones = adones%10;
adoneth = TM/100;
adoneth = adoneth%10;
adtenth = TM/10;
adtenth = adtenth%10;
adhundreds = TM;
adhundreds = adhundreds%10;
sprintf(charADC,"%d%d.%d%d%d",adtens,adones,adoneth,adtenth,adhundreds);
USART_putstring(charADC);
// USART_putstring("\r\n");
}
/*
Main application
*/
void main(void) {
SYSTEM_Initialize();
while (1) {
get_temperature();
__delay_ms(500);
}
}
搞定了硬體方面,現在要開始搞App囉
原來FVR功能就只是拿來當參考電壓,之前搞得太複雜了
網路狀態會影響MPLAB X 3.40開啟的失敗
uint16_t ADCResult,TM;
uint8_t adhundreds, adtens, adones, adoneth, adtenth;
double VTao;
typedef unsigned char uint8_t;
void USART_putstring(char* StringPtr){
while(*StringPtr != 0x00){
EUSART_Write(*StringPtr);
StringPtr++;}
}
void get_temperature()
{
char charADC[8];
ADCResult = 0x0000;
ADCResult = ADC_GetConversion(channel_AN4);
ADCResult &= 0x0FFF;
// sprintf(charADC,"%u",ADCResult);
// USART_putstring("ADCResult AN4 = ");
// USART_putstring(charADC);
// USART_putstring("\r\n");
VTao = ADCResult*0.5;
// sprintf(charADC,"%d",VTao);
// USART_putstring("VTao = ");
// USART_putstring(charADC);
// USART_putstring("\r\n");
TM=211048.6 - ( 192.1 * VTao);
adtens = TM/10000;
adtens = adtens%10;
adones = TM/1000;
adones = adones%10;
adoneth = TM/100;
adoneth = adoneth%10;
adtenth = TM/10;
adtenth = adtenth%10;
adhundreds = TM;
adhundreds = adhundreds%10;
sprintf(charADC,"%d%d.%d%d%d",adtens,adones,adoneth,adtenth,adhundreds);
USART_putstring(charADC);
// USART_putstring("\r\n");
}
/*
Main application
*/
void main(void) {
SYSTEM_Initialize();
while (1) {
get_temperature();
__delay_ms(500);
}
}
搞定了硬體方面,現在要開始搞App囉
BluetoothLeScanner.startScan with Android 5 or later
要多一個 permission
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
LOLLIPOP之後的要使用startScan();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mBluetoothAdapter.startScan(); } else { mBluetoothAdapter.startLeScan(mLeScanCallback); }
2016年9月20日 星期二
訂閱:
文章 (Atom)