In MircoC Pro for dsPIC How can I setup the watchdog timer? - mikroc

I need to set the FWDT to have the WDT be on, the prescaler be 1 and the postscaler be 12.
I can't find any documentation on how to do this programmatically, or any way at all. I can see from the data sheet that I need to set FWDT, but I can't see how to do that.
I tried
_FWDT(0xdc);
But that gives me a compiler error "specifier needed"?

The answer, you fool, is that MicroC Pro for dsPIC allows you to set all that in the project configuration.
Any halfwitted simpleton would have looked there first. Who needs documentation? Pah!
In the main menu, select Project > Edit Project and that will bring up the following dialogue:
Scroll to the bottom to find the watchdog timer settings and you will be able to set the things you need.

Related

KDE Taskbar Progress

I am trying to show a progress in the taskbar of the plasma desktop using the KDE Frameworks. In short, it want to do the same thing as dolphin, when it copies files:
I'm kinda stuck, because I don't even know where to get started. The only thing I found that could be useful is KStatusBarJobTracker, but I don't know how to use it. I could not find any tutorials or examples how to do this.
So, after digging around, and thanks to the help of #leinir, I was able to find out the following:
Since Plasma 5.6 KDE supports the Unitiy DBus Launcher-API, which can be used, for example, to show progress
I found a post on AskUbuntu that explains how to use the API with Qt
The real problem is: This only works, if you have a valid desktop file in one of the standard locations! You need to pass the file as parameter of the DBus message to make it work.
Based on this information, I figured out how to use it and created a GitHub repository, that supports cross platform taskbar progress, and uses this API for the linux implementation.
However, here is how to do it anyways. It should work for KDE Plasma and the Unity desktop, maybe more (haven't tried any others):
Create a .desktop file for your application. For test purpose, this can be a "dummy" file, that could look like this:
[Desktop Entry]
Type=Application
Version=1.1
Name=MyApp
Exec=<path_to>/MyApp
Copy that file to ~/.local/share/applications/ (or wherever user specific desktop files go on your system)
In your code, all you need to do is execute the following code, to update the taskbar state:
auto message = QDBusMessage::createSignal(QStringLiteral("/com/example/MyApp"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
//you don't always have to specify all parameters, just the ones you want to update
QVariantMap properties;
properties.insert(QStringLiteral("progress-visible"), true);// enable the progress
properties.insert(QStringLiteral("progress"), 0.5);// set the progress value (from 0.0 to 1.0)
properties.insert(QStringLiteral("count-visible"), true);// display the "counter badge"
properties.insert(QStringLiteral("count"), 42);// set the counter value
message << QStringLiteral("application://myapp.desktop") //assuming you named the desktop file "myapp.desktop"
<< properties;
QDBusConnection::sessionBus().send(message);
Compile and run your application. You don't have to start it via the desktop file, at least I did not need to. If you want to be sure your application is "connected" to that desktop file, just set a custom icon for the file. Your application should show that icon in the taskbar.
And thats basically it. Note: The system remembers the last state when restarting the application. Thus, you should reset all those parameters once when starting the application.
Right, so as it turns out you are right, there is not currently a tutorial for this. This reviewboard request, however, shows how it was implemented in KDevelop, and it should be possible for you to work it out through that :) https://git.reviewboard.kde.org/r/127050/
ps: that there is no tutorial now might be a nice way for you to hop in and help out, by writing a small, self contained tutorial for it... something i'm sure would be very much welcomed :)

watch state change over time in atmel studio?

Currently I test my code by debugging in simulator mode and breaking, messing with I/O, and beginning debugger again.
What if I have state that changes on a period though? Is there a way I can just let it 'run' and observe its state change?
I belive the LiveWatch functionality should satisfy your needs.
http://www.atmel.com/webdoc/livewatch/pr01.html
More on how to use it here:
http://www.atmel.com/webdoc/livewatch/livewatch.example.run.html

How to create settings with dynamic dependencies?

I want a setting to depend on settings of a dynamic list of other projects (well, executed at SBT setting start up, but dynamic in the sense that it is not hard-coded).
I have Def.dynTask to produce a task with a dynamic dependency on other tasks.
Is there a similar way to do this for settings, i.e. produce a setting with a dynamic dependency on other settings?
Or perhaps I misunderstand settings. FYI, my understanding is that settings are computed once at start up; tasks are computed whenever they are requested.
Setting is actually initialized only one per sbt session. The good explanation about that can be found here
If I got your idea in right way, you can do that with TaskKeys and the sbt.Extracted.append method. Be careful, I have faced strange think like this

Android kernel LED control

Im new to this forum so be nice ;) i have followed rules :)
I am helping the dev for my kernel that I use. Since the mod I want is mainly only for me i figured its my duty to get it working myself.
The problem:
I have edited my *.kl files to disable the five front facing hardware buttons from waking the device and only allow the volume up / down buttons to wake the device as the front facing buttons get pressed when its in my pocket.
However, even though the front facing buttons no longer turn on the device , when they get pressed they light up adding an extra 6mA drain .
What I've tried:
I wrote an apk to change the permissions of the /sys/class/leds/button-backlight/brightness file to keep them off. Despite the program working , permissions allow the file be edited, causing them to light up.
What i need help on:
I downloaded my dev's kernel using git and I want to edit the kernel myself to keep the button lights off during sleep . However kernel code is not my comfort zone .. so i need help .
Thanks everyone for helping and simply just reading !
1) Messing with code is a bad idea (especially if you lack skill and don't know C and UNIX).
2) what you are probably looking for is script that will run on startup (initrc) and there you need to set it and change permissions using chmod command.
Thus you need to Setup what you want (with echo command presumably) -> change permissions so file can not be rewritten (chmod) -> put two commands in initrc.
Kernel can be like any other configured using make menuconfig and then compiling it, in that case you just disable stuff that you don't like.
[OT] I may be off though, your (original) question (there was no question mark) did not make too much sense here and there. Read this howto: How To Ask Questions The Smart Way from Eric Steven Raymond. Thanks.

How to find where an object is created in flex/actionscript 3?

In my project I have noticed 20-40% CPU time when my app is idle.
In debugger when I pause I always land on a flex.utils.Timer/tick.
This timer has 30ms delay between "ticks"
I didn't create that Timer... so this is problably a component I have added
Unfortunately it will be difficult to remove all compenents until if find the "one" ..
Yes I should have notice the CPU usage sooner !
and yes I will do that if I don't find another solution
I am of course using some components without having their sources...
My questions :
* How can I find the guilty component ?
* I tried to find it using Kap Inspector without success ...any tips for Kap inspector ?
* Is there another great tool to track object creation ?
Thanks for your help
When you set your breakpoint, in the Flex Debugger perspective, find the Variables tab/view. From there, with your breakpoint set, you should be able to see all of the variables currently in local scope (local to the timer-tick event handler, that is). The event variable will contain information about the timer itself -- e.g., in event.target -- and the this variable will tell you where the timer handler is defined.
From there, you might be able to walk back up the stack trace, using the Debug tab/view (with your breakpoint still set), to get a sense of where the Timer object might've been instantiated. If that doesn't work, you can download a trial of Flex Builder Professional here:
http://www.adobe.com/cfusion/entitlement/index.cfm?e=flexbuilder3
... and give the built-in profiler a try. Hope that helps point you in a helpful direction!
No idea about Flex, but for your CPU problems, check this out:
http://www.gskinner.com/blog/archives/2009/05/idle_cpu_usage.html

Resources