display init function
This commit is contained in:
@@ -30,8 +30,36 @@ void clock(){
|
|||||||
gpio_set_level(GPIO_CLK, 0);
|
gpio_set_level(GPIO_CLK, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_init(){
|
||||||
|
gpio_config_t io_conf;
|
||||||
|
//disable interrupt
|
||||||
|
io_conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
|
//set as output mode
|
||||||
|
io_conf.mode = GPIO_MODE_OUTPUT;
|
||||||
|
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||||
|
io_conf.pin_bit_mask =
|
||||||
|
(1ULL<<GPIO_LAT)|(1ULL<<GPIO_OE)|(1ULL<<GPIO_CLK)
|
||||||
|
|(1ULL<<GPIO_R1)|(1ULL<<GPIO_G1)|(1ULL<<GPIO_B1)|(1ULL<<GPIO_R2)|(1ULL<<GPIO_G2)|(1ULL<<GPIO_B2)
|
||||||
|
|(1ULL<<GPIO_A)|(1ULL<<GPIO_B)|(1ULL<<GPIO_C)|(1ULL<<GPIO_D)|(1ULL<<GPIO_E);
|
||||||
|
//disable pull-down mode
|
||||||
|
io_conf.pull_down_en = 0;
|
||||||
|
//disable pull-up mode
|
||||||
|
io_conf.pull_up_en = 0;
|
||||||
|
//configure GPIO with the given settings
|
||||||
|
gpio_config(&io_conf);
|
||||||
|
|
||||||
|
gpio_set_level(GPIO_OE, 0);
|
||||||
|
|
||||||
|
write_bits(0,0,0,0,0,0);
|
||||||
|
for(uint8_t i=0;i<128;i++){
|
||||||
|
clock();
|
||||||
|
}
|
||||||
|
latch();
|
||||||
|
gpio_set_level(GPIO_OE, 1);
|
||||||
|
gpio_set_level(GPIO_OE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void display_cycle(){
|
void display_cycle(){
|
||||||
printf("test");
|
|
||||||
static uint8_t line = 0;
|
static uint8_t line = 0;
|
||||||
|
|
||||||
for(uint8_t i=0;i<128;i++){
|
for(uint8_t i=0;i<128;i++){
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ void write_bits(uint8_t r1, uint8_t g1, uint8_t b1, uint8_t r2, uint8_t g2, uint
|
|||||||
void write_address(uint8_t addr);
|
void write_address(uint8_t addr);
|
||||||
void latch(void);
|
void latch(void);
|
||||||
void clock(void);
|
void clock(void);
|
||||||
|
void display_init(void);
|
||||||
void display_cycle(void);
|
void display_cycle(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
29
main/main.c
29
main/main.c
@@ -30,36 +30,9 @@
|
|||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
printf("Hello world!\n");
|
printf("Hello world!\n");
|
||||||
|
display_init();
|
||||||
|
|
||||||
put_line(fb, 2, "429 Amalienplatz", 1, 1);
|
put_line(fb, 2, "429 Amalienplatz", 1, 1);
|
||||||
|
|
||||||
gpio_config_t io_conf;
|
|
||||||
//disable interrupt
|
|
||||||
io_conf.intr_type = GPIO_INTR_DISABLE;
|
|
||||||
//set as output mode
|
|
||||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
|
||||||
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
|
||||||
io_conf.pin_bit_mask =
|
|
||||||
(1ULL<<GPIO_LAT)|(1ULL<<GPIO_OE)|(1ULL<<GPIO_CLK)
|
|
||||||
|(1ULL<<GPIO_R1)|(1ULL<<GPIO_G1)|(1ULL<<GPIO_B1)|(1ULL<<GPIO_R2)|(1ULL<<GPIO_G2)|(1ULL<<GPIO_B2)
|
|
||||||
|(1ULL<<GPIO_A)|(1ULL<<GPIO_B)|(1ULL<<GPIO_C)|(1ULL<<GPIO_D)|(1ULL<<GPIO_E);
|
|
||||||
//disable pull-down mode
|
|
||||||
io_conf.pull_down_en = 0;
|
|
||||||
//disable pull-up mode
|
|
||||||
io_conf.pull_up_en = 0;
|
|
||||||
//configure GPIO with the given settings
|
|
||||||
gpio_config(&io_conf);
|
|
||||||
|
|
||||||
gpio_set_level(GPIO_OE, 0);
|
|
||||||
|
|
||||||
write_bits(1,0,0,1,0,0);
|
|
||||||
for(uint8_t i=0;i<128;i++){
|
|
||||||
clock();
|
|
||||||
}
|
|
||||||
latch();
|
|
||||||
gpio_set_level(GPIO_OE, 1);
|
|
||||||
gpio_set_level(GPIO_OE, 0);
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
display_cycle();
|
display_cycle();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user