Skip to content

Commit

Permalink
populate hw version depending on LCD version
Browse files Browse the repository at this point in the history
  • Loading branch information
devbis committed Oct 8, 2023
1 parent 2d41a30 commit f5d337f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
* limitations under the License.
*******************************************************************************************************/

#ifndef _SAMPLE_CONTACT_SENSOR_H_
#define _SAMPLE_CONTACT_SENSOR_H_
#ifndef _DEVICE_H_
#define _DEVICE_H_

#include "zcl_include.h"

/**********************************************************************
* CONSTANT
Expand Down Expand Up @@ -169,4 +170,4 @@ void sensorDevice_leaveIndHandler(nlme_leave_ind_t *pLeaveInd);
void sensorDevice_otaProcessMsgHandler(u8 evt, u8 status);


#endif /* _SAMPLE_CONTACT_SENSOR_H_ */
#endif /* _DEVICE_H_ */
4 changes: 4 additions & 0 deletions src/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "app_i2c.h"
#include "lcd.h"
#include "device.h"

#define pm_wait_ms(t) cpu_stall_wakeup_by_timer0(t*CLOCK_16M_SYS_TIMER_CLK_1MS);

Expand Down Expand Up @@ -46,11 +47,14 @@ void init_lcd(bool clear){
if(test_i2c_device(0x3C)){// B1.4
lcd_version = 0;
i2c_address_lcd = 0x78;
g_zcl_basicAttrs.hwVersion = 14;
}else if(test_i2c_device(0x3E)){// B1.9
lcd_version = 2;
i2c_address_lcd = 0x7C;
g_zcl_basicAttrs.hwVersion = 19;
}else{// B1.6 uses UART and is not testable this way
lcd_version = 1;
g_zcl_basicAttrs.hwVersion = 16;
}

if(lcd_version == 0){// B1.4 Hardware
Expand Down

0 comments on commit f5d337f

Please sign in to comment.