2024-01-31 11:04:31 +08:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include "ulp_riscv.h"
|
|
|
|
|
#include "ulp_riscv_utils.h"
|
|
|
|
|
#include "ulp_riscv_gpio.h"
|
2024-02-01 16:47:49 +08:00
|
|
|
|
#include "soc/rtc_io_reg.h"
|
|
|
|
|
#include "ulp_riscv_register_ops.h"
|
2024-01-31 11:04:31 +08:00
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
2024-02-02 10:44:38 +08:00
|
|
|
|
#define OE_CAPTRUE_RTC_PIN_NUM_REG_BIT (1 << (HUB75_OE_CAPTRUE__RTC_PIN_NUM + 10))
|
|
|
|
|
|
|
|
|
|
volatile int set_addr_request = 0;
|
|
|
|
|
volatile int oe_disable_val = 1;
|
|
|
|
|
volatile int addr_reg_bit_val = 0;
|
|
|
|
|
|
2024-01-31 11:04:31 +08:00
|
|
|
|
int main (void)
|
|
|
|
|
{
|
2024-02-02 10:44:38 +08:00
|
|
|
|
if (oe_disable_val) goto OE_HIGH_DISABLE;
|
|
|
|
|
else goto OE_LOW_DISABLE;
|
|
|
|
|
|
|
|
|
|
OE_HIGH_DISABLE:
|
|
|
|
|
while(1) {
|
|
|
|
|
while (!set_addr_request); /* 等待地址设置请求 */
|
|
|
|
|
while (!(REG_READ(RTC_GPIO_IN_REG) & OE_CAPTRUE_RTC_PIN_NUM_REG_BIT)); /* 等待oe高电平disable信号 */
|
|
|
|
|
|
|
|
|
|
REG_WRITE(RTC_GPIO_OUT_REG, addr_reg_bit_val); /* CPU程序应采用读修改写方式,防止影响寄存器其他位 */
|
|
|
|
|
set_addr_request = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OE_LOW_DISABLE:
|
2024-01-31 11:04:31 +08:00
|
|
|
|
while(1) {
|
2024-02-02 10:44:38 +08:00
|
|
|
|
while (!set_addr_request);
|
|
|
|
|
while ((REG_READ(RTC_GPIO_IN_REG) & OE_CAPTRUE_RTC_PIN_NUM_REG_BIT)); /* 等待oe低电平disable信号 */
|
|
|
|
|
|
|
|
|
|
REG_WRITE(RTC_GPIO_OUT_REG, addr_reg_bit_val);
|
|
|
|
|
set_addr_request = 0;
|
2024-01-31 11:04:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|