@@ -65,14 +65,14 @@ void analogout_init(dac_t *obj, PinName pin) {
6565 DAC_InitStructure .DAC_WaveGeneration = DAC_WaveGeneration_None ;
6666 DAC_InitStructure .DAC_OutputBuffer = DAC_OutputBuffer_Disable ;
6767
68- if (pin == PA_4 ) {
68+ if (obj -> channel == PA_4 ) {
6969 DAC_Init (DAC_Channel_1 , & DAC_InitStructure );
7070 DAC_Cmd (DAC_Channel_1 , ENABLE );
7171 }
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+ // }
7676
7777 analogout_write_u16 (obj , 0 );
7878}
@@ -84,18 +84,19 @@ static inline void dac_write(dac_t *obj, uint16_t value) {
8484 if (obj -> channel == PA_4 ) {
8585 DAC_SetChannel1Data (DAC_Align_12b_R , value );
8686 }
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+ // }
9090}
9191
9292static inline int dac_read (dac_t * obj ) {
9393 if (obj -> channel == PA_4 ) {
9494 return (int )DAC_GetDataOutputValue (DAC_Channel_1 );
9595 }
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 ;
99100}
100101
101102void analogout_write (dac_t * obj , float value ) {
0 commit comments