Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4787

Interpret to Picbasic Code ¿?!!

$
0
0
Hello,

As I interpret this in Picbasic code:
It is for the IC MAX17040, Project GauGauge
Clearly are functions or subroutines.

The lines 111 and 123, I think are Subrutines.
The lines 117 and 118 , I think variable reg MSB,LSB
The lines 113 and 125, I think calls to chip
The lines 129 and 130, I think variable reg MSB,LSB

But the lines 114, 115 ,120 and 132 I don´t understand.

-------------------------------------------------------------
Code:


111 static void max17040_get_vcell(struct i2c_client *client)
112 {
113        struct max17040_chip *chip = i2c_get_clientdata(client);
114        u8 msb;
115        u8 lsb;
116
117        msb = max17040_read_reg(client, MAX17040_VCELL_MSB);
118        lsb = max17040_read_reg(client, MAX17040_VCELL_LSB);
119
120        chip->vcell = (msb << 4) + (lsb >> 4);
121 }
122
123 static void max17040_get_soc(struct i2c_client *client)
124 {
125        struct max17040_chip *chip = i2c_get_clientdata(client);
126        u8 msb;
127        u8 lsb;
128
129        msb = max17040_read_reg(client, MAX17040_SOC_MSB);
130        lsb = max17040_read_reg(client, MAX17040_SOC_LSB);
131
132        chip->soc = msb;
133 }
134

THX.

Viewing all articles
Browse latest Browse all 4787

Trending Articles