You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
3.2 KiB
161 lines
3.2 KiB
/**
|
|
**************************************************************************************************
|
|
* @file max7219.h
|
|
* @author Kerem Yollu & Edwin Koch
|
|
* @date 25.08.2022
|
|
* @version 1.0
|
|
**************************************************************************************************
|
|
* @brief
|
|
*
|
|
* **Detailed Description :**
|
|
*
|
|
* @todo
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
#ifndef _MAX7219_H_
|
|
#define _MAX7219_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include "spi.h"
|
|
#include "pin.h"
|
|
|
|
typedef enum{
|
|
NO_DECODE_DIGIT_7_TO_0 = 0x00,
|
|
CODE_B_DECODE_ONLY_DIGIT_0 = 0x01,
|
|
CODE_B_DECODE_ONLY_DIGIT_3_TO_0 = 0x0F,
|
|
CODE_B_DECOD_DIGIT_7_TO_0 = 0xFF
|
|
}max7219_decodeMode_t;
|
|
|
|
typedef enum{
|
|
DISPLAY_DIGIT_0 = 0x00,
|
|
DISPLAY_DIGIT_1_TO_0 = 0x01,
|
|
DSIPLAX_DIGIT_2_TO_0 = 0x02,
|
|
DSIPLAX_DIGIT_3_TO_0 = 0x03,
|
|
DSIPLAX_DIGIT_4_TO_0 = 0x04,
|
|
DSIPLAX_DIGIT_5_TO_0 = 0x05,
|
|
DSIPLAX_DIGIT_6_TO_0 = 0x06,
|
|
DSIPLAX_DIGIT_7_TO_0 = 0x07
|
|
}max7219_scanLimit_t;
|
|
|
|
/**
|
|
* @brief max7219 matrix class
|
|
*
|
|
* The matrix can be ccomposed of only one ore many devices daysichained
|
|
* together.
|
|
* @var *spiCH Pointer to spi channel object
|
|
* @var nDevicesChained Ammount of devices hoocked up together
|
|
* @var brightness brightness of the matrix
|
|
* @var buf Array of matrix content. Each n to n + 7 (n can be 0, 8, 16, etc) represents the
|
|
* content of one individual max7219 device.
|
|
*/
|
|
typedef struct{
|
|
spi_ch_t *spiCH;
|
|
uint8_t nDevicesChained;
|
|
uint8_t brightness;
|
|
uint8_t buf[];
|
|
}max7219_mx_t;
|
|
|
|
void max7219_t_mx_init(
|
|
max7219_mx_t *matrix,
|
|
spi_ch_t *spiChannel,
|
|
uint8_t *pBuf,
|
|
uint8_t bufLen);
|
|
|
|
void max7219_mx_setPixel(
|
|
max7219_mx_t *matrix,
|
|
uint8_t row,
|
|
uint8_t col,
|
|
uint8_t logic);
|
|
|
|
void max7219_mx_print(
|
|
max7219_mx_t *matrix,
|
|
char *text,
|
|
uint8_t len);
|
|
|
|
void max7219_mx_show(
|
|
max7219_mx_t *matrix);
|
|
|
|
void max7219_mx_shutdown(
|
|
max7219_mx_t *matrix);
|
|
|
|
void max7219_mx_test(
|
|
max7219_mx_t *matrix);
|
|
|
|
void max7219_mx_mapMatrix(
|
|
max7219_mx_t *matrix,
|
|
uint8_t *map);
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
void max7219_init(
|
|
max7219_t *display,
|
|
spi_ch_t *spi_ch);
|
|
|
|
void max7219_testDisplay(
|
|
max7219_t *display,
|
|
uint8_t logic);
|
|
|
|
void max7219_shutdownDiaply(
|
|
max7219_t *display,
|
|
uint8_t logic);
|
|
|
|
void max7219_setDecodeMode(
|
|
max7219_t *display,
|
|
max7219_decodeMode_t dmode);
|
|
|
|
void max7219_setIntensity(
|
|
max7219_t *display,
|
|
uint8_t intensity);
|
|
|
|
void max7219_setScanLimit(
|
|
max7219_t *display,
|
|
max7219_scanLimit_t slimit);
|
|
|
|
void max7219_setAllLEDsOff(
|
|
max7219_t *display);
|
|
|
|
void max7219_ledMatrixSetLED(
|
|
max7219_t *display,
|
|
uint8_t row,
|
|
uint8_t col);
|
|
|
|
void max7219_rawWrite(
|
|
max7219_t *display,
|
|
uint8_t reg,
|
|
uint8_t data);
|
|
|
|
void max7219_printLedMatrix(
|
|
max7219_t *display,
|
|
uint8_t matrix[]);
|
|
|
|
void max7219_ledMatrixUnsetLED(
|
|
max7219_t *display,
|
|
uint8_t row,
|
|
uint8_t col);
|
|
#if 0
|
|
// daysichained matrix
|
|
typedef struct{
|
|
spi_ch_t *spiCH;
|
|
uint8_t nDevices;
|
|
}max7219_dm_t;
|
|
|
|
|
|
void max7219_dm_write(
|
|
max7219_dm_t *matrix,
|
|
uint8_t **data);
|
|
#endif
|
|
*/
|
|
#ifdef _cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // _MAX7219_H_
|