MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / initAtgm336h

Function initAtgm336h

Tactility/Source/hal/gps/GpsInit.cpp:215–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215bool initAtgm336h(::Device* uart) {
216 uint8_t buffer[256];
217
218 // Set the intial configuration of the device - these _should_ work for most AT6558 devices
219 int msglen = makeCASPacket(buffer, 0x06, 0x07, sizeof(_message_CAS_CFG_NAVX_CONF), _message_CAS_CFG_NAVX_CONF);
220 uart_controller_write_bytes(uart, buffer, msglen, 250);
221 if (getACKCas(uart, 0x06, 0x07, 250) != GpsResponse::Ok) {
222 LOGGER.warn("ATGM336H: Could not set Config");
223 }
224
225 // Set the update frequence to 1Hz
226 msglen = makeCASPacket(buffer, 0x06, 0x04, sizeof(_message_CAS_CFG_RATE_1HZ), _message_CAS_CFG_RATE_1HZ);
227 uart_controller_write_bytes(uart, buffer, msglen, 250);
228 if (getACKCas(uart, 0x06, 0x04, 250) != GpsResponse::Ok) {
229 LOGGER.warn("ATGM336H: Could not set Update Frequency");
230 }
231
232 // Set the NEMA output messages
233 // Ask for only RMC and GGA
234 uint8_t fields[] = {CAS_NEMA_RMC, CAS_NEMA_GGA};
235 for (unsigned int i = 0; i < sizeof(fields); i++) {
236 // Construct a CAS-CFG-MSG packet
237 uint8_t cas_cfg_msg_packet[] = {0x4e, fields[i], 0x01, 0x00};
238 msglen = makeCASPacket(buffer, 0x06, 0x01, sizeof(cas_cfg_msg_packet), cas_cfg_msg_packet);
239 uart_controller_write_bytes(uart, buffer, msglen, 250);
240 if (getACKCas(uart, 0x06, 0x01, 250) != GpsResponse::Ok) {
241 LOGGER.warn("ATGM336H: Could not enable NMEA MSG: {}", fields[i]);
242 }
243 }
244 return true;
245}
246
247bool initMtkPa1616s(::Device* uart) {
248 // PA1616S is used in some GPS breakout boards from Adafruit

Callers 1

initFunction · 0.85

Calls 4

makeCASPacketFunction · 0.85
getACKCasFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected