Skip to content

Commit

Permalink
marble.c and marble.h: don't use raw Unicode in C source
Browse files Browse the repository at this point in the history
Represent Unicode MICRO SIGN with the standard ASCII C string "\u00b5"
  • Loading branch information
ldoolitt committed Aug 30, 2024
1 parent cf6c0fd commit d8a1d11
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions board_support/marble_soc/firmware/marble.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ void get_qsfp_info(qsfp_info_t *qsfp_param) {
qsfp_param->voltage = (int16_t)(buf[0] << 8 | buf[1]) / 10; // mV
marble_i2c_read(qsfp_param->i2c_addr, 42, buf, 8);
for (i=0; i < 4; i++) {
qsfp_param->bias_current[i] = (int16_t)(buf[2*i] << 8 | buf[2*i+1]) * 2; // µA
qsfp_param->bias_current[i] = (int16_t)(buf[2*i] << 8 | buf[2*i+1]) * 2; // microA
}
marble_i2c_read(qsfp_param->i2c_addr, 50, buf, 8);
for (i=0; i < 4; i++) {
qsfp_param->tx_power[i] = (int16_t)(buf[2*i] << 8 | buf[2*i+1]) / 10; // µW
qsfp_param->tx_power[i] = (int16_t)(buf[2*i] << 8 | buf[2*i+1]) / 10; // microW
}
marble_i2c_read(qsfp_param->i2c_addr, 34, buf, 8);
for (i=0; i < 4; i++) {
qsfp_param->rx_power[i] = (int16_t)(buf[2*i] << 8 | buf[2*i+1]) / 10; // µW
qsfp_param->rx_power[i] = (int16_t)(buf[2*i] << 8 | buf[2*i+1]) / 10; // microW
}
}

Expand Down Expand Up @@ -283,6 +283,8 @@ void print_marble_status(void) {
printf(" %s: I0 : %#12X\n",__func__, pca9555[i].i0_val);
printf(" %s: I1 : %#12X\n",__func__, pca9555[i].i1_val);
}
// MICRO SIGN https://en.wikipedia.org/wiki/%CE%9C#Character_encodings
#define MICRO "\u00b5"
for (unsigned i=0; i<2; i++) {
if (qsfp[i].module_present) {
printf(" %s: QSFP%1u Vendor : %.16s\n", __func__, i+1, qsfp[i].vendor_name);
Expand All @@ -292,11 +294,11 @@ void print_marble_status(void) {
printf(" %s: QSFP%1u Temp : %8d C\n", __func__, i+1, qsfp[i].temperature);
printf(" %s: QSFP%1u Volt : %8d mV\n", __func__, i+1, qsfp[i].voltage);
for (unsigned j=0; j < 4; j++) {
printf(" %s: QSFP%1u TxBias %u: %8d µA\n", __func__,
printf(" %s: QSFP%1u TxBias %u: %8d " MICRO "A\n", __func__,
i+1, j, qsfp[i].bias_current[j]);
printf(" %s: QSFP%1u TxPwr %u: %8d µW\n", __func__,
printf(" %s: QSFP%1u TxPwr %u: %8d " MICRO "W\n", __func__,
i+1, j, qsfp[i].tx_power[j]);
printf(" %s: QSFP%1u RxPwr %d: %8u µW\n", __func__,
printf(" %s: QSFP%1u RxPwr %d: %8u " MICRO "W\n", __func__,
i+1, j, qsfp[i].rx_power[j]);
}
}
Expand Down
6 changes: 3 additions & 3 deletions board_support/marble_soc/firmware/marble.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ typedef struct qsfp_info_t {
int16_t temperature;
/** Internally measured voltage, LSB 0.1 mV. Page 00h Byte 26-27 */
uint16_t voltage;
/** Tx bias current, LSB 2 µA, Page 00h Byte 42-49 */
/** Tx bias current, LSB 2 microA, Page 00h Byte 42-49 */
uint16_t bias_current[4];
/** Rx power, LSB 0.1 µW, Page 00h Byte 34-41 */
/** Rx power, LSB 0.1 microW, Page 00h Byte 34-41 */
uint16_t rx_power[4];
/** Tx power, LSB 0.1 µW, Page 00h Byte 50-57 */
/** Tx power, LSB 0.1 microW, Page 00h Byte 50-57 */
uint16_t tx_power[4];
/** Page 00h Byte 148-163 */
unsigned char vendor_name[16];
Expand Down

0 comments on commit d8a1d11

Please sign in to comment.