# SFBPower.h File Reference

Power control and monitoring routines for the SFB. More...

`#include "SFBTypes.h"`
`#include "SFBConstants.h"`
`#include "SFBAssert.h"`

Include dependency graph for SFBPower.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions
int | powerDraw ()
int | powerDraw (u32 face)
int | rawPower (u32 face)
s32 | faceVoltage (u32 face, bool smoothed=true)
| What is the current voltage measurement on face? Returns a backwards-averaged value if smoothed is `true` or absent; returns the latest available sample if smoothed is present and `false`.
s32 | railVoltage (bool smoothed=true)
| Access current main (VEE) rail voltage.
int | rawVoltage ()
void | powerOut (u32 face, int on)
| Turn on (on != 0) or off (on == 0) the outbound power on face.
bool | isPowerOut (u32 face)
| True if output power is active to face, false otherwise.
void | powerIn (u32 face, int on)
| Control inbound power -- NOTE THIS CODE IS UNTESTED!
void | initPowerOuts ()

## Detailed Description

Power control and monitoring routines for the SFB.

Author:
  David H. Ackley.

Date:
  (C) 2009 All rights reserved.

Code License:
  The GNU Lesser General Public License

License Note:
  All code samples shown in documentation are placed into the public domain.

## Function Documentation

s32 faceVoltage | ( | u32 | face,
|  | bool | smoothed = `true` |
| ) |  |  |

What is the current voltage measurement on face? Returns a backwards-averaged value if smoothed is `true` or absent; returns the latest available sample if smoothed is present and `false`.

Note that the calculated voltages are based on the datasheet properties of the ADC and the nominal values of the (1%) scaling resistors on the board, so the resulting values can differ substantially from the true voltage and from one board to another, but should be relatively consistent internally.

Returns:
  Millivolts at face

Blinks:
  E_API_BAD_FACE if face is not one of NORTH..WEST

Since:
  0.9.7

bool isPowerOut | ( | u32 | face | ) |

True if output power is active to face, false otherwise.

Blinks:
  E_API_BAD_FACE if face is not one of NORTH..WEST

Since:
  0.9.11

void powerOut | ( | u32 | face,
|  | int | on |
| ) |  |  |

Turn on (on != 0) or off (on == 0) the outbound power on face.

Blinks:
  E_API_BAD_FACE if face is not one of NORTH..WEST

s32 railVoltage | ( | bool | smoothed = `true` | ) |

Access current main (VEE) rail voltage.

Returns a backwards-averaged value if smoothed is `true` or absent; returns the latest available sample if smoothed is present and `false`.

Be aware that, unless the hardware has been calibrated, the calculated voltages are based on the datasheet properties of the ADC and the nominal values of the (1%) scaling resistors on the board, so the resulting values can differ significantly from the true voltage and from face to face and from board to board, but should be relatively consistent on a given face.

Returns:
  Smoothed or latest millivolts measured on the requested rail

Since:
  0.9.7