Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Autres questions


Index du Forum » Autres questions » Showing battery within add in
Critical Hors ligne Membre Points: 14 Défis: 0 Message

Showing battery within add in

Posté le 08/05/2025 23:03

I am currently making my add in and wanted to show the battery status with the separation line like the calculator usually does in any other built in app and some other add ins but I dont know how to do this does anyone know what #include gint directive I need for it or is there is a different way of doing this entirely

Any help appreciated Thank you!


Lephenixnoir Hors ligne Administrateur Points: 25095 Défis: 174 Message

Citer : Posté le 09/05/2025 00:14 | #


There's no driver for that yet, though you can world switch and use the syscall, if you know how to do it. You can copy from PythonExtra the battery functions in modion.c with the syscall being in syscalls.S.
Mon graphe (28 Janvier): (MPM ; serial gint ; (Rogue Life || HH2) ; PythonExtra ; ? ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Critical Hors ligne Membre Points: 14 Défis: 0 Message

Citer : Posté le 09/05/2025 13:58 | #


I am not too sure on how to do this is it fine if you could explain it or maybe point me to some links where I can learn it maybe thanks
Slyvtt En ligne Maître du Puzzle Points: 2612 Défis: 17 Message

Citer : Posté le 09/05/2025 15:45 | #


gint does not provide easy method to have the usual Casio application look and feel, meaning with the battery logo on the right part of the screen in a ribbon separated by the line you are speaking of.

On the opposite, gint provides the full screen to the user, and then, if you want to mimic the usual look and feel of Casio applications, you need to :
- 1/ either call the OS syscalls, which is possible but clearly not the philosophy of gint, which aims at providing a standalone unikernel to bypass (as much as possible) the OS syscalls (or routines if you prefer)
- 2/ or just try to get relevant informations and create a kind of "theme" using purely gint functions.

Honnestly, from my perspective option 2 is the best as it is not infringing the backbone philsophy of gint. If you want to use OS syscalls, you'd rather use the "official" fx9860G SDK. sorry the PrizmSDK (Edit).

If option 2/ make sens to you, then you can get the batteries data using a syscall. You can check here what I did for the Numworks compatibility module on fxCG50 for which I needed the battery voltage : see https://git.planet-casio.com/Lephenixnoir/PythonExtra/src/branch/main/ports/sh/numworks.

2 files are of interest : Syscall.h provides headers for Syscall.S which are the ASM routines to call the OS syscall. The battery voltage is given by a call to CASIOWIN_GetMainBatteryVoltage(1);

Based on the returned value (voltage * 100) as an int, you can plot a battery icon on the top right part of the screen.

Hope it helps.
There are only 10 types of people in the world: Those who understand binary, and those who don't ...
Critical Hors ligne Membre Points: 14 Défis: 0 Message

Citer : Posté le 09/05/2025 16:51 | #


In my current project all my code is maintained in the main.c file Lephenixnoir was talking about some world switch that I need to use what is it and where do I put it in my main.c file right? and also do I need to make any changes to my CMakeLists.txt to account for theses things. Thanks for the help!
Mb88 En ligne Rédacteur Points: 1237 Défis: 3 Message

Citer : Posté le 09/05/2025 16:57 | #


No, making a world switch, it is just calling gint_world_switch(GINT_CALL(your_callback)). You can also pass arguements to the callback like this: gint_world_switch(GINT_CALL(your_callback, your_first_arg, your_2nd_arg)) and so on…

A gint world switch is needed when calling OS syscalls because gint is taking control of a lot of stuff the OS usually handles, so it may cause issues when calling the OS without it having control of everything it usually has (I don't know it in detail).
Critical Hors ligne Membre Points: 14 Défis: 0 Message

Citer : Posté le 11/05/2025 11:56 | #


I just wanted to ask about the options for making add ins Slyvtt mentioned that gint is essentially independent from the OS syscalls is there any add in building options that help maintain the look and feel of the usual CASIO applications as I feel that its kind of complicated for me to call the OS syscalls in gint.
Lephenixnoir Hors ligne Administrateur Points: 25095 Défis: 174 Message

Citer : Posté le 12/05/2025 14:41 | #


For a bit more detail... to use syscalls with gint, put this file in your project (in src/): https://git.planet-casio.com/Lephenixnoir/PythonExtra/src/branch/main/ports/sh/numworks/syscalls.S

Add it in CMakeLists.txt in set(SOURCES ...), and since you probably don't have assembler code in your project yet, also add "LANGUAGES C ASM" at the end of the project() line.

And then you get both syscalls as functions, which you can prototype like this:

/* Returns the battery type. 1: Alkaline batteries, 2: Ni-MH. */
int CASIOWIN_GetBatteryType(void);
/* Parameter should always be 1. Returns battery voltage * 100. */
int CASIOWIN_GetMainBatteryVoltage(int one);

To call them, do a world switch like this:

#include <gint/gint.h>
int type = gint_world_switch(GINT_CALL(CASIOWIN_GetBatteryType)));
int voltage = gint_world_switch(GINT_CALL(CASIOWIN_GetMainBatteryVoltage, 1));

Critical a écrit :
I just wanted to ask about the options for making add ins Slyvtt mentioned that gint is essentially independent from the OS syscalls is there any add in building options that help maintain the look and feel of the usual CASIO applications as I feel that its kind of complicated for me to call the OS syscalls in gint.

Your understanding is correct, gint has a bias for making games and doesn't try to give you tools for writing OS-looking interfaces. These tools are all syscalls though, so you can still use them by following the instructions above.

Another option is to use the historical toolkit, the PrizmSDK with libfxcg; there is documentation on WikiPrizm. Essentially the entire libfxcg is syscalls so you get the same drawing functions, input functions, etc. as the OS, packaged more nicely that my instructions above. (I have plans to offer the same stuff with gint... it's not ready yet though. :x)

For clarity, the PrizmSDK with libfxcg was/is used by the people at Cemetech; I can't say its "dead" but it certainly hasn't been active in many years. It was also used here on Planète Casio to make games until gint took over. If you choose to use the PrizmSDK we'll still happily provide support, but you'll be more on your own overall.
Mon graphe (28 Janvier): (MPM ; serial gint ; (Rogue Life || HH2) ; PythonExtra ; ? ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Critical Hors ligne Membre Points: 14 Défis: 0 Message

Citer : Posté le 15/05/2025 18:23 | #


Thanks for this I am definitely leaning towards using PrizmSDK as it suits more to my needs I hope that all the documentation on it is enough to make what I want. This is because I want to use standard CASIO font and layout from what you have told me I assume I use libfxcg but whats all the other documentation on PrizmSDK website is it the original PrizmSDK or something that is seperate to libfxcg do I need them together as a sort of add in or only one of them. Also where can I find the explanations of all the syscalls and whats going on as I was kinda confused looking at the libfxcg github. So I believe that PrizmSDK better to maintain the CASIO look and feel. Another 2 things I wanted to know is the documentation a good source of help/explanations is it somewhat "free" like gint in the sense that I can do whatever I want or since I am using PrizmSDK I have to follow the strict syscall rules only.
Lephenixnoir Hors ligne Administrateur Points: 25095 Défis: 174 Message

Citer : Posté le 15/05/2025 18:42 | #


Just for clarity, a SDK (Software Development Kit) is a bunch of tools for writing programs, including a compiler, assembler, linker, etc. Usually an SDK also provides libraries for calculator code. The PrizmSDK has libfxcg which is a big set of syscalls and can make OS-looking apps. The fxSDK has gint which is its own kernel. In principle you can mix things up and use libfxcg in the fxSDK (which would avoid having double the tools, and the fxSDK also has a slightly better compiler), but I've never tried. So the safer, works-immediately option for you is indeed to install the PrizmSDK so you can use libfxcg. To install it download a release which comes with the compiler and all the tools pre-compiled. (Yes, confusingly, the libfxcg repo offers downloads for the entire SDK...)

WikiPrizm was made by people who used the PrizmSDK with libfxcg so yes you can assume everything on there applies to your use case.

There are no restrictions like "only syscalls", it's just that libfxcg provides you only with that. It's almost "empty" in that libfxcg contains very little code of its own it just points you to functions in the OS that are already available. If there's something you need and there's no syscall available for it in libfxcg (which may happen if you want very specific things), then you can (1) code it yourself, if it's possible, (2) look for a known syscall not already listed in libfxcg that does it (usually here), or (3) look for new syscalls. But hopefully everything you need will already be available.

Do note that there is no like GUI toolkit in the OS, it's just print functions and at best like a "type a string using line 1, columns 3-10 as an input field" function. All positioning is manual; it's pretty bare-bones. Off the top of my head the main things you get are automatic management of the status bar, the same fonts, a popup system (although not all the useful functions for popups are in libfxcg), and the same keyboard management (with e.g. the catalog).

You're never gonna find information about "all" the syscalls because there's about 8000 and CASIO never told what these are; they are not an official feature. All the ones we know are from reverse-engineering. Some of them do useful things, some of them will crash if you call them, so never call a syscall by number if you don't already know what it does. If you want to discover what you can do with libfxcg, read through the headers to have a broad idea and read WikiPrizm to get the finer details. Most, but definitely not all, of the known syscalls are listed on that page and they also come with some documentation.
Mon graphe (28 Janvier): (MPM ; serial gint ; (Rogue Life || HH2) ; PythonExtra ; ? ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2025 | Il y a 60 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd