riscv-blink: make ledd registers global

Make these registers global so that we can access them from anywhere.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2019-06-19 14:41:54 -07:00
parent 36b2794f94
commit 95b138b984
4 changed files with 17 additions and 15 deletions

@ -1 +1 @@
Subproject commit 482a00aa768159fe23622a08e67a503f39007967
Subproject commit d01711fdf9866e6c2cf658b7412501fe63866cb2

View File

@ -12,4 +12,18 @@ void rgb_off_time(uint8_t ms);
void rgb_in_time(uint8_t ms);
void rgb_out_time(uint8_t ms);
enum led_registers {
LEDDCR0 = 8,
LEDDBR = 9,
LEDDONR = 10,
LEDDOFR = 11,
LEDDBCRR = 5,
LEDDBCFR = 6,
LEDDPWRR = 1,
LEDDPWRG = 2,
LEDDPWRB = 3,
};
void rgb_write(uint8_t value, uint8_t addr);
#endif /* _RGB_H_ */

View File

@ -35,7 +35,7 @@ void isr(void) {
}
void main(void) {
int main(void) {
rgb_init();
irq_setie(0);
int i = 0;

View File

@ -2,18 +2,6 @@
#include <rgb.h>
#include <generated/csr.h>
enum led_registers {
LEDDCR0 = 8,
LEDDBR = 9,
LEDDONR = 10,
LEDDOFR = 11,
LEDDBCRR = 5,
LEDDBCFR = 6,
LEDDPWRR = 1,
LEDDPWRG = 2,
LEDDPWRB = 3,
};
#define BREATHE_ENABLE (1 << 7)
#define BREATHE_EDGE_ON (0 << 6)
#define BREATHE_EDGE_BOTH (1 << 6)
@ -34,7 +22,7 @@ enum led_registers {
#define PWM_MODE_LFSR (1 << 2)
#define PWM_MODE_LINEAR (0 << 2)
static void rgb_write(uint8_t value, uint8_t addr) {
void rgb_write(uint8_t value, uint8_t addr) {
rgb_addr_write(addr);
rgb_dat_write(value);
}