Skip to content

Commit 2d8b37d

Browse files
authored
Merge pull request #74 from AllenNeuralDynamics/feat-static-reg-address-to-specs
make `reg_address_to_specs` static and public
2 parents 7e87de4 + 773d756 commit 2d8b37d

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

firmware/inc/harp_core.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
// Project version
2020
inline constexpr size_t PICO_CORE_VERSION_MAJOR = 0;
21-
inline constexpr size_t PICO_CORE_VERSION_MINOR = 2;
21+
inline constexpr size_t PICO_CORE_VERSION_MINOR = 3;
2222
inline constexpr size_t PICO_CORE_VERSION_PATCH = 0;
2323

2424
// Version of the Harp Protocol that this library most closely implements.
@@ -172,7 +172,7 @@ using enum reg_type_t;
172172
*/
173173
static inline void copy_msg_payload_to_register(msg_t& msg)
174174
{
175-
const RegSpecs& specs = self->reg_address_to_specs(msg.header.address);
175+
const RegSpecs& specs = reg_address_to_specs(msg.header.address);
176176
memcpy((void*)specs.base_ptr, msg.payload, specs.num_bytes);
177177
}
178178

@@ -227,7 +227,7 @@ using enum reg_type_t;
227227
*/
228228
static inline void send_harp_reply(msg_type_t reply_type, uint8_t reg_name)
229229
{
230-
const RegSpecs& specs = self->reg_address_to_specs(reg_name);
230+
const RegSpecs& specs = reg_address_to_specs(reg_name);
231231
send_harp_reply(reply_type, reg_name, specs.base_ptr, specs.num_bytes,
232232
specs.payload_type);
233233
}
@@ -245,7 +245,7 @@ using enum reg_type_t;
245245
static inline void send_harp_reply(msg_type_t reply_type, uint8_t reg_name,
246246
uint64_t harp_time_us)
247247
{
248-
const RegSpecs& specs = self->reg_address_to_specs(reg_name);
248+
const RegSpecs& specs = reg_address_to_specs(reg_name);
249249
send_harp_reply(reply_type, reg_name, specs.base_ptr, specs.num_bytes,
250250
specs.payload_type, harp_time_us);
251251
}
@@ -401,6 +401,14 @@ using enum reg_type_t;
401401
memcpy((void*)(&self->regs.R_UUID[offset]), (void*)uuid, num_bytes);
402402
}
403403

404+
/**
405+
* \brief return a reference to the specified core or app register's specs used
406+
* for issuing a harp reply for that register.
407+
* \details address is the full address range where 0 is the first core
408+
* register, and APP_REG_START_ADDRESS is the first app register.
409+
*/
410+
static const RegSpecs& reg_address_to_specs(uint8_t address);
411+
404412
protected:
405413
/**
406414
* \brief entry point for handling incoming harp messages to core registers.
@@ -578,14 +586,6 @@ using enum reg_type_t;
578586
*/
579587
static void set_timestamp_regs(uint64_t harp_time_us);
580588

581-
/**
582-
* \brief return a reference to the specified core or app register's specs used
583-
* for issuing a harp reply for that register.
584-
* \details address is the full address range where 0 is the first core
585-
* register, and APP_REG_START_ADDRESS is the first app register.
586-
*/
587-
const RegSpecs& reg_address_to_specs(uint8_t address);
588-
589589
// core register read handler functions. Handles read operations on those
590590
// registers. One-per-harp-register where necessary, but read_reg_generic()
591591
// can be used in most cases.

firmware/src/harp_core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ void HarpCore::update_state(bool force, op_mode_t forced_next_state)
241241
const RegSpecs& HarpCore::reg_address_to_specs(uint8_t address)
242242
{
243243
if (address < CORE_REG_COUNT)
244-
return regs_.address_to_specs[address];
245-
return address_to_app_reg_specs(address); // virtual. Implemented by app.
244+
return self->regs_.address_to_specs[address];
245+
return self->address_to_app_reg_specs(address); // virtual. Implemented by app.
246246
}
247247

248248
void HarpCore::send_harp_reply(msg_type_t reply_type, uint8_t reg_name,

0 commit comments

Comments
 (0)