2018年7月30日 星期一

Unsigned and signed shift:logical shift and arithmetic shift

In C, we usually use left shift and right shift operation << and >> to operate multiple / divide to variable with power of 2,ex: 4<<2  = 16

But when we use the signed variable and the shift operation we must consider the singed bit.See the below example code.

Since the C language support the arithmetic left shift and logic right shift,  we must consider the signed bit to  avoid some bug in code.



Ref:
     1.Logical Vs. Arithmetic Shift
     2.C语言中的逻辑右移和算术左移

2018年5月28日 星期一

2018年5月13日 星期日

GO: Development a simple windows GUI use lxn-walk package(2) -- Combobox and Button

1.Create the project folder and win_gui_v1.go in your go work space
   > cd ..\src\
   > mkdir win_gui_v1
2.Copy the .manifest file and modify to your_execution.exe.manifest
 












3.Code
3.Result
 











Ref:
      1. Go实战--使用golang开发Windows Gui桌面程序(lxn/walk)
      2. ComboBox 類別
      3. lxn/walk/examples

2018年5月6日 星期日

GO: Development a simple windows GUI use lxn-walk package(1) -- Getting start


"Walk is a "Windows Application Library Kit" for the Go Programming Language.
Its primarily useful for Desktop GUI development".  In this series I try to build a simple terminal program to commnunicate via COM port.

1. Getting start
    >   go get github.com/lxn/walk

2. Build the example
     >   cd ..\src\github.com\lxn\walk\examples\imageviewer
     >   go build

3. run the imageviewer.exe

  
    






Ref:
    1.  l/walk

GO : List all the serial port in windows use golang-sys package

We can easily get all the serial port in windows using regedit.exe











In our application we read the windows register key `HARDWARE\\DEVICEMAP\\SERIALCOMM` through windows API and list all the sub key and value.


Github project: win_serial_console

2018年4月2日 星期一

CC2640:Change RF front end mode and bias

1. In ../main.c define your own BLE configuration template.
2.The option and default configuration is define in ../ble_user_config.h
 

The internal bias and external bias is determine by the RX_TX pin, which didn't implement in 7x7 package.In our application we use the CC2592 as PA and use 5x5 package for smaller footprint, and the configuration is differential mode internal bias.


Ref:
      1.CC26xx HW Training : RF Front End options and Antennas
      2.CC2640 在 Beacon 应用中的实现方法
      3.CC26x0 SimpleLink™Bluetooth®low energy Software Stack 2.2.xDeveloper's Guide

2018年1月17日 星期三

CC2640:Use System_printf in project.

1.I use IAR as IDE to develop CC2640 BLE project and XDS100V3 as debugger.First make sure           enable the Semihosted and Via semihosting in General Options.
 
2.Add below code in app_ble.cfg file.
 

3.Add include header file and test.



4.In debug mode enable View->Terminal I/O and we can see the Hello World! in terminal.




















Ref:
     1.System_printf and printf() on CC2650 sensorTag
     2.System_printf supported format specifications

Linux driver: How to enable dynamic debug at booting time for built-in driver.

 Dynamic debug is useful for debug driver, and can be enable by: 1. Mount debug fs #>mount -t debugfs none /sys/kernel/debug 2. Enable dy...