parent
2a11d01505
commit
7913d14e09
@ -1,299 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE QtCreatorProject> |
||||
<!-- Written by QtCreator 3.6.1, 2016-05-12T09:24:15. --> |
||||
<qtcreator> |
||||
<data> |
||||
<variable>EnvironmentId</variable> |
||||
<value type="QByteArray">{dfe3cb4a-0f3e-4da9-9c52-5d2c464adafb}</value> |
||||
</data> |
||||
<data> |
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable> |
||||
<value type="int">0</value> |
||||
</data> |
||||
<data> |
||||
<variable>ProjectExplorer.Project.EditorSettings</variable> |
||||
<valuemap type="QVariantMap"> |
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
||||
<value type="QString" key="language">Cpp</value> |
||||
<valuemap type="QVariantMap" key="value"> |
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
||||
</valuemap> |
||||
</valuemap> |
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
||||
<value type="QString" key="language">QmlJS</value> |
||||
<valuemap type="QVariantMap" key="value"> |
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
||||
</valuemap> |
||||
</valuemap> |
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value> |
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">true</value> |
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value> |
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value> |
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value> |
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value> |
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
||||
<value type="int" key="EditorConfiguration.TabSize">8</value> |
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">true</value> |
||||
</valuemap> |
||||
</data> |
||||
<data> |
||||
<variable>ProjectExplorer.Project.PluginSettings</variable> |
||||
<valuemap type="QVariantMap"> |
||||
<valuemap type="QVariantMap" key="ClangProjectSettings"> |
||||
<value type="QString" key="CustomPchFile"></value> |
||||
<value type="int" key="PchUsage">1</value> |
||||
</valuemap> |
||||
</valuemap> |
||||
</data> |
||||
<data> |
||||
<variable>ProjectExplorer.Project.Target.0</variable> |
||||
<valuemap type="QVariantMap"> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">STLINK</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">STLINK</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{15262c8f-05de-48ee-9452-3d289b21ba3e}</value> |
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">-1</value> |
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ondra/devel/f103</value> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
||||
<value type="QString">-w</value> |
||||
<value type="QString">-r</value> |
||||
</valuelist> |
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-B -j 4</value> |
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
||||
</valuemap> |
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
||||
</valuemap> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
||||
<value type="QString">-w</value> |
||||
<value type="QString">-r</value> |
||||
</valuelist> |
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
||||
</valuemap> |
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
||||
</valuemap> |
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Main</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> |
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
||||
</valuemap> |
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">0</value> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> |
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> |
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> |
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
||||
<value type="int">0</value> |
||||
<value type="int">1</value> |
||||
<value type="int">2</value> |
||||
<value type="int">3</value> |
||||
<value type="int">4</value> |
||||
<value type="int">5</value> |
||||
<value type="int">6</value> |
||||
<value type="int">7</value> |
||||
<value type="int">8</value> |
||||
<value type="int">9</value> |
||||
<value type="int">10</value> |
||||
<value type="int">11</value> |
||||
<value type="int">12</value> |
||||
<value type="int">13</value> |
||||
<value type="int">14</value> |
||||
</valuelist> |
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value> |
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments">flash</value> |
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">/usr/bin/make</value> |
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run /usr/bin/make</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">make flash</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> |
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
||||
</valuemap> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1"> |
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> |
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> |
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> |
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
||||
<value type="int">0</value> |
||||
<value type="int">1</value> |
||||
<value type="int">2</value> |
||||
<value type="int">3</value> |
||||
<value type="int">4</value> |
||||
<value type="int">5</value> |
||||
<value type="int">6</value> |
||||
<value type="int">7</value> |
||||
<value type="int">8</value> |
||||
<value type="int">9</value> |
||||
<value type="int">10</value> |
||||
<value type="int">11</value> |
||||
<value type="int">12</value> |
||||
<value type="int">13</value> |
||||
<value type="int">14</value> |
||||
</valuelist> |
||||
<value type="QString" key="BareMetal.RunConfig.WorkingDirectory"></value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">f103 (via GDB server or hardware debugger)</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">BareMetal/home/ondra/devel/f103/f103.pro</value> |
||||
<value type="QString" key="Qt4ProjectManager.MaemoRunConfiguration.Arguments"></value> |
||||
<value type="QString" key="Qt4ProjectManager.MaemoRunConfiguration.ProFile">f103.pro</value> |
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
||||
</valuemap> |
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.2"> |
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> |
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> |
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> |
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
||||
<value type="int">0</value> |
||||
<value type="int">1</value> |
||||
<value type="int">2</value> |
||||
<value type="int">3</value> |
||||
<value type="int">4</value> |
||||
<value type="int">5</value> |
||||
<value type="int">6</value> |
||||
<value type="int">7</value> |
||||
<value type="int">8</value> |
||||
<value type="int">9</value> |
||||
<value type="int">10</value> |
||||
<value type="int">11</value> |
||||
<value type="int">12</value> |
||||
<value type="int">13</value> |
||||
<value type="int">14</value> |
||||
</valuelist> |
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value> |
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> |
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">/home/ondra/devel/f103/main.elf</value> |
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/home/ondra/devel/f103</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run /home/ondra/devel/f103/main.elf</value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> |
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
||||
</valuemap> |
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">3</value> |
||||
</valuemap> |
||||
</data> |
||||
<data> |
||||
<variable>ProjectExplorer.Project.TargetCount</variable> |
||||
<value type="int">1</value> |
||||
</data> |
||||
<data> |
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
||||
<value type="int">18</value> |
||||
</data> |
||||
<data> |
||||
<variable>Version</variable> |
||||
<value type="int">18</value> |
||||
</data> |
||||
</qtcreator> |
@ -0,0 +1,87 @@ |
||||
#include <main.h> |
||||
#include <matrixdsp.h> |
||||
|
||||
#include "com/debug.h" |
||||
|
||||
#include "utils/timebase.h" |
||||
|
||||
static void send_byte(uint8_t b) |
||||
{ |
||||
MDSP_SPIx->DR = b; |
||||
while (!(MDSP_SPIx->SR & SPI_SR_TXE)); |
||||
} |
||||
|
||||
static void set_nss(bool nss) |
||||
{ |
||||
if (nss) { |
||||
MDSP_NSS_GPIO->BSRR = MDSP_NSS_PIN; |
||||
} else { |
||||
MDSP_NSS_GPIO->BRR = MDSP_NSS_PIN; |
||||
} |
||||
} |
||||
|
||||
static void send_word(MDSP_Command cmd, uint8_t data) |
||||
{ |
||||
send_byte(cmd); |
||||
send_byte(data); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Send a command to n-th chained driver |
||||
* @param idx Driver index (0, 1, 2 ...) |
||||
* @param cmd command to send |
||||
* @param data command argument |
||||
*/ |
||||
void mdsp_send_command(uint8_t idx, MDSP_Command cmd, uint8_t data) |
||||
{ |
||||
dbg("Set %d: cmd 0x%02x, data 0x%02x", idx, cmd, data); |
||||
|
||||
set_nss(false); |
||||
while (MDSP_SPIx->SR & SPI_SR_BSY); |
||||
|
||||
for (uint8_t i = 0; i < MDSP_CHAIN_COUNT - idx - 1; i++) { |
||||
send_word(CMD_NOOP, 0); |
||||
} |
||||
|
||||
send_word(cmd, data); |
||||
|
||||
for (uint8_t i = 0; i < idx; i++) { |
||||
send_word(CMD_NOOP, 0); |
||||
} |
||||
|
||||
while (MDSP_SPIx->SR & SPI_SR_BSY); |
||||
set_nss(false); |
||||
set_nss(true); |
||||
} |
||||
|
||||
|
||||
void mdsp_send_command_all(MDSP_Command cmd, uint8_t data) |
||||
{ |
||||
dbg("Set cmd 0x%02x, data 0x%02x ALL", cmd, data); |
||||
|
||||
set_nss(false); |
||||
while (MDSP_SPIx->SR & SPI_SR_BSY); |
||||
|
||||
for (uint8_t i = 0; i < MDSP_CHAIN_COUNT; i++) { |
||||
send_word(cmd, data); |
||||
} |
||||
|
||||
while (MDSP_SPIx->SR & SPI_SR_BSY); |
||||
|
||||
set_nss(false); |
||||
set_nss(true); |
||||
} |
||||
|
||||
void mdsp_set(uint8_t column, uint8_t bits) |
||||
{ |
||||
if (column >= MDSP_COLUMN_COUNT) return; |
||||
|
||||
mdsp_send_command(column >> 3, CMD_DIGIT0 + (column & 0x7), bits); |
||||
} |
||||
|
||||
void mdsp_clear(void) |
||||
{ |
||||
for (uint8_t i = 0; i < 8; i++) { |
||||
mdsp_send_command_all(CMD_DIGIT0+i, 0); |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
#ifndef MATRIXDSP_H |
||||
#define MATRIXDSP_H |
||||
|
||||
#include <main.h> |
||||
|
||||
#define MDSP_SPIx SPI1 |
||||
#define MDSP_NSS_GPIO GPIOA |
||||
#define MDSP_NSS_PIN GPIO_Pin_4; |
||||
|
||||
#define MDSP_CHAIN_COUNT 4 |
||||
#define MDSP_COLUMN_COUNT (MDSP_CHAIN_COUNT*8) |
||||
|
||||
typedef enum { |
||||
CMD_NOOP = 0x00, |
||||
|
||||
CMD_DIGIT0 = 0x01, |
||||
CMD_DIGIT1 = 0x02, |
||||
CMD_DIGIT2 = 0x03, |
||||
CMD_DIGIT3 = 0x04, |
||||
CMD_DIGIT4 = 0x05, |
||||
CMD_DIGIT5 = 0x06, |
||||
CMD_DIGIT6 = 0x07, |
||||
CMD_DIGIT7 = 0x08, |
||||
|
||||
CMD_DECODE_MODE = 0x09, |
||||
CMD_INTENSITY = 0x0A, |
||||
CMD_SCAN_LIMIT = 0x0B, |
||||
CMD_SHUTDOWN = 0x0C, |
||||
CMD_DISPLAY_TEST = 0x0F, |
||||
} MDSP_Command; |
||||
|
||||
void mdsp_set(uint8_t column, uint8_t bits); |
||||
|
||||
void mdsp_clear(void); |
||||
|
||||
/**
|
||||
* @brief Send a command to n-th chained driver |
||||
* @param idx Driver index (0, 1, 2 ...) |
||||
* @param cmd command to send |
||||
* @param data command argument |
||||
*/ |
||||
void mdsp_send_command(uint8_t idx, MDSP_Command cmd, uint8_t data); |
||||
|
||||
|
||||
void mdsp_send_command_all(MDSP_Command cmd, uint8_t data); |
||||
|
||||
#endif // MATRIXDSP_H
|
Loading…
Reference in new issue