SunSPOT API V6.0


com.sun.spot.peripheral
Interface IPowerController

All Superinterfaces:
IResource

public interface IPowerController
extends IResource


Field Summary
static byte ALARM_EVENT
           
static byte ALARM_EVENT8
           
static int ALTBOOT
           
static int BATTERY_CALIBRATED
           
static byte BATTERY_EVENT
           
static int BATTERY_POWER
           
static byte BUTTON_EVENT
           
static byte BUTTON_EVENT8
           
static int COLD_BOOT
           
static byte COLD_BOOT_EVENT
           
static int EXT_POWER
           
static byte EXTERNAL_POWER_EVENT
           
static byte GET_ALARM_CMD
           
static byte GET_AND_CLEAR_STATUS_CMD
           
static byte GET_CONTROL_CMD
           
static byte GET_POWER_FAULT_CMD
           
static byte GET_STRING_CMD
           
static byte GET_STRING_LEN_CMD
           
static int LOW_BATTERY
           
static byte LOW_BATTERY_EVENT
           
static byte NO_SHUTDOWN_EXTERNAL_POWERLOSS
           
static byte NO_WAKE_ON_INTERRUPT
           
static byte OVERLOAD_FAULT
           
static byte POWER_CHANGE_EVENT8
           
static byte POWERUP_FAULT
           
static byte QUERY_BUTTON_CMD
           
static byte QUERY_I_CHARGE
           
static byte QUERY_I_DISCHARGE
           
static byte QUERY_I_MAX
           
static byte QUERY_STARTUP
           
static byte QUERY_STATUS_CMD
           
static byte QUERY_TEMPERATURE
           
static byte QUERY_V_BATT
           
static byte QUERY_V_CC
           
static byte QUERY_V_CORE
           
static byte QUERY_V_EXT
           
static byte QUERY_V_USB
           
static int REBOOT
           
static byte RESET_WATCHDOG_CMD
           
static int RTC_STABLE
           
static int RTC_VALID
           
static byte SENSOR_EVENT
           
static byte SENSOR_EVENT8
           
static byte SET_ALARM_CMD
           
static byte SET_CONTROL_CMD
           
static byte SET_INDICATE_CMD
           
static byte SET_SHUTDOWN_TIMEOUT
           
static byte SET_STATUS_CMD
           
static byte SET_TIME_CMD
           
static byte SET_WATCHDOG_CMD
           
static byte SHOW_EVENTS
          Bit mask value for the setIndicate(byte) parameter. 1 indicates that the SPOT should display events using its LEDs.
static byte SHOW_POWERSTATE
          Bit mask value for the setIndicate(byte) parameter. 1 indicates that the SPOT should display the power state using its LEDs.
static int SHUTDOWN
           
static byte SHUTDOWN_EXTERNAL_POWERLOSS
          Bit mask value for the setControl(byte) parameter.
static byte SLEEP_EVENT
           
static byte USB_ENABLE
           
static byte USB_HIGH_POWER_MODE
          Bit mask value for the setControl(byte) parameter.
static byte USB_LOW_POWER_MODE
           
static int USB_POWER
           
static byte USB_SUSPEND
          Bit mask value for the setControl(byte) parameter.
static byte VBATT_FAULT
           
static byte VCC_FAULT
           
static byte VCORE_FAULT
           
static byte VEXT_FAULT
           
static byte VUSB_FAULT
           
static byte WAKE_ON_INTERRUPT
          Bit mask value for the setControl(byte) parameter.
static byte WATCHDOG_EVENT8
           
 
Method Summary
 void disableSynchronisation()
          Disable automatic synchronisation between PowerController time and System time.
 void enableSynchronisation()
          Re-enable automatic synchronisation after a previous call to disableSynchronisation.
 IBattery getBattery()
           
 int getButtonEvent()
          Return a value indicating the last button event: reboot, shut down or alt boot
 int getControl()
          Retrieve the current bit mask control settings.
 int getEvents()
          Get the reason for the last power control PowerController interrupt.
 int getIcharge()
          Return the current charging the battery in milliamps.
 int getIdischarge()
          Return the current being drawn from the battery in milliamps.
 int getIMax()
          Return the maximum current (in milliamps) that has been drawn from the battery since the last time this was called.
 int getPowerFault()
          Return a bit mask of possible power faults.
 String getRevision()
          Get the power control PowerController firmware revision string.
 int getStartupTime()
          Return the time it took (in microseconds) for the power to stabilize from startup.
 int getStatus()
          Return status flags showing current power state, rtc state, etc.
 double getTemperature()
          Retrieve the temperature measured from the main board temperature sensor. returned in degrees centigrade.
 long getTime()
          Get the power control PowerController's time.
 int getVbatt()
          Return the battery supply voltage in millivolts (nominally 2700mv - 4700mv).
 int getVcc()
          Return the main board IO voltage in millivolts (nominally 3000mv).
 int getVcore()
          Return the ARM CPU core voltage in millivolts (nominally 1800mv).
 int getVext()
          Return the voltage supplied by an external power source (if any) in millivolts (nominally 0mv - 5500mv).
 int getVusb()
          Return the externally supplied USB voltage (if any) in millivolts (nominally 5000mv).
 void restartWatchdog()
          restart the watchdog timer.
 void setControl(byte mask)
          Set a bit mask to control whether the power controller accepts interrupts from the sensor board and uses them to wake the SPOT if it is sleeping, and how the power controller deals with loss of external power.
 void setIndicate(byte mask)
          Set a bit mask to control the power controller LED.
 void setShutdownTimeout(int time)
          Set the time delay from when IRQ is sent to the ARM notifying it of the shutdown to powering off ARM.
 void setTime(long systemTimeMillis)
          Set the power control PowerController's time.
 void setWatchdog(long time)
          Start the watchdog timer period to timeout in time milliseconds.
 
Methods inherited from interface com.sun.spot.resources.IResource
addTag, getTags, getTagValue, hasTag, removeTag
 

Field Detail

GET_AND_CLEAR_STATUS_CMD

static final byte GET_AND_CLEAR_STATUS_CMD
See Also:
Constant Field Values

QUERY_V_CORE

static final byte QUERY_V_CORE
See Also:
Constant Field Values

QUERY_V_CC

static final byte QUERY_V_CC
See Also:
Constant Field Values

QUERY_V_BATT

static final byte QUERY_V_BATT
See Also:
Constant Field Values

QUERY_TEMPERATURE

static final byte QUERY_TEMPERATURE
See Also:
Constant Field Values

QUERY_V_EXT

static final byte QUERY_V_EXT
See Also:
Constant Field Values

QUERY_V_USB

static final byte QUERY_V_USB
See Also:
Constant Field Values

QUERY_I_CHARGE

static final byte QUERY_I_CHARGE
See Also:
Constant Field Values

QUERY_I_DISCHARGE

static final byte QUERY_I_DISCHARGE
See Also:
Constant Field Values

GET_ALARM_CMD

static final byte GET_ALARM_CMD
See Also:
Constant Field Values

GET_STRING_LEN_CMD

static final byte GET_STRING_LEN_CMD
See Also:
Constant Field Values

GET_STRING_CMD

static final byte GET_STRING_CMD
See Also:
Constant Field Values

SET_TIME_CMD

static final byte SET_TIME_CMD
See Also:
Constant Field Values

SET_ALARM_CMD

static final byte SET_ALARM_CMD
See Also:
Constant Field Values

QUERY_I_MAX

static final byte QUERY_I_MAX
See Also:
Constant Field Values

SET_INDICATE_CMD

static final byte SET_INDICATE_CMD
See Also:
Constant Field Values

QUERY_STARTUP

static final byte QUERY_STARTUP
See Also:
Constant Field Values

GET_POWER_FAULT_CMD

static final byte GET_POWER_FAULT_CMD
See Also:
Constant Field Values

SET_SHUTDOWN_TIMEOUT

static final byte SET_SHUTDOWN_TIMEOUT
See Also:
Constant Field Values

SET_CONTROL_CMD

static final byte SET_CONTROL_CMD
See Also:
Constant Field Values

SET_STATUS_CMD

static final byte SET_STATUS_CMD
See Also:
Constant Field Values

GET_CONTROL_CMD

static final byte GET_CONTROL_CMD
See Also:
Constant Field Values

SET_WATCHDOG_CMD

static final byte SET_WATCHDOG_CMD
See Also:
Constant Field Values

RESET_WATCHDOG_CMD

static final byte RESET_WATCHDOG_CMD
See Also:
Constant Field Values

QUERY_STATUS_CMD

static final byte QUERY_STATUS_CMD
See Also:
Constant Field Values

QUERY_BUTTON_CMD

static final byte QUERY_BUTTON_CMD
See Also:
Constant Field Values

COLD_BOOT_EVENT

static final byte COLD_BOOT_EVENT
See Also:
Constant Field Values

BUTTON_EVENT

static final byte BUTTON_EVENT
See Also:
Constant Field Values

ALARM_EVENT

static final byte ALARM_EVENT
See Also:
Constant Field Values

SENSOR_EVENT

static final byte SENSOR_EVENT
See Also:
Constant Field Values

BATTERY_EVENT

static final byte BATTERY_EVENT
See Also:
Constant Field Values

SLEEP_EVENT

static final byte SLEEP_EVENT
See Also:
Constant Field Values

LOW_BATTERY_EVENT

static final byte LOW_BATTERY_EVENT
See Also:
Constant Field Values

EXTERNAL_POWER_EVENT

static final byte EXTERNAL_POWER_EVENT
See Also:
Constant Field Values

BUTTON_EVENT8

static final byte BUTTON_EVENT8
See Also:
Constant Field Values

ALARM_EVENT8

static final byte ALARM_EVENT8
See Also:
Constant Field Values

SENSOR_EVENT8

static final byte SENSOR_EVENT8
See Also:
Constant Field Values

POWER_CHANGE_EVENT8

static final byte POWER_CHANGE_EVENT8
See Also:
Constant Field Values

WATCHDOG_EVENT8

static final byte WATCHDOG_EVENT8
See Also:
Constant Field Values

VBATT_FAULT

static final byte VBATT_FAULT
See Also:
Constant Field Values

VUSB_FAULT

static final byte VUSB_FAULT
See Also:
Constant Field Values

VEXT_FAULT

static final byte VEXT_FAULT
See Also:
Constant Field Values

VCC_FAULT

static final byte VCC_FAULT
See Also:
Constant Field Values

VCORE_FAULT

static final byte VCORE_FAULT
See Also:
Constant Field Values

POWERUP_FAULT

static final byte POWERUP_FAULT
See Also:
Constant Field Values

OVERLOAD_FAULT

static final byte OVERLOAD_FAULT
See Also:
Constant Field Values

BATTERY_POWER

static final int BATTERY_POWER
See Also:
Constant Field Values

USB_POWER

static final int USB_POWER
See Also:
Constant Field Values

EXT_POWER

static final int EXT_POWER
See Also:
Constant Field Values

LOW_BATTERY

static final int LOW_BATTERY
See Also:
Constant Field Values

RTC_STABLE

static final int RTC_STABLE
See Also:
Constant Field Values

RTC_VALID

static final int RTC_VALID
See Also:
Constant Field Values

BATTERY_CALIBRATED

static final int BATTERY_CALIBRATED
See Also:
Constant Field Values

COLD_BOOT

static final int COLD_BOOT
See Also:
Constant Field Values

REBOOT

static final int REBOOT
See Also:
Constant Field Values

SHUTDOWN

static final int SHUTDOWN
See Also:
Constant Field Values

ALTBOOT

static final int ALTBOOT
See Also:
Constant Field Values

SHOW_POWERSTATE

static final byte SHOW_POWERSTATE
Bit mask value for the setIndicate(byte) parameter. 1 indicates that the SPOT should display the power state using its LEDs.

See Also:
Constant Field Values

SHOW_EVENTS

static final byte SHOW_EVENTS
Bit mask value for the setIndicate(byte) parameter. 1 indicates that the SPOT should display events using its LEDs.

See Also:
Constant Field Values

WAKE_ON_INTERRUPT

static final byte WAKE_ON_INTERRUPT
Bit mask value for the setControl(byte) parameter. Setting the bit indicates that the power controller should NOT wake the SPOT main board when it detects external board interrupts. The default is that the bit is unset, i.e. wake on interrupt is enabled.

See Also:
Constant Field Values

NO_WAKE_ON_INTERRUPT

static final byte NO_WAKE_ON_INTERRUPT
See Also:
Constant Field Values

SHUTDOWN_EXTERNAL_POWERLOSS

static final byte SHUTDOWN_EXTERNAL_POWERLOSS
Bit mask value for the setControl(byte) parameter. Setting the bit indicates that the power controller SHOULD shut the SPOT down when it detects loss of external power. The default is unset, i.e. the SPOT does not shutdown on external power loss.

See Also:
Constant Field Values

NO_SHUTDOWN_EXTERNAL_POWERLOSS

static final byte NO_SHUTDOWN_EXTERNAL_POWERLOSS
See Also:
Constant Field Values

USB_SUSPEND

static final byte USB_SUSPEND
Bit mask value for the setControl(byte) parameter. Setting the bit indicates that the power controller SHOULD set USB Suspend (USB not enabled). The default is unset, i.e. USB enabled.

See Also:
Constant Field Values

USB_ENABLE

static final byte USB_ENABLE
See Also:
Constant Field Values

USB_HIGH_POWER_MODE

static final byte USB_HIGH_POWER_MODE
Bit mask value for the setControl(byte) parameter. Setting the bit indicates that the power controller SHOULD set USB high power mode. The default is unset, i.e. USB low power mode.

See Also:
Constant Field Values

USB_LOW_POWER_MODE

static final byte USB_LOW_POWER_MODE
See Also:
Constant Field Values
Method Detail

getRevision

String getRevision()
Get the power control PowerController firmware revision string.

Returns:
the firmware revision string

getTime

long getTime()
Get the power control PowerController's time.

Returns:
the time in milliseconds since midnight Jan 1, 1970

setTime

void setTime(long systemTimeMillis)
Set the power control PowerController's time.

Parameters:
systemTimeMillis - the time in milliseconds since midnight Jan 1, 1970

getEvents

int getEvents()
Get the reason for the last power control PowerController interrupt. This is a bitmask with the following bits ORed together:

Returns:
the PowerController event bits

getVcore

int getVcore()
Return the ARM CPU core voltage in millivolts (nominally 1800mv).

Returns:
the ARM CPU core voltage (mv)

getVcc

int getVcc()
Return the main board IO voltage in millivolts (nominally 3000mv).

Returns:
the IO voltage (mv)

getVbatt

int getVbatt()
Return the battery supply voltage in millivolts (nominally 2700mv - 4700mv). This is a rough indicator of remaining battery life. The battery is nominally 3700mv through most of its state of charge and drops off pretty quickly towards full discharge.

At 3500mv the SPOT will start to indicate low battery (power LED switches from green to red)

At 3300mv the SPOT will shutdown automatically into deep sleep

Returns:
the battery voltage (mv)

getVext

int getVext()
Return the voltage supplied by an external power source (if any) in millivolts (nominally 0mv - 5500mv).

Returns:
the external voltage (mv)

getVusb

int getVusb()
Return the externally supplied USB voltage (if any) in millivolts (nominally 5000mv).

Returns:
the USB voltage (mv)

getIcharge

int getIcharge()
Return the current charging the battery in milliamps. Only one of Icharge or Idischarge will be be positive at any time. The other will be zero.

Returns:
the discharge current (mA)

getIdischarge

int getIdischarge()
Return the current being drawn from the battery in milliamps. Only one of Icharge or Idischarge will be be positive at any time. The other will be zero.

Returns:
the discharge current (mA)

disableSynchronisation

void disableSynchronisation()
Disable automatic synchronisation between PowerController time and System time. This will cause the two to gradually drift apart and is not recommended for general use. The main legitimate use of this function is to stop SPI activity when an app needs exclusive use of the SPI pins.


enableSynchronisation

void enableSynchronisation()
Re-enable automatic synchronisation after a previous call to disableSynchronisation.


getIMax

int getIMax()
Return the maximum current (in milliamps) that has been drawn from the battery since the last time this was called.

Returns:
the maximum discharge current (mA) since the last call

getStartupTime

int getStartupTime()
Return the time it took (in microseconds) for the power to stabilize from startup.

Returns:
the time it took (in microseconds) for the power to stabilize from startup.

getPowerFault

int getPowerFault()
Return a bit mask of possible power faults.

Returns:
a bit mask of possible power faults.

setIndicate

void setIndicate(byte mask)
Set a bit mask to control the power controller LED. See SHOW_EVENTS and SHOW_POWERSTATE


setControl

void setControl(byte mask)
Set a bit mask to control whether the power controller accepts interrupts from the sensor board and uses them to wake the SPOT if it is sleeping, and how the power controller deals with loss of external power. See WAKE_ON_INTERRUPT and SHUTDOWN_EXTERNAL_POWERLOSS


getControl

int getControl()
Retrieve the current bit mask control settings.

Returns:
the current bit mask control settings.

getTemperature

double getTemperature()
Retrieve the temperature measured from the main board temperature sensor. returned in degrees centigrade.


getBattery

IBattery getBattery()
Returns:
Answer an IBattery for access to information about the battery if any.

setWatchdog

void setWatchdog(long time)
Start the watchdog timer period to timeout in time milliseconds. The watchdog timer operates in both deep sleep and running modes. If restartWatchdog() is not called prior to the watchdog timing out, the SPOT will be rebooted.

Disable watchdog timer by setting the time to zero

For the rev8 SPOT the watchdog timer counts by 256 msec ticks and the maximum watchdog timeout value is 549755813000 milliseconds or 17 years.

Parameters:
time - in milliseconds until watchdog timer will expire or zero to disable the watchdog timer.

restartWatchdog

void restartWatchdog()
restart the watchdog timer. restartWatchdog must be called periodically for normal operation


getStatus

int getStatus()
Return status flags showing current power state, rtc state, etc.

Returns:
status flags

getButtonEvent

int getButtonEvent()
Return a value indicating the last button event: reboot, shut down or alt boot

Returns:
the value indicating the last button event

setShutdownTimeout

void setShutdownTimeout(int time)
Set the time delay from when IRQ is sent to the ARM notifying it of the shutdown to powering off ARM. Value is 1 to 255 representing 100msec to 25600msec delay in 100ms increments. Default time out is 3 secs.

Parameters:
time - in 100ms increments until ARM is powered off

SunSPOT API V6.0


Copyright © 2006-2010 Oracle. All Rights Reserved.