Cleanup: move lightbar command enum into ec_commands.h

Previously this was in lightbar.h.  ec_commands.h should not require
other header files.

Also make brightness local variable static, so it won't leak outside
lightbar module.

This is simply code cleanup; values themselves have not changed.

BUG=none
TEST=if it builds, it's fine
BRANCH=none (not required in link branch since it's just cleanup)

Change-Id: I5722fb677fcec99e0826e3dfc0b22033781b576f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32815
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
This commit is contained in:
Randall Spangler
2012-09-10 15:15:06 -07:00
committed by Gerrit
parent 774d047d5e
commit b0891c30e0
3 changed files with 23 additions and 17 deletions

View File

@@ -113,7 +113,7 @@ static inline uint8_t scale_abs(int val, int max)
}
/* It will often be simpler to provide an overall brightness control. */
int brightness = 0x80;
static int brightness = 0x80;
/* So that we can make brightness changes happen instantly, we need to track
* the current values. The values in the controllers aren't very helpful. */

View File

@@ -623,10 +623,12 @@ struct ec_params_pwm_set_fan_duty {
struct ec_params_lightbar_cmd {
union {
union {
uint8_t cmd;
uint8_t cmd; /* Command (see enum lightbar_command) */
struct {
uint8_t cmd;
} dump, off, on, init, get_seq;
struct num {
uint8_t cmd;
uint8_t num;
@@ -636,11 +638,13 @@ struct ec_params_lightbar_cmd {
uint8_t cmd;
uint8_t ctrl, reg, value;
} reg;
struct rgb {
uint8_t cmd;
uint8_t led, red, green, blue;
} rgb;
} in;
union {
struct dump {
struct {
@@ -649,9 +653,11 @@ struct ec_params_lightbar_cmd {
uint8_t ic1;
} vals[23];
} dump;
struct get_seq {
uint8_t num;
} get_seq;
struct {
/* no return params */
} off, on, init, brightness, seq, reg, rgb, demo;
@@ -659,6 +665,21 @@ struct ec_params_lightbar_cmd {
};
} __packed;
/* Lightbar commands */
enum lightbar_command {
LIGHTBAR_CMD_DUMP = 0,
LIGHTBAR_CMD_OFF = 1,
LIGHTBAR_CMD_ON = 2,
LIGHTBAR_CMD_INIT = 3,
LIGHTBAR_CMD_BRIGHTNESS = 4,
LIGHTBAR_CMD_SEQ = 5,
LIGHTBAR_CMD_REG = 6,
LIGHTBAR_CMD_RGB = 7,
LIGHTBAR_CMD_GET_SEQ = 8,
LIGHTBAR_CMD_DEMO = 9,
LIGHTBAR_NUM_CMDS
};
/*****************************************************************************/
/* Verified boot commands */

View File

@@ -25,21 +25,6 @@ void lightbar_sequence(enum lightbar_sequence s);
/****************************************************************************/
/* External stuff */
/* These are the commands available to the EC console or via LPC. */
enum lightbar_command {
LIGHTBAR_CMD_DUMP,
LIGHTBAR_CMD_OFF,
LIGHTBAR_CMD_ON,
LIGHTBAR_CMD_INIT,
LIGHTBAR_CMD_BRIGHTNESS,
LIGHTBAR_CMD_SEQ,
LIGHTBAR_CMD_REG,
LIGHTBAR_CMD_RGB,
LIGHTBAR_CMD_GET_SEQ,
LIGHTBAR_CMD_DEMO,
LIGHTBAR_NUM_CMDS
};
/* These are used for demo purposes */
extern void demo_battery_level(int inc);
extern void demo_is_charging(int ischarge);