max7219, issue #1116, c-code

This commit is contained in:
kraus 2020-03-01 12:42:37 +01:00
parent 12ed2e4835
commit 87865ed14c
1 changed files with 49 additions and 1 deletions

View File

@ -152,7 +152,7 @@ static uint8_t u8x8_d_max7219_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int
u8x8_cad_StartTransfer(u8x8);
for( j = 0; j < c; j++ )
{
u8x8_cad_SendCmd(u8x8, i+1);
u8x8_cad_SendCmd(u8x8, i+1); /* commands 1..8 select the byte */
u8x8_cad_SendArg(u8x8, *ptr );
ptr++;
}
@ -215,6 +215,54 @@ uint8_t u8x8_d_max7219_32x8(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *ar
/*==============================*/
static const u8x8_display_info_t u8x8_max7219_16x16_display_info =
{
/* chip_enable_level = */ 0,
/* chip_disable_level = */ 1,
/* post_chip_enable_wait_ns = */ 100,
/* pre_chip_disable_wait_ns = */ 100,
/* reset_pulse_width_ms = */ 100,
/* post_reset_wait_ms = */ 100,
/* sda_setup_time_ns = */ 100,
/* sck_pulse_width_ns = */ 100,
/* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
/* spi_mode = */ 0, /* active high, rising edge */
/* i2c_bus_clock_100kHz = */ 4,
/* data_setup_time_ns = */ 40,
/* write_pulse_width_ns = */ 150,
/* tile_width = */ 2,
/* tile_hight = */ 2,
/* default_x_offset = */ 0,
/* flipmode_x_offset = */ 0,
/* pixel_width = */ 16,
/* pixel_height = */ 16
};
uint8_t u8x8_d_max7219_16x16(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_DISPLAY_SETUP_MEMORY :
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_max7219_16x16_display_info);
return 1;
case U8X8_MSG_DISPLAY_INIT:
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_init_seq);
return 1;
case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
if ( arg_int == 0 )
u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave0_seq);
else
u8x8_cad_SendSequence(u8x8, u8x8_d_max7219_powersave1_seq);
return 1;
}
return u8x8_d_max7219_generic(u8x8, msg, arg_int, arg_ptr);
}
/*==============================*/
static const u8x8_display_info_t u8x8_max7219_8x8_display_info =
{
/* chip_enable_level = */ 0,