#define DIN_L_1 HAL_GPIO_WritePin(GPIOA,GPIO_PIN_8, GPIO_PIN_SET);
#define DIN_L_0 HAL_GPIO_WritePin(GPIOA,GPIO_PIN_8, GPIO_PIN_RESET);
#define CLK_L_1 HAL_GPIO_WritePin(GPIOA,GPIO_PIN_9, GPIO_PIN_SET);
#define CLK_L_0 HAL_GPIO_WritePin(GPIOA,GPIO_PIN_9, GPIO_PIN_RESET);
#define STB_L_1 HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10, GPIO_PIN_SET);
#define STB_L_0 HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10, GPIO_PIN_RESET);
//**************************************** STLED 316 ************************************************** ************************************
#define WRITE_COMMAND 0x00
#define READ_COMMAND 0x40
#define FIXD_ADDRESS 0x20
#define INCREMENT_ADDRESS 0x00
#define CHIP_CONFIG_PAGE (0x02 ‹‹ 3)
#define CHIP_CONFIG_ADDRESS 0x00
#define CHIP_CONFIGURATION 0xFD //6 digits,8segments,constand brightness all
#define DIGIT_BRIGHTNESS_PAGE (0x02 ‹‹ 3)
#define DIGIT_BRIGHTNESS_ADDRESS 0x10
#define DIGIT_BRIGHTNESS 0x77
#define LED_BRIGHTNESS_PAGE (0x03 ‹‹ 3)
#define LED_BRIGHTNESS_ADDRESS 0x1
#define SEGMENT_DATA_PAGE (0x00 ‹‹ 3)
#define SEGMENT1_DATA_ADDRESS 0x00
#define SEGMENT2_DATA_ADDRESS 0x01
#define SEGMENT3_DATA_ADDRESS 0x02
#define SEGMENT4_DATA_ADDRESS 0x03
#define SEGMENT5_DATA_ADDRESS 0x04
#define SEGMENT6_DATA_ADDRESS 0x05
#define LED_DATA_PAGE (0x01 ‹‹ 3)
#define LED_DATA_ADDRESS 0x00
void
STLED316S_disp_init(void)
{
uint8_t datas[8];
datas[0] = 0x0D;
// datas[0] = 0x0E;
WriteBuffer_LED (datas, 1);// Switch OFF
HAL_Delay(1);
// Set 4 digits mode
datas[0] = CHIP_CONFIG_PAGE + CHIP_CONFIG_ADDRESS + INCREMENT_ADDRESS + WRITE_COMMAND;
datas[1] = 0xE4;
datas[2] = 0x77;
datas[3] = 0x77;
datas[4] = 0x77;
WriteBuffer_LED (datas, 5);
HAL_Delay(1);
datas[0] = LED_BRIGHTNESS_PAGE + LED_BRIGHTNESS_ADDRESS + INCREMENT_ADDRESS + WRITE_COMMAND;
datas[1] = 0x77;
datas[2] = 0x77;
datas[3] = 0x77;
datas[4] = 0x77;
WriteBuffer_LED (datas, 5);
HAL_Delay(1);
//datas[0] = 0x0D;
// WriteBuffer_LED (datas, 1);// Switch ON
//HAL_Delay(1);
}
/************************************************** *****************************
* WriteBuffer to LED controller 316 *
* Parameter: uint8_t *buffer, uint32_t sizeOfBuffer *
* Return: *
************************************************** *****************************/
void WriteBuffer_LED (uint8_t *buffer, uint32_t sizeOfBuffer)
{
STB_L_0
while (sizeOfBuffer != 0) {
led_write_digit_316 (*buffer);
Delay100us(5);
buffer++; sizeOfBuffer--; }
STB_L_1
}
/************************************************** *****************************
* Write digit to LED controller 316 *
* Parameter: c: digit to be written *
* Return: *
************************************************** *****************************/
void led_write_digit_316 ( uint8_t c)
{
uint8_t i;
digit = c;
for (i = 0; i ‹ 8; i++){
if (digit & 0x80) {DIN_L_1}
else {DIN_L_0}
CLK_L_0
Delay100us(1);
CLK_L_1
Delay100us(1);
CLK_L_0
digit = digit ‹‹ 1;
}
}
вот наработал. но пока без результата