C# || .ToList() in .NET2.0

December 29, 2016 Leave a comment

Sometimes it is necessary to code with old framework, like 2.0.
It hasn’t .ToList() extension method for IEnumerable objects.

well, here it is :

static  public List<tsource>  ToList<tsource>(this IEnumerable<tsource> source)
IEnumerator<tsource> en = source.GetEnumerator();
List<tsource> list = new List<tsource>();
while (en.MoveNext())
return list;

Categories: Uncategorized

Raspberry Pi 3 totally headless setup with VNC @ WiFi

December 29, 2016 Leave a comment

Long time since last post.
Some notes here :

Objective : setup RPi 3 without the need for external display nor keyboard.

1. get NOOBS (2.1.0 used here)
2. format SD card as FAT (full capacity) – SDFormatterv4.zip used
3. extract NOOBS zip content to root dir of SD card
4. prepare wpa_supplicant.conf with your WiFi access details, then save it to root dir of SD card along other NOOBS files
Like this:

# /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


5. edit with unix-text-file compatible editor (like Cream gvim) file on SD card :

insert somewhere in the middle line :

if [ -e /settings/wpa_supplicant.conf ] ; then cp /settings/wpa_supplicant.conf /tmp/2/etc/wpa_supplicant/wpa_supplicant.conf ; fi

6. Have TightVNC or RealVNC installed on your PC/Mac.
7. Insert SD Card into RaspberryPi3 and power it on
8. Find IP of your RPi3 – easiest way -> look at website of your router (RPi3 should be named “recovery”)
9. Insert IP address into VNC viewer soft, and you’ll probably get ERROR 10061 – connection refused – that’s because you’re too late right now. NOOBS VNC connection server will be available only for few seconds after RPi bootup.
10. Power down your RPi3 (pull the power plug)
11. Tap connect on your VNC viewer and simultaneously power on RPi3 now – it should connect right now – you’ll see NOOBS installer with available options…


Of course there is one another problem – how to run headlessly raspi-config after successful install of Raspbian lite … 😉

EDIT: To allow SSH into newly installed system, you have to :
1. Put empty file named “ssh” (no extension) into root dir of your SD card (‘boot’ FAT-volume)

and it works great !

Categories: Uncategorized

PCD8544 | a command not very documented…

October 1, 2013 Leave a comment

Today I was getting some old nokia 3310 LCD back alive and found one kind of weird acting. The display was scrolled up by few lines. I get through datasheet but nothing useful seems to be found at first sight. Getting fed with it I wrote few lines to play over undocumented ones, or I should rather say, reserved commands.
The one I was looking for was obviously the last. (Hail to the Murphy!).
Switching the extended instruction set write(0x21,pin_DC=0) gives you access to 0x40 command, which presents analogy to its normal-instruction-set counterpart.
So, write(0x40 | y_offset,pin_DC=0) gives you Y-scroll or Y-shift command, in single line units.
Seems that controller has more than expected amount of DDRAM…


Categories: Uncategorized

JewelryBox & Mac OS X 10.8.3 – solutions…

September 27, 2013 Leave a comment

First of all, you need to have password for your user account. (It may seems silly, but it is required by sudo.
Then you have to sudo nano /etc/sudoers file and add line Defaults !requiretty.
Obviously install XCode 4.3+ and command_line_tools from Apple Dev.
After those simple steps, install & run JewelryBox and pick the right ruby you want.

Categories: Uncategorized Tags:

RFM22 Library update

December 14, 2012 7 comments


During development of my tools and toys, RFM22 library evolved slightly. Still, it isn’t very commented, it lacks proper code partition into *.h and *.c, but it works (this is the one and only value I can find). Sorry. I’m providing it without any guarantee. Use it as it is, or as a reference, addressing functional details.

Here’s link  :

Categories: Uncategorized Tags: , ,

Nokia N85 / N86 AMOLED interfacing (& surprise) …

October 23, 2011 27 comments

Have a look at it :

Notice that it is an AMDN001 marked module (which is, in fact, real AMOLED from N85/86).

Now the surprise : it works with the command set known from E51/6500c LCDs…
Yes! No changes, just solder the wires, build +5V/-5V DC-DC converter & Voilla…

The DC-DC can looks like : (I’ve managed to homemade it on 2.5×3.0cm single sided PCB).

TPS65136 is available in QFN package only, its tricky to solder it at home, but having any hot-air & flux should do the trick. Remember that thermal pad should be GND-ed (& soldered too, of course).

UPDATE #1: There is one error in schematic – the L1 inductor should be 2.2uH or 4.7uH instead of 10mH (ekhm… “hardly available” 🙂 ).
To successfully drive this AMOLED it is sufficient to have such wiring : D0-D7, RES, WR, DC for control, and power sources : 3V3, ELVDD, ELVSS.
There is no need for 1V8 and level shifters like LVC4245. Driving VIO pin (12) with 3.3V voltage we’re getting whole interface bus working at 3.3V. (Don’t know exact timing impact with such voltage change, but it works at full speed achievable with PIC32MX parallel master port)

Nokia Display Modules Hacking Platform :)

October 18, 2011 4 comments

NDMHP in short 🙂 easy, huh ?

Today, I’ve got some hardware & software to share – In the meantime I’ve created some nice piece of hardware, and I named it as you can see above.
It consists of :
1). PIC32MX340F512H prototype board (PIC & necessary components to run it)
2). Voltage-level shifter based on LVC4245
3). Adapter board with voltage inverter & stabilizer (~+5V/-5V for amoled display) – not recommended to use, try to get TPS65136 (www.ti.com/product/tps65136) instead.
4). Power source with different voltages (1.8V, 2.5V, 3.3V, 5.0V, 12.0V)

Here comes some pictures of this crap :

Fig.1. PIC32MX proto-board

Fig.2. Level-shifter & n86 adapter board with DC-DC inverter & stabilizer

Fig.3. Photo of working AMDF001 connected to that crap above.

Here comes some schematics :
1) I would not provide you with proto-board of PIC32MX, because it is so self understandable, that it would be a shame to do this…
2) Level-shifter & n86 adapter board :

And some code, (very dirty but working…) :

Some description :
PC is connected to PIC32 via RS232 @ 57600 bauds (MAX3232 not visible – mounted inside COM1 plug, powered from PIC32 proto-board). PC is running C# program – win_amo_hack, PIC32 is flashed with included code (n86_amoled_hack).
Communication protocol PCPIC is described below :
– commands are sent as text strings
– commands :
a) ‘r’ – reset (assert RESX line low for 5ms & release high)
b) ‘C’ – pull chip select low (CSX=LOW)
c) ‘c’ – release chip select high (CSX=HIGH)
d) ‘i[xx]’ – write index register/execute command simple command (DCX=LOW, perform write of hexadecimal number [xx] via ParallelMasterPort, eg. “i29” – send DISP_ON command on MP1.0 protocol
e) ‘d[xx]’ – write single byte of data (DCX=HIGH, perform write of hex [xx] via PMP, eg. “d00” – send 0x00 to LCD)
f) ‘t’ – return tearing line status (returns t00 or t01 according to TE line level)
g) ‘g’ – read register or data (DCX=HIGH & perform read via PMP)

“i01i11i29” – this string will initialize MP1.0 display (reset, sleep-out, display-on)
“i2cd00d11d22” – this string will send one pixel data (0x2c – GRAM_WRITE), color 0x001122

Win_amo_hack has also ability of execution of Lua scripts.
It defines two functions : amoSend & amoTear. First one takes single string argument & sends that string to PIC32. Second one returns TE line status as a byte.

Sample Lua script :

for y=0,319 do
for x=0,239 do

Well, that’s basically it.
This platform is quite powerfull and can be used to hack multiple types of LCDs, as long as LCD is interfacing via Intel-80 parallel bus.

Have fun.