working on driver for the max7219 to test the spi interface. Problem remains with the integration of the device drivers inside the cmake project
parent
78ce1a0ec4
commit
978ca001eb
@ -0,0 +1,22 @@
|
||||
#include "max7219.h"
|
||||
|
||||
void max7219_init(
|
||||
max7219_t *display,
|
||||
spi_ch_t *spi_ch)
|
||||
{
|
||||
display->spiCH = spi_ch;
|
||||
}
|
||||
|
||||
void max7219_testDisplay(
|
||||
max7219_t *display,
|
||||
uint8_t logic)
|
||||
{
|
||||
if(logic) {
|
||||
spiWriteReg(display->spiCH, 0x0F, 0x01);
|
||||
} else {
|
||||
spiWriteReg(display->spiCH, 0x0F, 0x00);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,65 @@
|
||||
/**
|
||||
**************************************************************************************************
|
||||
* @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"
|
||||
|
||||
typedef struct{
|
||||
spi_ch_t *spiCH;
|
||||
}max7219_t;
|
||||
#if 0
|
||||
/*
|
||||
* @brief TODO:
|
||||
*/
|
||||
void max7219_init(
|
||||
max7219_t *display,
|
||||
spi_ch_t *spi_ch);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Test Display
|
||||
* Test Display by setting logic > 0 and stop testing by setting logic = 0
|
||||
* In test mode all the LEDs should light up. Stopping testmode will resume back to previous
|
||||
* setting.
|
||||
* @param *display pointer to max7219 display object
|
||||
* @param logic logic state for logic high enter value > 0 and for low enter value = 0
|
||||
*/
|
||||
void max7219_testDisplay(
|
||||
max7219_t *display,
|
||||
uint8_t logic);
|
||||
|
||||
/**
|
||||
* @brief Shutdown Display
|
||||
* Shut down the display by setting the logic value > 0. To activate the display again set
|
||||
* logic = 0.
|
||||
* @param
|
||||
*/
|
||||
void max7219_shutdownDisplay(
|
||||
max7219_t *display,
|
||||
uint8_t logic);
|
||||
#endif
|
||||
|
||||
#ifdef _cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _MAX7219_H_
|
Loading…
Reference in new issue