This commit is contained in:
parent
0885aa7e36
commit
d6ea4d7b9f
|
@ -26,7 +26,7 @@ public:
|
||||||
void Send(byte* buf, uint len);
|
void Send(byte* buf, uint len);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
byte _index;
|
CAN _index;
|
||||||
int Remap;
|
int Remap;
|
||||||
|
|
||||||
void* _Tx;
|
void* _Tx;
|
||||||
|
|
|
@ -17,20 +17,20 @@ void Can::OnOpen()
|
||||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1, ENABLE);
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1, ENABLE);
|
||||||
/*IO设置*/
|
/*IO设置*/
|
||||||
#ifdef STM32F1
|
#ifdef STM32F1
|
||||||
if(index == Can1)
|
if(_index == Can1)
|
||||||
{
|
{
|
||||||
if(remap == 1)
|
if(Remap == 1)
|
||||||
GPIO_PinRemapConfig(GPIO_Remap1_CAN1, ENABLE);
|
GPIO_PinRemapConfig(GPIO_Remap1_CAN1, ENABLE);
|
||||||
else if(remap == 2)
|
else if(Remap == 2)
|
||||||
GPIO_PinRemapConfig(GPIO_Remap2_CAN1, ENABLE);
|
GPIO_PinRemapConfig(GPIO_Remap2_CAN1, ENABLE);
|
||||||
}
|
}
|
||||||
else if(index == Can2)
|
else if(_index == Can2)
|
||||||
GPIO_PinRemapConfig(GPIO_Remap_CAN2, ENABLE);
|
GPIO_PinRemapConfig(GPIO_Remap_CAN2, ENABLE);
|
||||||
|
|
||||||
const Pin* p = g_CAN_Pins_Map;
|
const Pin* p = g_CAN_Pins_Map;
|
||||||
if(remap == 2)
|
if(Remap == 2)
|
||||||
p = g_CAN_Pins_Map2;
|
p = g_CAN_Pins_Map2;
|
||||||
else if(remap == 3)
|
else if(Remap == 3)
|
||||||
p = g_CAN_Pins_Map3;
|
p = g_CAN_Pins_Map3;
|
||||||
|
|
||||||
AlternatePort tx(p[0]);
|
AlternatePort tx(p[0]);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "DAC.h"
|
#include "Port.h"
|
||||||
|
#include "DAC.h"
|
||||||
|
|
||||||
#include "Platform\stm32.h"
|
#include "Platform\stm32.h"
|
||||||
|
|
||||||
|
@ -50,9 +51,9 @@ bool DAConverter::OnWrite(ushort value) // 处理对齐问题
|
||||||
{
|
{
|
||||||
//if (Opened)return false;
|
//if (Opened)return false;
|
||||||
if (Channel == DAC_Channel_1)
|
if (Channel == DAC_Channel_1)
|
||||||
DAC_SetChannel1Data(Align, dat);
|
DAC_SetChannel1Data(Align, value);
|
||||||
else
|
else
|
||||||
DAC_SetChannel2Data(Align, dat);
|
DAC_SetChannel2Data(Align, value);
|
||||||
DAC_SoftwareTriggerCmd(Channel, ENABLE);
|
DAC_SoftwareTriggerCmd(Channel, ENABLE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue