led_matrix/main/ulp/main.c

33 lines
827 B
C

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include "ulp_riscv.h"
#include "ulp_riscv_utils.h"
#include "ulp_riscv_gpio.h"
#include "soc/rtc_io_reg.h"
#include "ulp_riscv_register_ops.h"
#define HUB75_OE_CAPTRUE__RTC_PIN_NUM GPIO_NUM_18
#define HUB75_LINE_ADDR_A_RTC_PIN_NUM GPIO_NUM_16
#define HUB75_LINE_ADDR_B_RTC_PIN_NUM GPIO_NUM_15
#define HUB75_LINE_ADDR_C_RTC_PIN_NUM GPIO_NUM_14
#define HUB75_LINE_ADDR_D_RTC_PIN_NUM GPIO_NUM_13
volatile int line = 0;
volatile int flag = 0;
int main (void)
{
while(1) {
if (REG_READ(RTC_GPIO_IN_REG) & (1 << (HUB75_OE_CAPTRUE__RTC_PIN_NUM + 10)) && flag == 1)
{
REG_WRITE(RTC_GPIO_OUT_REG, line << (13 + 10)); /* 13对应地址线最低位GPIO_NUM_13 */
flag = 0;
}
}
return 0;
}