@@ -65,14 +65,14 @@ void analogout_init(dac_t *obj, PinName pin) {
65
65
DAC_InitStructure .DAC_WaveGeneration = DAC_WaveGeneration_None ;
66
66
DAC_InitStructure .DAC_OutputBuffer = DAC_OutputBuffer_Disable ;
67
67
68
- if (pin == PA_4 ) {
68
+ if (obj -> channel == PA_4 ) {
69
69
DAC_Init (DAC_Channel_1 , & DAC_InitStructure );
70
70
DAC_Cmd (DAC_Channel_1 , ENABLE );
71
71
}
72
- else { // PA_5
73
- DAC_Init (DAC_Channel_2 , & DAC_InitStructure );
74
- DAC_Cmd (DAC_Channel_2 , ENABLE );
75
- }
72
+ //if (obj->channel == PA_5) {
73
+ // DAC_Init(DAC_Channel_2, &DAC_InitStructure);
74
+ // DAC_Cmd(DAC_Channel_2, ENABLE);
75
+ // }
76
76
77
77
analogout_write_u16 (obj , 0 );
78
78
}
@@ -84,18 +84,19 @@ static inline void dac_write(dac_t *obj, uint16_t value) {
84
84
if (obj -> channel == PA_4 ) {
85
85
DAC_SetChannel1Data (DAC_Align_12b_R , value );
86
86
}
87
- else { // PA_5
88
- DAC_SetChannel2Data (DAC_Align_12b_R , value );
89
- }
87
+ //if (obj->channel == PA_5) {
88
+ // DAC_SetChannel2Data(DAC_Align_12b_R, value);
89
+ // }
90
90
}
91
91
92
92
static inline int dac_read (dac_t * obj ) {
93
93
if (obj -> channel == PA_4 ) {
94
94
return (int )DAC_GetDataOutputValue (DAC_Channel_1 );
95
95
}
96
- else { // PA_5
97
- return (int )DAC_GetDataOutputValue (DAC_Channel_2 );
98
- }
96
+ //if (obj->channel == PA_5) {
97
+ // return (int)DAC_GetDataOutputValue(DAC_Channel_2);
98
+ //}
99
+ return 0 ;
99
100
}
100
101
101
102
void analogout_write (dac_t * obj , float value ) {
0 commit comments