高级会员

- 积分
- 823
- 金钱
- 823
- 注册时间
- 2014-1-15
- 在线时间
- 350 小时
|

楼主 |
发表于 2019-12-11 09:57:39
|
显示全部楼层
下面是我的程序
void gm_led88_c_send_data(uint8_t data)
{
uint8_t i, d;
d = data;
for(i=0; i<8; i++)
{
nrf_gpio_pin_clear(LED88_595_C_SCLK_PIN);
if( (d & 0x80) == 0x80)
{
nrf_gpio_pin_set(LED88_595_C_DATA_PIN);
}
else
{
nrf_gpio_pin_clear(LED88_595_C_DATA_PIN);
}
d = d << 1;
nrf_gpio_pin_set(LED88_595_C_SCLK_PIN);
}
nrf_gpio_pin_clear(LED88_595_C_CLK_PIN);
nrf_gpio_pin_set(LED88_595_C_CLK_PIN);
}
void gm_led88_r_send_data(uint8_t data)
{
uint8_t i, d;
d = data;
for(i=0; i<8; i++)
{
nrf_gpio_pin_clear(LED88_595_R_SCLK_PIN);
if( (d & 0x80) == 0x80)
{
nrf_gpio_pin_set(LED88_595_R_DATA_PIN);
}
else
{
nrf_gpio_pin_clear(LED88_595_R_DATA_PIN);
}
d = d << 1;
nrf_gpio_pin_set(LED88_595_R_SCLK_PIN);
}
nrf_gpio_pin_clear(LED88_595_R_CLK_PIN);
nrf_delay_us(5);
nrf_gpio_pin_set(LED88_595_R_CLK_PIN);
}
uint8_t m_led_martix[] =
{
0x20,0x30,0x20,0x20,0x20,0x20,0x70,0x00,
};
uint8_t dr, dc;
void gm_led88_refresh(void)
{
uint8_t *ma, i;
ma = m_led_martix;
dr = 0xFF;
dc = 0x00;
for(i = 0; i < 8; i++)
{
dr = ~(0x01 << i) & 0xFF;
dc = *ma;
gm_led88_c_send_data(dc);
gm_led88_r_send_data(dr);
ma++;
nrf_delay_ms(2);
gm_led88_c_send_data(0);
gm_led88_r_send_data(dr);
}
}
gm_led88_refresh()是刷屏函数,这样写对吗?
|
|