fernly/cmd-led.c
Sean Cross f8991202c6 cmd: Use strtoul instead of _strtoul
The non-underscore one comes from vsprintf.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2014-11-28 13:12:53 +08:00

27 lines
450 B
C

#include <string.h>
#include "bionic.h"
#include "memio.h"
#include "printf.h"
#include "serial.h"
#include "fernvale-kbd.h"
int cmd_led(int argc, char **argv)
{
uint32_t state;
if (argc < 1) {
printf("Usage: led [1 = on, 0 = off]\n");
return -1;
}
state = strtoul(argv[0], NULL, 0);
if( state ) {
*((volatile uint32_t *) BIG_LED_ADDR) = BIG_LED_ON;
} else {
*((volatile uint32_t *) BIG_LED_ADDR) = BIG_LED_OFF;
}
return 0;
}