SpaceBubble  v0.98
Functions | Variables
light.c File Reference

The file contain the Wii lights methodes. More...

#include <stdio.h>
#include <stdlib.h>
#include <ogcsys.h>
#include <wiiuse/wpad.h>
#include "light.h"

Functions

void _wiilight_turn (int enable)
 
void WIILIGHT_Init ()
 
int WIILIGHT_GetLevel ()
 
int WIILIGHT_SetLevel (int level)
 
void WIILIGHT_TurnOff ()
 
void WIILIGHT_TurnOn ()
 
void WIILIGHT_Toggle ()
 
void WIILIGHT_close ()
 

Variables

struct timespec _wiilight_timeOn
 
struct timespec _wiilight_timeOff
 
bool WIILIGHT_IsOn
 
int WIILIGHT_Level
 
lwp_t _wiilight_thread
 

Detailed Description

The file contain the Wii lights methodes.

Author
wplaat

Copyright (C) 2008-2010 PlaatSoft

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Function Documentation

void _wiilight_turn ( int  enable)

just turn one bit

void WIILIGHT_close ( )

Close Wii Light (stop loop thread)

int WIILIGHT_GetLevel ( )

Get current Wii light intensity level

Returns
Intensity [0..255]
void WIILIGHT_Init ( )

Init Wii Light

int WIILIGHT_SetLevel ( int  level)

Set Wii Light intensity

Parameters
levelTHe intensity level
Returns
return set level.

Here is where we set the light intensity it turns on the light and waits level*40000 nanoseconds (so, if it is 255 it will wait for 10200000 nanoseconds) (that means ~ 1/100secs)

for the time turned off it is 10200000-level_on (so, if level is 255, it will wait for 0 seconds) (that means full light intensity)

void WIILIGHT_Toggle ( )

Toggle Wii Light Switch the light on or off!

void WIILIGHT_TurnOff ( )

Set Wii Light Off (looping thread terminate)

void WIILIGHT_TurnOn ( )

Set Wii Light on and start the looping thread

Variable Documentation

lwp_t _wiilight_thread
struct timespec _wiilight_timeOff
struct timespec _wiilight_timeOn
bool WIILIGHT_IsOn
int WIILIGHT_Level